analytics-react-native: The package 'sovran-react-native' doesn't seem to be linked. Expo managed workflow
I’m running Expo managed workflow and running the app in Expo go which I know is not compatible with the package but I think I should still be able to run the app even though the analytics package is not going to work. Expected behaviour would be a warning and the package not working (like happens in the Sentry package f.ex.).
"expo": "^46.0.10",
analytics-react-native
version:
“@segment/analytics-react-native”: “^2.7.1”, “@segment/sovran-react-native”: “^0.4.4”, “@react-native-async-storage/async-storage”: “^1.17.10”,- Integrations versions (if used):
- React Native version: “react-native”: “0.69.5”
- iOS or Android or both? iOS
Steps to reproduce
- Create expo project (
npx create-expo-app my-app
) - Run
yarn add @segment/analytics-react-native @segment/sovran-react-native @react-native-async-storage/async-storage
- Add the following to your App.tsx so that the package gets used:
import { AnalyticsProvider, createClient } from '@segment/analytics-react-native';
const segmentClient = createClient({});
Snack https://snack.expo.dev/@danielgangverk/segment-snack?platform=ios
Expected behavior I would expect a warning that the package doesn’t work with Expo go instead of a crash
Actual behavior The app crashes in Expo go if @segment/analytics-react-native is imported anywhere
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 5
- Comments: 19 (5 by maintainers)
@konoufo any idea when there will be a new release of
sovran-react-native
?I see now that the ReadMe says
But I agree with @danielgangverk - it would be better if it was just completely disabled somehow when running in Expo Go and a warning displayed perhaps, instead of it blowing up.
Expo deprecated
expo-analytics-segment
in favor of this library from Expo 46 onwards, and it would be good to be able to continue using Expo Go after switching over to@segment/analytics-react-native
.@danielgangverk We have merged changes in both this library and sovran-react-native that should fix the issue. You can now use Expo Go without crashing. All you’ll get is a friendly warning. These changes should also be released soon. In the meantime, pulling from master should do the trick.
I have the same issue with ExpoGo and @segment/sovran-react-native, it crashes when running inside ExpoGo, I think a warning would be nice, it really doesn’t leave ExpoGo users with a lot of choices regarding Segment integration. I think it actually crashes right at the import and not even its usage.
I setup two different analytics utilities using react-segments for the web and @segment/analytics-react-native for native
yes, I see it as a warning, but it still tracks. Thanks for the fix 😃
Hey @webjay . Do you see this as a warning ? If so, then yeah sounds like it’s working exactly as intended! Thanks for your feedback!
@konoufo wondering if while this is being fixed is it possible to use segmentio/analytics-next? what exactly does the react native library do that next doesn’t?
Yeah that’s right; it’s going to be fully fixed in the next
sovran-react-native
release.@danielgangverk @Jorundur A workaround for this (on iOS at least, have not tested Android yet) can be implemented by only requiring the module when we have the NativeModule, so it will work for any EAS build, with or without dev-client. For ExpoGo you could then just DEV log your Segment calls or skip them, that should keep ExpoGo usable at least.