splitbee-js
splitbee-js copied to clipboard
Splitbee/react-native expo routing tracking issue
Hey guys I have an issue with routing tracking. I don't get any data in this regard, dashboard still says "Waiting for data" Envent tracking using splitbee.track() works like a champ though.
I am using "expo": "~42.0.1"
and this is how my app.tsx
looks:
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { NavigationContainer } from '@react-navigation/native';
import { navigationRef } from '../services/Navigation';
import splitbee, { useTrackReactNavigation } from '@splitbee/react-native';
splitbee.init('key');
const Stack = createNativeStackNavigator();
export default function App() {
const [{ onReady, onStateChange }] = useTrackReactNavigation(navigationRef);
return (
<>
<StatusBar style="auto" />
<NavigationContainer
ref={navigationRef}
onReady={() => {
onReady();
}}
onStateChange={() => {
onStateChange();
}}>
<Stack.Navigator screenOptions={screenOptions} initialRouteName={INITIAL_ROUTE}>
{... Stack}
</Stack.Navigator>
</NavigationContainer>
</>
);
}
import { StackActions, createNavigationContainerRef } from '@react-navigation/native';
export const navigationRef = createNavigationContainerRef<RootStackProps>();
Hey @AlejandroGutierrezB
It seems like you forgot to add onReady
and onStateChange
properties to NavigationContainer
<NavigationContainer
ref={navigationRef}
onReady={() => {
onReady();
}}
onStateChange={() => {
onStateChange();
}}>
Please follow our docs: https://splitbee.io/docs/react-native-expo-analytics
Hey @tobiaslins thanks for the quick response, I added it now and build from 0 but still got the issue. Will update my initial message with the right code.