Native Module cannot be null when using react-native-purchases - reactjs

Trying to run an expo react native project w/ revenue cat integration. Whenever I had the react-native-pruchases library downloaded though, I continue to get this error.
Invariant Violation: Native module cannot be null
I downloaded the library by running npm install react-native-purchases --save, I didn't do any of the additional iOS setup the docs outlined. I've been going crazy over this so some help is appreciated.
package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest"
},
"dependencies": {
"#react-native-community/datetimepicker": "4.0.0",
"#react-native-community/slider": "4.1.12",
"#react-navigation/bottom-tabs": "^6.2.0",
"#react-navigation/native-stack": "^6.4.0",
"dotenv": "^16.0.0",
"expo": "~44.0.0",
"expo-av": "~10.2.0",
"expo-linear-gradient": "~11.0.3",
"expo-status-bar": "~1.2.0",
"firebase": "^9.6.5",
"jest": "26.6.3",
"jest-expo": "^44.0.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-circular-progress": "^1.3.7",
"react-native-countdown-circle-timer": "^3.0.9",
"react-native-modal": "^13.0.1",
"react-native-purchases": "^4.6.0",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-web": "0.17.1",
"uuid": "^3.4.0",
"victory-native": "^36.3.0"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#types/jest": "^27.4.0",
"#types/react": "~17.0.21",
"#types/react-native": "~0.64.12",
"react-test-renderer": "^17.0.2",
"typescript": "~4.3.5"
},
"jest": {
"preset": "jest-expo",
"transformIgnorePatterns": [
"node_modules/(?!((jest-)?react-native|#react-native(-community)?)|expo(nent)?|#expo(nent)?/.*|#expo-google-fonts/.*|react-navigation|#react-navigation/.*|#unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)"
]
},
"private": true
}

This error message occurs when trying to use a native module when debugging on the expo go app. The module should work in the standalone app.
You can find other ways to debug with the native modules here https://docs.expo.dev/build/internal-distribution/

Related

Problem with expo, util couldnt be found within the project

Error output
got error and couldnt get it fixed idk whats problem last thing i remember was installing latest version of npm, after that rolled back and installed everything with old package.json but cant get this fixed. this is my package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"#brainsbeards/react-native-animated-code-input": "^1.0.1",
"#expo-google-fonts/inter": "^0.2.0",
"#react-native-async-storage/async-storage": "~1.15.0",
"#react-native-community/slider": "^3.0.3",
"#react-navigation/bottom-tabs": "^6.0.1",
"#react-navigation/native": "^6.0.1",
"#react-navigation/stack": "^6.0.1",
"axios": "^0.21.1",
"expo": "~42.0.1",
"expo-app-loading": "^1.1.2",
"expo-av": "^9.2.3",
"expo-blur": "^9.0.3",
"expo-clipboard": "^1.1.0",
"expo-font": "~9.2.1",
"expo-status-bar": "~1.0.4",
"jwt-decode": "^3.1.2",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
"react-native-easy-grid": "^0.2.2",
"react-native-gesture-handler": "^1.10.3",
"react-native-render-html": "^6.0.5",
"react-native-toast-message": "^1.4.9",
"react-native-web": "^0.17.1",
"react-native-webview": "^11.6.6",
"react-query": "^3.19.2",
"zustand": "^3.5.7"
},
"devDependencies": {
"#babel/core": "^7.9.0"
},
"private": true
}
I had similar issue. Was able to remedy my situation but installing the util package.
https://www.npmjs.com/package/util

Error when expo start in react native application (Stylesheet)

