mixpanel-react-native icon indicating copy to clipboard operation
mixpanel-react-native copied to clipboard

How to use this library with Expo?

Open wtfzambo opened this issue 2 years ago • 2 comments

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

image

wtfzambo avatar Jun 28 '22 13:06 wtfzambo

Also need this too. Native plugins can now be added through config plugins in expo prebuilt project

alexander01202 avatar Jul 14 '22 19:07 alexander01202

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?

wtfzambo avatar Jul 21 '22 10:07 wtfzambo

did you figure this out?

fr3fou avatar Dec 30 '22 14:12 fr3fou

Let's refer to the issue: https://github.com/mixpanel/mixpanel-react-native/issues/82

zihejia avatar Jun 13 '23 22:06 zihejia