betaacid / expo-analytics

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

Unhandled promise rejection: TypeError: _expoConstants.default.getWebiewUserAgentAsync #54

Closed greenwombat closed 4 years ago

greenwombat commented 4 years ago

Hi there,

I'd love to get using expo-analytics but am having trouble getting started.

I use the following:

"expo": "^33.0.0",
"expo-analytics": "^1.0.12",
"react": "16.8.3",
"react-dom": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
"react-native-web": "^0.11.7"

import { Analytics, PageHit } from "expo-analytics"; // "expo": "^33.0.0" . const analytics = new Analytics("UA-MYKEY-2");

But even without trying to send an event I get the following error:

[Unhandled promise rejection: TypeError: _expoConstants.default.getWebiewUserAgentAsync is not a function. (In '_expoConstants.default.getWebiewUserAgentAsync()', '_expoConstants.default.getWebiewUserAgentAsync' is undefined)]

  • node_modules/expo-analytics/analytics.js:18:8 in

Any suggestions would be really appreciated,

Thank you, George

bashash commented 4 years ago

getWebiewUserAgentAsync should be: getWebViewUserAgentAsync there is a missing V

greenwombat commented 4 years ago

You're right! It looks like a bug in analytics.js:

image

Manually changing this in node_modules fixes the problem.

greenwombat commented 4 years ago

I've created a pull request with the fix - it'd be great to get it merged:

https://github.com/ryanvanderpol/expo-analytics/pull/55

Thanks, George

ryanvanderpol commented 4 years ago

🤦🏼‍♂️ Looks like this came over yesterday in #45. Thanks, @greenwombat for the PR! I'll get that merged and released asap.