I'm making a react native application and there is an error that is making me sick.
Could anyone help me?
The error is shown below.
Dependencies:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"#material-ui/core": "^4.11.0",
"#material-ui/icons": "^4.9.1",
"#react-native-community/async-storage": "^1.12.1",
"#react-native-community/masked-view": "^0.1.10",
"expo": "~39.0.2",
"expo-status-bar": "~1.0.2",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz",
"react-native-animatable": "^1.3.3",
"react-native-elements": "^2.3.2",
"react-native-gesture-handler": "^1.8.0",
"react-native-safe-area-context": "^3.1.8",
"react-native-safe-area-view": "^1.1.1",
"react-native-snackbar": "^2.2.3",
"react-native-vector-icons": "^7.1.0",
"react-native-web": "~0.13.12",
"react-navigation": "^4.4.2",
"react-navigation-stack": "^2.8.4"
},
"devDependencies": {
"#babel/core": "~7.9.0"
},
"private": true
}
Thanks!
It seems to be an error in case, it should be StyleSheet and not Stylesheet

Why Changes are not reflecting in React native?

I am changing something in .js file for ex. any text for textfiled placeholder. But after running command react-native run-android nothing is changing in android emulator. only when i run npm run bundle-android and then run react-native run-android changes are reflecting.
My package.json is like
{
"name": "xyz",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"bundle-android": "react-native bundle --entry-file index.js --platform android --dev false --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res/",
"bundle-ios": "react-native bundle --entry-file index.js --bundle-output ./ios/bundle/index.ios.jsbundle --platform ios --assets-dest ./ios/bundle --dev false",
"test": "jest",
"ios": "react-native run-ios --simulator 'iPhone X'",
"android": "react-native run-android -- --reset-cache",
"android-ete": "ENVFILE=.env.ete react-native run-android -- --reset-cache",
"ios-ete": "ENVFILE=.env.ete react-native run-ios",
"ios-prod": "ENVFILE=.env.prod react-native run-ios",
"exportcert-ete": "java -jar BKSPubKeyTool.jar --importkeystore keystore_ete.bks --alias oauth.testing --password keystorepwd --exportcert src/keystore/id_rsa_ete.pem --exportjs src/keystore/pubKey_ete.js",
"exportcert-prod": "java -jar BKSPubKeyTool.jar --importkeystore keystore.bks --alias oauth --password keystorepwd --exportcert src/keystore/id_rsa_prod.pem --exportjs src/keystore/pubKey_prod.js",
"lint": "eslint ."
},
"dependencies": {
"axios": "^0.19.0",
"buffer": "^5.2.1",
"crypto-js": "^3.1.9-1",
"jetifier": "^1.6.3",
"jsencrypt": "^3.0.0-rc.1",
"mobx": "^5.11.0",
"mobx-react": "^5.4.4",
"moment": "^2.24.0",
"native-base": "^2.12.1",
"prop-types": "^15.7.2",
"querystring": "^0.2.0",
"react": "16.8.6",
"react-native": "0.60.3",
"react-native-config": "^0.11.7",
"react-native-date-picker": "^2.7.3",
"react-native-device-info": "2.3.2",
"react-native-exception-handler": "^2.10.8",
"react-native-gesture-handler": "^1.4.0",
"react-native-keyboard-spacer": "^0.4.1",
"react-native-linear-gradient": "^2.5.4",
"react-native-modal": "^11.1.0",
"react-native-modal-dropdown": "^0.6.2",
"react-native-picker-select": "^6.3.0",
"react-native-popup-dialog": "^0.18.2",
"react-native-reanimated": "^1.4.0",
"react-native-root-toast": "^3.1.2",
"react-native-screens": "^2.0.0-beta.10",
"react-native-scrollable-tab-view": "^0.10.0",
"react-native-splash-screen": "^3.2.0",
"react-native-sqlite-storage": "^3.3.11",
"react-native-tab-view": "^2.8.0",
"react-native-user-agent": "^1.0.4",
"react-native-user-inactivity": "^1.0.1",
"react-native-uuid": "^1.4.9",
"react-native-wheel-picker-android": "^2.0.5",
"react-navigation": "^3.11.1"
},
"devDependencies": {
"#babel/core": "^7.5.5",
"#babel/plugin-proposal-decorators": "^7.4.4",
"#babel/runtime": "^7.5.5",
"#react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.8.0",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-preset-react-native": "^4.0.1",
"eslint": "^6.1.0",
"jest": "^24.8.0",
"metro-react-native-babel-preset": "^0.55.0",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}
As i am new to react native please let me know if more information needed in question?
Thank you for help
Sometimes it can load an old version of the code and not updating.
For me sometimes just \android\gradlew clean and react-native run-android (from the main folder) works.
I don't know if it solves your problem but it worth a try. A lot of errors in react-native can be solved by gradlew clean and/or restarting your computer.
You need to compile the code first..
npm run dev
Or
npm test

