Home > Enterprise >  react-native-torch is not working properly
react-native-torch is not working properly

Time:04-19

I am trying to use expo error

I have tried many forms of their demo codes, but the problem was always with Torch.switchState. Does anyone knows how to fix this issue?
Thank you very much for any help.
Jan

CodePudding user response:

It looks like you're using a managed workflow, it won't work through Expo Go. You need to use a development client for native code to work. Create it with EAS.

  1. Install the expo-dev-client library expo install expo-dev-client
  2. Create an eas.json eas build:configure
  3. Build client and install on device/emulator eas build -p android --profile development
  4. Use expo start --dev-client instead of 'expo start'

Docs: https://docs.expo.dev/development/getting-started/

CodePudding user response:

Did you try building the app again as this module requires linking? If not, you need to run the React Native app again.

For android run: npx react-native run-android

For ios run: npx react-native run-ios

  • Related