Skip to content

RowSelectionBehaviorAPI #1978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

gbirch-stripe
Copy link
Contributor

Summary

rowSelectionBehavior API - adds immediateAction option.
Added new example screen to showcase immediateAction option with modal.

Motivation

The rowSelectionBehavior API provides merchants with more flexibility, especially those who wish to use the Embedded Element as a selection sheet. This API exists on iOS and Android, and this PR brings React Native into alignment with them.
https://jira.corp.stripe.com/browse/MOBILESDK-3619

Testing

  • I tested this manually
  • I added automated tests

Documentation

Select one:

  • I have added relevant documentation for my changes.
  • This PR does not result in any developer-facing changes.

@gbirch-stripe gbirch-stripe changed the title Gbirch/rowselectionbehavior mobilesdk 3619 RowSelectionBehaviorAPI Jun 24, 2025
displayMessage = "An unexpected error occurred",
)
}
@Composable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was also this logic moved to Content?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have the rowSelectionBehaviorType upon initialization, so by putting the builder in Content we can assure that that data is available and we can pass it to the native Android component

Copy link
Collaborator

@tjclawson-stripe tjclawson-stripe Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do a LaunchedEffect for rowSelectionBehaviorType in Content? Tagging in @tianzhao-stripe as he implemented this on native android, any thoughts here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, we want to do a launchedEffect for the validation logic, with the key being the rowSelectionBehaviorType so that it doesn't run everytime we have a recomposition

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest status on this:
For clarification, it is not the validation logic that needs to run after EmbeddedPaymentElementView is initialized (the validation is done in the javascript layer) but rather setting the rowSelectionBehavior on the builder. Tian and I worked on this some but haven't reached an acceptable solution. Input from Android engineers on the best way to solve this would be appreciated.

Copy link
Collaborator

@porter-stripe porter-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing blocking (from the iOS/JS side)

Comment on lines +272 to +276
const isImmediateAction =
configuration.rowSelectionBehavior?.type === 'immediateAction';
const isFormSheetConfirm = configuration.formSheetAction?.type === 'confirm';
const isApplePayEnabled = !!configuration.applePay;
const hasCustomerConfig = !!configuration.customerId;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not rely on the native code to error out here? I guess Android and iOS error at different times, but seems possible?

* - In the `default` case, the payment method option row enters a selected state.
* - In the `immediateAction` case, `onSelectPaymentOption` is called.
*/
export type EmbeddedRowSelectionBehavior =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking, RowSelectionBehavior was already implemented on the iOS bridge right?

@tjclawson-stripe tjclawson-stripe self-requested a review June 27, 2025 22:12
@@ -152,6 +172,7 @@ class EmbeddedPaymentElementView(
is Event.Confirm -> {
embedded.confirm()
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Unneeded blank line

@tjclawson-stripe tjclawson-stripe self-requested a review June 27, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants