Closed lindboe closed 1 month ago
@morganick this happens since 5.0.4 version, you can use 5.0.3
Same here for RN 0.73.7, invalid host in debug mode and crash in release mode (test flight).
@migueldaipre Are you conditionally requiring Reactotron so that it only exists in dev everywhere you use it in your app? Reactotron shouldn't exist in your release mode app at all. e.g., https://github.com/infinitered/reactotron/blob/e41f12887ff8da7f5ede6fcf5884989a52e8b7e5/docs/quick-start/react-native.md?plain=1#L95-L97.
@migueldaipre Are you conditionally requiring Reactotron so that it only exists in dev everywhere you use it in your app? Reactotron shouldn't exist in your release mode app at all. e.g.,
.
Hmm, I think I've found the problem, I call Reactotron.configure conditionally ...
But the reactotron import is still in the file.
That's probably it. Thanks @lindboe
Same on 0.74.0. App has a hard crash on launch only in release versions. reactotron-react-native: 5.1.6
use "reactotron-react-native": "5.0.3", and you won't have the crash in TestFlight or Release @reeq-dev , also make sure to have the correct setup as README.md
Here is the workaround without downgrading Reactotron.
As pointed above, make sure you don't have reactotron's code imported in release builds.
Can be achieved by conditional require
in DEV
mode:
// reactotron-setup.ts
export const setupReactotron = () => {
if (__DEV__) {
const AsyncStorage = require('@react-native-async-storage/async-storage').default;
const Reactotron: ReactotronReactNative = require('reactotron-react-native').default;
const { reactotronRedux } = require('reactotron-redux');
return Reactotron.configure({ name: 'React Native Demo' })
.setAsyncStorageHandler(AsyncStorage)
.use(reactotronRedux())
.useReactNative({ log: true })
.connect();
}
return undefined;
};
Then call the setup function wherever you need.
Please keep discussion to the issue described in this ticket: Reactron crashing in dev with invalid host
. If you have a different issue, please open a new ticket.
Describe the bug
On the first run of an RN app on a real iOS device (dev build), Reactotron will throw
invalid host
, which can lead to crashing the app (here because we were trying to add the reactotron redux enhancer to the store, but that failed, so the store failed to be created, crashing the app).I think the underlying cause of this particular crash is because we need to click "Allow" to find devices on the local network. After pressing "Allow" and reloading, the app works fine.
In addition, Reactotron should be more resilient to errors like this and avoid crashing apps. It should:
validate
tests don't crash the app if they fail. Utilities that depend on Reactotron plugins would ideally return a no-op version (e.g., the redux enhancer) so that the app can continue to work.validate
should make it more clear that they're from Reactotron in the messageNotes:
reactotron-react-native: 5.1.6
Reactotron version
3.7.0