avishayil / react-native-restart

React Native Package With One Purpose: To Restart Your React Native Project
MIT License
926 stars 145 forks source link

TypeError: Cannot read property 'restart' of null #249

Open kbqdev opened 1 year ago

kbqdev commented 1 year ago

React native : 0.72.4 react-native-restart: 0.0.27

WARN Possible Unhandled Promise Rejection (id: 0): TypeError: Cannot read property 'restart' of null TypeError: Cannot read property 'restart' of null

spideyinf commented 11 months ago

I do have the same issue, Has anyone with any solution helped?

bviebahn commented 11 months ago

I also had this issue earlier, but after restarting the bundler and rebuilding the app it went away.

master12 commented 10 months ago

Have the same issue. Rebuilding the bundle did not help.

bilalaurangzebkhan commented 8 months ago

Make sure rebuilding your app after installing react-native-restart It will not work in Expo Go

You can create a development build which is like a custom version of Expo Go. It won't work in Expo Go, because it includes native code, and that native code is not built into Expo Go. (And can't be added later.) So you need to build your app. e.g.:

eas build -p android --profile development

Then install that on your device/emulator and use it instead of Expo Go.

ansmlc commented 4 months ago

Make sure rebuilding your app after installing react-native-restart It will not work in Expo Go

You can create a development build which is like a custom version of Expo Go. It won't work in Expo Go, because it includes native code, and that native code is not built into Expo Go. (And can't be added later.) So you need to build your app. e.g.:

eas build -p android --profile development

Then install that on your device/emulator and use it instead of Expo Go.

Thanks @bilalaurangzebkhan. This explanation should be in README.. Does this mean if we install it via npm / yarn add react-native-restart, create a dev-build, that's it? No need for any of that linking stuff?

bilalaurangzebkhan commented 4 months ago

Make sure rebuilding your app after installing react-native-restart It will not work in Expo Go You can create a development build which is like a custom version of Expo Go. It won't work in Expo Go, because it includes native code, and that native code is not built into Expo Go. (And can't be added later.) So you need to build your app. e.g.: eas build -p android --profile development Then install that on your device/emulator and use it instead of Expo Go.

Thanks @bilalaurangzebkhan. This explanation should be in README.. Does this mean if we install it via npm / yarn add react-native-restart, create a dev-build, that's it? No need for any of that linking stuff?

Yes @ansmlc the newer version does auto-linking. and the react-native-restart will not work on expo Go but will work fine for development and production build.