betaacid / expo-analytics

Google Analytics integration for use with React Native apps built on Expo
MIT License
286 stars 64 forks source link

Error: The WKWebView was invalidated #44

Open robertcreaner opened 5 years ago

robertcreaner commented 5 years ago

Getting the following error any time I create an event: Error: The WKWebView was invalidated

Env: "dependencies": { "expo": "^33.0.0", "expo-web-browser": "^5.0.3", "react": "16.8.3", "react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz", },

robertcreaner commented 4 years ago

For anyone else who might be experiencing this, I fixed it by creating a single instance of Analytics and passing it to the rest of my components using Context:

In my App.js: `const analytics = new Analytics(AppConfig.googleAnalyticsKey); <SocketContext.Provider value={{ analytics : analytics}}>

</SocketContext.Provider>`

In my other components: `const RootContainer = props => (

{context => ( )} ); export default RootContainer;`