Skip to content
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

AddressSheet doesn't trigger callbacks after upgrading to react-native 0.76.2 #1779

Open
Dreamer93 opened this issue Nov 21, 2024 · 3 comments

Comments

@Dreamer93
Copy link

Describe the bug
AddressSheet component doesn't trigger onError or onSubmit callbacks anymore. It was working fine on react-native version 0.74. I am using Expo (v 52) and I tried using 3 different versions of this module (38.6, 39.0 and 40.0) and neither works.
To Reproduce
Steps to reproduce the behavior:

  1. Create new Expo project through their CLI npx create-expo-app@latest
  2. Reset project npm run reset-project
  3. Replace index.tsx with
import { Button, Text, View } from "react-native"
import { AddressSheet, StripeProvider } from "@stripe/stripe-react-native"
import { useMemo, useState } from "react"

export default function Index() {
    const [visible, setVisible] = useState(false)
    const addressDefaultValues = useMemo(() => {
        return {
            name: "John Doe",
            address: {
                city: "San Francisco",
                country: "US",
                line1: "123 Market St",
                line2: "Suite 500",
                postalCode: "94103",
                state: "CA"
            }
        }
    }, [])
    return (
        <StripeProvider
            publishableKey={"some_stripe_pk_key"}
        >
            <View
                style={{
                    flex: 1,
                    justifyContent: "center",
                    alignItems: "center"
                }}
            >
                <Text>Edit app/index.tsx to edit this screen.</Text>
                <Button title={"Open Address Sheet"} onPress={() => {
                    setVisible(true)
                    console.log("im here")
                }
                }></Button>
                <AddressSheet visible={visible}
                              defaultValues={addressDefaultValues}
                              onSubmit={(data) => {
                                  console.log(data)
                                  setVisible(false)
                              }}
                              onError={(err) => {console.log(err)}}></AddressSheet>
            </View>
        </StripeProvider>
    )
}

  1. Start the app
  2. Click on the Open Address Sheet button
  3. Click Save address button
  4. Observe no log and inability to open the sheet again due to visible not being reset

Expected behavior
Expectation is for onSubmit and onError to trigger

Additional context

My presumption is that there is a change to how native components should be merged into react-native:
0.74 native components
0.76 native components

@mjvestal
Copy link

mjvestal commented Dec 4, 2024

New architecture is on by default in 0.76. Did you leave it on? Did you have it off before?

I suspect it is an issue with stripe-react-native not supporting new architecture - #1774

@Dreamer93
Copy link
Author

This is my suspicion as well. I didn't have it enabled before and I naively tried to disable it via a config on 0.76, but I wasn't able to validate if I managed to do it. I decided to drop the problem after this suspicion

@daxas-boop
Copy link

Similar error here. I upgraded to Expo 52 and now the CardForm component does not trigger the onFormComplete event handler, tried to set newArchEnabled to false but it didn't help 😞

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

No branches or pull requests

3 participants