stripe / stripe-react-native

React Native library for Stripe.
https://stripe.dev/stripe-react-native
MIT License
1.29k stars 262 forks source link

app crashes on cardform #1665

Open Salman-Usmani opened 6 months ago

Salman-Usmani commented 6 months ago

i am using cardform in a modal, its working fine on ios, but as soon the modal opens, it crashes on android without any error showing...

To Reproduce this is my code

`<Modal animationType="slide" transparent={true} visible={paymentModal.isShown} onRequestClose={() => { Alert.alert('Modal has been closed.'); setIsVisible({ isShown: false, amount: 0, }); }}> <StripeProvider publishableKey={publishableKey} urlScheme="stripe-example" merchantIdentifier="merchant..."

<View style={[styles.centeredView, {backgroundColor: COLOR.blackOpac}]}>

{ setComplete(cardDetails.complete); }} defaultValues={{ countryCode: 'US', }} />
            <Button
              variant="primary"
              onPress={handlePayPress}
              title="Pay"
              width={'100%'}
              height={40}
              accessibilityLabel="Pay"
              disabled={
                isComplete && (Boolean(fromPlan) ? termsAccepted : true)
              }
            />
          </KeyboardAvoidingView>
        </ScrollView>
        <Pressable
          style={[styles.button, styles.buttonClose]}
          onPress={() =>
            setIsVisible({
              isShown: false,
              amount: 0,
            })
          }>
          <RNText style={styles.textStyle}>Cancel</RNText>
        </Pressable>
      </View>
    </View>
  </StripeProvider>
</Modal>`

on versions 0.32.0 to 0.35.0, i had to update

on ./node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/CardFormView.kt

to even run the app on android but as you can see the changes were in node_modules so it was not preferable, but now on the versions 0.36.0 to 0.38.0 app runs fine but crashes as soon the payment modal screen is shown...

seanzhang-stripe commented 5 months ago

Hi @Salman-Usmani You don't need to change the content in node_module folder, you should just delete the folder, as well as package-lock.json and yarn.lock, and run yarn install again to let yarn download the latest dependencies.

Can you post the crash log here? You can refer to this page for accessing native logs.

Salman-Usmani commented 5 months ago

hey, thanks for approaching me, but I am sorry I am not getting any logs either, the app just crashes with no indication of anything... right now i am using the 0.35.0 version, adding those lines I mentioned in the issue. It's working fine, but when I upgrade to any newer version I get the issue.

Salman-Usmani commented 5 months ago

@seanzhang-stripe sir i have done that many times, but i deleting these things donot fix the issue.

magouyaware commented 5 months ago

This bug is likely related to an issue I just filed with Stripe's Android SDK... They changed the Card Brand icon to a Jetpack Compose Compsable view in Android v20.36.0.

See this issue for more details

tjclawson-stripe commented 3 months ago

@Salman-Usmani this has been resolved in Android v20.48.4

VerneriLop commented 1 month ago

@Salman-Usmani Have you found any fix for this? My app is also crashing while I'm trying to use CardForm component. It works with iOs but not with android.