You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every time a user opens the app, we send a request in the background to fetch the feature flags that apply to that user. We store those flags in the storage.
66
+
67
+
This means that for most screens, the feature flags are available immediately — **except for the first time a user visits**.
68
+
69
+
To handle this, you can use the `onFeatureFlags` callback to wait for the feature flag request to finish:
70
+
71
+
```react-native
72
+
posthog.onFeatureFlags((flags) => {
73
+
// feature flags are guaranteed to be available at this point
74
+
if (posthog.isFeatureEnabled('flag-key')) {
75
+
// do something
76
+
}
77
+
})
78
+
```
79
+
63
80
### Reloading flags
64
81
65
82
PostHog loads feature flags when instantiated and refreshes whenever methods are called that affect the flag.
0 commit comments