statsig-io / react-native

Statsig SDK for usage in React Native (non Expo) applications
ISC License
4 stars 1 forks source link

can't use StatsigProvider with react-native-navigation #2

Open OrenMag opened 11 months ago

OrenMag commented 11 months ago

Since react-native-navigation uses multiple roots with setRoot and not single app root, like this:

Navigation.setRoot({
  root: {
    stack: {
      children: [
        {
          component: {
            name: 'LOGIN_SCREEN'
          }
        }
      ]
    }
  }
});

We can't wrap the component tree with <StatsigProvider>, as recommended in the docs for initialization. Thus we can't waitForInitialization, and we get the wrong experiments default values when the app loads, until they return correctly synchronically.

https://wix.github.io/react-native-navigation/docs/root/

Is there any way to use statsig-react-native with react-native-navigation in a way that would allow experiments to always return the right way?

we're using "statsig-react-native": "^4.9.2", "react-native": "0.71.3", "react-native-navigation": "7.32.1",

vijaye-statsig commented 11 months ago

Could you please post this in https://statsig.com/slack? Questions like these are usually answered quicker there.