mixpanel-react-native
mixpanel-react-native copied to clipboard
How to use this library with Expo?
Hello,
I hope someone can give me a hint on how to make mixpanel-react-native
work on an expo app in windows11.
This is what I am currently doing:
expo init MyProject
# then I select `minimal`
cd MyProject
yarn add mixpanel-react-native
expo start
Everything is fine, but the moment I add to App.js
import { Mixpanel } from 'mixpanel-react-native';
const mixpanel = new Mixpanel('MY_TOKEN');
mixpanel.init();
I run into the dreaded error: MixpanelReactNative is null
both on web and Expo Go on android.
Now I understand that Expo Go doesn't support mixpanel, but shouldn't I at least be able to run it on web?
Any help is much appreciated.
My App.js
Click to expand
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Mixpanel } from 'mixpanel-react-native';
export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
My system
Click to expand
Also need this too. Native plugins can now be added through config plugins in expo prebuilt project
Also need this too. Native plugins can now be added through config plugins in expo prebuilt project
Ah, good to know! Can you point me to the docs mentioning this?
did you figure this out?
Let's refer to the issue: https://github.com/mixpanel/mixpanel-react-native/issues/82