redux-form-material-ui for react-native

So I've implemented redux-form in my react native application and it works fine. Now, Client has asked if we could change normal field to material-ui like this, I tried implementing redux-form-material-ui in my react native application but it doesn't work. Here is the error which i got while running my application.
error: Error: Unable to resolve module `material-ui/Toggle` from `node_modules/redux-form-material-ui/lib/Toggle.js`: material-ui/Toggle could not be found within the project.
This is my package.Json
{
"name": "Demo",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#material-ui/core": "^4.9.10",
"react": "16.11.0",
"react-native": "0.62.1",
"react-native-flash-message": "^0.1.15",
"react-native-gesture-handler": "^1.6.1",
"react-native-linear-gradient": "^2.5.6",
"react-native-reanimated": "^1.7.1",
"react-native-router-flux": "^4.2.0",
"react-native-screens": "^2.4.0",
"react-native-touch-id": "^4.4.1",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-form": "^8.3.2",
"redux-form-material-ui": "^4.3.4",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"#babel/core": "7.9.0",
"#babel/runtime": "7.9.2",
"#react-native-community/eslint-config": "0.0.5",
"babel-jest": "24.9.0",
"eslint": "6.8.0",
"jest": "24.9.0",
"metro-react-native-babel-preset": "0.58.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}
So, My question is can we implement redux-form-material-ui for React-Native or it is limited to reactjs. if yes then can anyone tell what is the problem here?
redux-form-material-ui has not been updated in a very long time and Toggle is not supported.

error while trying to add sign in with google button "RN GoogleSignin native module is not correctly linked..." - react native

I am trying to add a sign-in button of Google, and can't understand why it doesn't work fine. after download the package react-native-google-signin, and I have also installed #react-native-community/google-sign in and these both packaged doesn't work for me. the error message: "RN GoogleSignin native module is not correctly linked..."
code below:
import { GoogleSigninButton } from 'react-native-google-signin';
<GoogleSigninButton
style={{ width: 192, height: 48 }}
size={GoogleSigninButton.Size.Wide}
color={GoogleSigninButton.Color.Dark}
onPress={signInWithGoogle}
/>
my package JSON below:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"#expo/vector-icons": "^10.0.6",
"#react-native-community/google-signin": "^3.0.4",
"#react-native-community/masked-view": "^0.1.5",
"expo": "~36.0.0",
"expo-facebook": "~8.0.0",
"expo-google-app-auth": "^8.0.1",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"react-native-fbsdk": "^1.1.2",
"react-native-gesture-handler": "~1.5.0",
"react-native-google-signin": "^2.1.1",
"react-native-link": "^4.1.0",
"react-native-paper": "^3.6.0",
"react-native-reanimated": "~1.4.0",
"react-native-safe-area-context": "0.6.0",
"react-native-screens": "2.0.0-alpha.12",
"react-native-status-bar-height": "^2.4.0",
"react-native-web": "~0.11.7",
"react-native-webview": "^8.1.2",
"react-navigation": "^4.2.2",
"react-navigation-stack": "^2.2.2",
"react-navigation-tabs": "^2.8.2"
},
"devDependencies": {
"babel-preset-expo": "~8.0.0",
"#babel/core": "^7.0.0"
},
"private": true
}

Resources