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

Splitbee/react-native expo routing tracking issue #43

Open
AlejandroGutierrezB opened this issue Nov 16, 2021 · 2 comments
Open

Splitbee/react-native expo routing tracking issue #43

AlejandroGutierrezB opened this issue Nov 16, 2021 · 2 comments

Comments

@AlejandroGutierrezB
Copy link

AlejandroGutierrezB commented Nov 16, 2021

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>();
@tobiaslins
Copy link
Member

tobiaslins commented Nov 17, 2021

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

@AlejandroGutierrezB
Copy link
Author

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.

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

2 participants