reactjsreact-nativeexporeact-native-native-module

React-native Native Modules Official Guide not working


I've tried following this guide 10 times today: https://reactnative.dev/docs/native-modules-android

I just tried on a clean project following the guidelines exactly. No matter what I do I always get

null is not an object (evaluating '_ToastExample.default.show')

steps to reproduce:

expo init javatest --npm
npx @react-native-community/bob create react-native-awesome-module

And then follow the guide.

npm --version 6.14.8
react-native --version
react-native-cli: 2.0.1
react-native: 0.63.3
expo --version 3.27.13

Here is a git repo of it, but as I said... I followed the guide exactly like 5 times... so maybe it's Expo?

https://github.com/unknownFrequency/react-native-native-module

I created ToastExample.js in the root folder in the same location as App.js (guide says it must be placed in the same hierarcy as it is imported)


Solution

  • Apparently Expo does not support custom native modules.

    https://docs.expo.io/introduction/why-not-expo/