Aws-amplify not working with react-native and expo version 36.0.0 - react-native

I'm currently working on a react-native-app using expoSdk which is supposed to run on web,ios and android. The most challenging part till now has been to setup the navigation which I finally did. Now I added amplify to my project but the project stops working whenever I run it on any mobile device but it works just fine on web. The error I receive is
NetInfo has been removed from React Native
After a lot of trial and error I discovered that the error comes from aws-amplify since it seems to still run with reac-native-community/netinfo. The error only occours when I import something from amplify. I found this in
node_modules\#aws-amplify\core\lib\Util\Reachability.native.js
Deo anyone know how I can resolve this issue?
Here is my package.json if needed
"dependencies": {
"#expo/vector-icons": "~10.0.0",
"aws-amplify": "^2.2.6",
"#react-native-community/masked-view": "0.1.5",
"#react-navigation/bottom-tabs": "^5.0.0",
"#react-navigation/drawer": "^5.2.0",
"#react-navigation/native": "^5.0.0",
"#react-navigation/stack": "^5.0.0",
"#react-navigation/web": "~1.0.0-alpha.9",
"expo": "~36.0.0",
"expo-asset": "~8.0.0",
"expo-constants": "~8.0.0",
"expo-font": "~8.0.0",
"expo-web-browser": "~8.0.0",
"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-gesture-handler": "~1.5.0",
"react-native-reanimated": "^1.7.0",
"react-native-safe-area-context": "0.6.0",
"react-native-screens": "2.0.0-alpha.12",
"react-native-web": "~0.11.7",
"react-spring": "^8.0.27",
"styled-components": "^5.0.1",
"#aws-amplify/api": "^2.1.6",
"#aws-amplify/pubsub": "^2.1.7",
"#expo/samples": "^3.0.3",
"apollo-boost": "^0.4.3",
"apollo-cache-inmemory": "^1.6.2",
"apollo-client": "^2.6.3",
"apollo-link-http": "^1.5.15",
"aws-amplify-react-native": "^3.2.2",
"aws-appsync": "^1.7.0",
"aws-appsync-react": "^1.2.5",
"expo-av": "~8.0.0",
"expo-camera": "~8.0.0",
"expo-file-system": "~8.0.0",
"expo-image-picker": "~8.0.1",
"expo-permissions": "~8.0.0",
"graphql-tag": "^2.10.1",
"moment": "^2.20.1",
"prop-types": "^15.7.2",
"react-apollo": "^2.0.4",
"react-native-datepicker": "^1.7.2",
"react-native-deck-swiper": "^1.6.7",
"react-native-keyboard-aware-scroll-view": "^0.9.1",
"react-native-material-dropdown": "^0.11.1",
"react-native-modal": "^11.3.1",
"react-native-modal-datetime-picker": "^4.13.0",
"react-native-modal-dropdown": "^0.6.2",
"react-native-paper": "^2.16.0",
"react-native-responsive-screen": "^1.4.0",
"react-native-segmented-control-tab": "^3.4.1",
"react-native-slideable-calendar-strip": "^0.4.0",
"react-native-snap-carousel": "^3.8.0",
"react-native-sound": "^0.11.0",
"react-native-svg": "9.13.3",
"react-native-swipe-gestures": "^1.0.3",
"react-native-swipeable": "^0.6.0",
"react-native-swipeout": "^2.3.3",
"react-native-touchable-swipe": "^1.0.0",
"react-navigation": "^4.2.2",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-persist": "^4.10.2",
"redux-thunk": "^2.3.0",
"uuid": "^3.2.1"
},
Any help is much appreciated thanks.

Incase someone has this issue this is the solution by #Ashish-Nanda on github:
The issue you linked has a reply from the package maintainer with the reason for the error.
It is likely that one or more of your dependencies is importing NetInfo from React Native core. Looking at your package.json, one of these would be aws-appsync-react where you will need to upgrade to any version above 2.x.x. Remove both aws-appsync-react and aws-appsync from your package.json and install the latest versions (ensure its above 2.x.x). And then do:
npm install --save #react-native-community/netinfo#4.7.0
You need to install this specific version because newer versions cause issues as the API changed.

Related

Expo (react-native) Failed to load all assets on production env (expo start --no-dev -c)

Getting Failed to load all assets error on production environment while running with expo start --no-dev -c command. The error happens on both iOS & Android. Tried clearing npm cache, metro bundler cache. Still no luck. Could not find a valid solution from the forums or expo discord community. Any ideas/help are most welcome.
package.json as follows
"dependencies": {
"#react-native-async-storage/async-storage": "~1.17.3",
"#react-native-community/datetimepicker": "6.1.2",
"#react-native-community/netinfo": "8.2.0",
"#react-native-masked-view/masked-view": "0.2.6",
"#react-navigation/bottom-tabs": "^5.11.15",
"#react-navigation/drawer": "^5.12.9",
"#react-navigation/native": "^5.9.8",
"#react-navigation/stack": "^5.14.9",
"#reduxjs/toolkit": "^1.7.2",
"date-fns": "^2.23.0",
"expo": "^45.0.0",
"expo-camera": "~12.2.0",
"expo-dev-client": "~1.0.1",
"expo-device": "~4.2.0",
"expo-document-picker": "~10.2.1",
"expo-file-system": "~14.0.0",
"expo-font": "~10.1.0",
"expo-image-picker": "~13.1.1",
"expo-location": "~14.2.2",
"expo-notifications": "~0.15.4",
"expo-splash-screen": "~0.15.1",
"expo-status-bar": "~1.3.0",
"expo-updates": "~0.13.3",
"formik": "^2.2.9",
"just-clone": "^3.2.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "0.68.2",
"react-native-calendars": "^1.1266.0",
"react-native-gesture-handler": "~2.2.1",
"react-native-keyboard-aware-scroll-view": "^0.9.4",
"react-native-pager-view": "5.4.15",
"react-native-popup-menu": "^0.15.11",
"react-native-reanimated": "~2.8.0",
"react-native-root-toast": "^3.4.0",
"react-native-safe-area-context": "4.2.4",
"react-native-screens": "~3.11.1",
"react-native-svg": "12.3.0",
"react-native-tab-view": "^2.16.0",
"react-native-timeline-feed": "^2.0.0",
"react-native-web": "0.17.7",
"react-native-webview": "11.18.1",
"react-redux": "^7.2.6",
"uuid": "^8.3.2",
"victory-native": "^35.5.4",
"yup": "^0.32.9"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"babel-jest": "^25.2.6",
"eslint": "^7.32.0",
"eslint-plugin-react": "^7.25.1",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-react-native": "^3.11.0",
"jest": "^26.6.3",
"react-test-renderer": "17.0.1",
"reactotron-react-native": "^5.0.0",
"reactotron-redux": "^3.1.3"
}
For me, I accidentally left 1 character out of Text element.
It started to work after I remove the character.
Try examining your recent code.

Getting error of "Tried to register two views with the same name RNCViewpager

Hi, I am getting the error, but i don't know how to solve it.
I think it caused by the conflicts between react-native-tab-view and react-native-pager-view
I tried
remove node_modules and re-install.
installed different versions of react-native-pager-view
added "resolutions" in package.json.
My package.json is
"dependencies": {
"#invertase/react-native-apple-authentication": "^2.1.2",
"#react-native-community/blur": "^3.6.0",
"#react-native-community/geolocation": "^2.0.2",
"#react-native-community/masked-view": "^0.1.10",
"#react-native-community/toolbar-android": "0.1.0-rc.2",
"#react-native-firebase/analytics": "^11.3.2",
"#react-native-firebase/app": "^11.3.2",
"#react-native-google-signin/google-signin": "^6.0.0",
"#react-navigation/bottom-tabs": "^5.11.8",
"#react-navigation/native": "^5.9.3",
"#react-navigation/stack": "^5.14.3",
"dateformat": "^3.0.3",
"filter-obj": "^2.0.2",
"lodash": "^4.17.15",
"lottie-ios": "^3.1.8",
"lottie-react-native": "^3.5.0",
"moment": "^2.29.1",
"patch-package": "^6.2.2",
"payment": "^2.3.0",
"react": "17.0.1",
"react-content-loader": "^6.0.3",
"react-native": "0.64.1",
"react-native-background-upload": "^5.6.1",
"react-native-base64": "0.0.2",
"react-native-bootsplash": "^2.2.4",
"react-native-check-box": "^2.1.7",
"react-native-checkbox-form": "^1.1.5",
"react-native-checkbox-group": "^1.0.3",
"react-native-credit-card-input-fullpage": "^0.2.0",
"react-native-device-info": "^8.0.5",
"react-native-dialog": "^5.6.0",
"react-native-drawer-layout-polyfill": "^2.0.0",
"react-native-fbsdk": "^1.1.2",
"react-native-gesture-handler": "^1.10.3",
"react-native-google-places-autocomplete": "^1.8.0",
"react-native-image-picker": "^2.3.3",
"react-native-key-value-storage": "^3.1.0",
"react-native-keyboard-accessory": "^0.1.12",
"react-native-loading-spinner-overlay": "^1.1.0",
"react-native-material-buttons": "^0.6.0",
"react-native-material-textfield": "^0.16.1",
"react-native-no-flicker-image": "^1.0.2",
"react-native-pager-view": "^5.1.3",
"react-native-paper": "^4.7.2",
"react-native-phone-input": "^0.2.4",
"react-native-picker-select": "^8.0.4",
"react-native-ratings": "^7.4.0",
"react-native-reanimated": "^1.10.1",
"react-native-responsive-screen": "^1.4.1",
"react-native-safe-area-context": "^0.7.3",
"react-native-screens": "^2.10.1",
"react-native-scrollable-tab-view": "^1.0.0",
"react-native-section-list-get-item-layout": "^2.2.3",
"react-native-secure-storage": "^0.1.2",
"react-native-simple-radio-button": "^2.7.4",
"react-native-star-rating": "^1.1.0",
"react-native-super-grid": "^3.2.0",
"react-native-svg": "^12.1.1",
"react-native-swipe-gestures": "^1.0.5",
"react-native-tab-view": "^3.0.1",
"react-native-vector-icons": "^7.0.0",
"react-native-version-check": "^3.4.2",
"react-native-webview": "^10.3.3",
"react-native-windows": "^0.62.4",
"react-navigation": "^4.4.0",
"react-navigation-drawer": "^2.5.0",
"react-navigation-material-bottom-tabs": "^2.3.0",
"react-navigation-stack": "^2.8.2",
"string": "^3.3.3",
"tipsi-stripe": "^7.5.3",
"typescript": "^3.9.7" },
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.14.0",
"jest": "^26.6.3",
"jetifier": "^1.6.6",
"metro-react-native-babel-preset": "^0.64.0",
"react-native-dotenv": "0.2.0",
"react-test-renderer": "17.0.1" },
"jest": {
"preset": "react-native" }
}
I clone the repo and modified the ViewManger Name and it worked fine for me you may try it.
past following, to roo dir in package.json and run command yarn install
"react-native-pager-view": "git://github.com/AtaMuhiuldin/react-native-view-pager.git"
it's working for me!
Here there is small issue in lib i guess.
If you import like below
import PagerView from 'react-native-pager-view';
It will not work, but if you try to import like below, it will work.
import { PagerView } from 'react-native-pager-view';
npm uninstall react-native-pager-view
then
npx react-naive run-android
i notice that the problem is that when you install the library and this library exist already on some other libraries dependencies
you can import it without install it again
check package-lock.json you can find it already

Assets not showing when using expo:build for .apk after upgrading to SDK 39

I am updating app from Expo SDK 38 to Expo SDK 39. Everything goes smoothly it works perfectly in the Expo Client.
When I build a standalone app for testing before submission with the following:
expo build:android -t apk --release-channel some-build-release
I open the app to no assets showing. My custom fonts which are in the same assets directory are being used properly.
I am bundling the assets directly into the binary with the following app.json:
"assetBundlePatterns": [
"assets/**/*"
],
All of my assets are in the assets folder. When I build a standalone app on SDK 38 everything works perfectly. Assets show up with no issues. Any help is appreciated.
The following is my package.json in case that helps:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
...
},
"dependencies": {
"#react-native-community/async-storage": "~1.12.0",
"#react-native-community/datetimepicker": "^3.0.4",
"#react-native-community/masked-view": "0.1.10",
"#react-native-community/netinfo": "5.9.6",
"#react-native-community/slider": "3.0.3",
"#react-navigation/bottom-tabs": "^5.10.1",
"#react-navigation/drawer": "^5.10.1",
"#react-navigation/material-top-tabs": "^5.3.1",
"#react-navigation/native": "^5.8.1",
"#react-navigation/stack": "^5.11.0",
"#types/expo": "^32.0.13",
"#types/react-native": "~0.63.2",
"axios": "^0.19.2",
"convert-time": "^0.3.0",
"expo": "^39.0.0",
"expo-application": "~2.3.0",
"expo-av": "~8.6.0",
"expo-blur": "~8.2.0",
"expo-camera": "~9.0.0",
"expo-constants": "~9.2.0",
"expo-device": "~2.3.0",
"expo-file-system": "~9.2.0",
"expo-firebase-analytics": "~2.5.0",
"expo-font": "~8.3.0",
"expo-image-picker": "~9.1.0",
"expo-linear-gradient": "~8.3.0",
"expo-localization": "~9.0.0",
"expo-location": "~9.0.0",
"expo-media-library": "~9.2.1",
"expo-network": "~2.3.0",
"expo-notifications": "~0.7.2",
"expo-permissions": "~9.3.0",
"expo-status-bar": "~1.0.2",
"expo-video-player": "^1.5.8",
"lodash": "^4.17.19",
"moment": "^2.24.0",
"moment-timezone": "^0.5.31",
"react": "16.13.1",
"react-devtools": "^3.6.3",
"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-collapsible": "^1.5.2",
"react-native-elements": "^2.1.0",
"react-native-expo-image-cache": "^4.1.0",
"react-native-geocoding": "^0.4.0",
"react-native-gesture-handler": "~1.7.0",
"react-native-google-places-autocomplete": "^1.8.0",
"react-native-hyperlink": "0.0.19",
"react-native-keyboard-accessory": "^0.1.10",
"react-native-keyboard-aware-scroll-view": "^0.9.1",
"react-native-maps": "0.27.1",
"react-native-modal": "^11.5.6",
"react-native-modal-datetime-picker": "^8.9.0",
"react-native-paper": "^3.10.1",
"react-native-reanimated": "~1.13.0",
"react-native-safe-area-context": "3.1.4",
"react-native-screens": "~2.10.1",
"react-native-snap-carousel": "^3.9.1",
"react-native-svg": "12.1.0",
"react-native-tab-view": "^2.15.2",
"react-native-web": "~0.13.7",
"react-navigation-header-buttons": "^6.0.0",
"react-redux": "^7.1.1",
"redux": "^4.0.4",
"redux-devtools-extension": "^2.13.8",
"redux-saga": "^1.1.3",
"redux-thunk": "^2.3.0",
"sentry-expo": "^3.0.3",
"tslib": "^2.0.1",
"validator": "^12.1.0"
},
"devDependencies": {
"#typescript-eslint/eslint-plugin": "^3.9.0",
"#typescript-eslint/parser": "^3.9.0",
"babel-eslint": "^10.1.0",
"babel-preset-expo": "^8.3.0",
"eslint": "^7.7.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.0.8",
"typescript": "~3.9.2"
},
"private": true
}
Was not an issue with the build process but instead an issue with another part of my code where other assets were getting saved to the documentDirectory.
I originally was saving assets (such as a small video) to the root documentDirectory. I had another process that would clear old assets based on an array of values of "what should be there".
There was a change from Expo 38 -> 39 where binary assets now got bundled directly to the root of the documentDirectory so when my app was loading it would remove all the bundled assets.
Easy fix was to just store these other assets that I was loading on app launch to a subdirectory in the documentDirectory (in my case documentDirectory/assetCache).

The experience you requested uses Expo SDK v(null), but this copy of Expo Client requires at least v35.0.0

I decided to return to an Expo app I was developing last year and was using expo-sdk:v33.0.0 and it was working.
I tried to use a solution of Squirrl from similar question, but still no luck. Tried removing node_modules and yarn_install. Here's my package.json:
enter
"dependencies": {
"#react-native-community/masked-view": "^0.1.7",
"#react-navigation/material-bottom-tabs": "^5.1.1",
"#react-navigation/material-top-tabs": "^5.1.1",
"#react-navigation/native": "^5.0.9",
"#react-navigation/stack": "^5.2.3",
"axios": "^0.18.1",
"date-fns": "^1.29.0",
"dotenv": "^8.2.0",
"expo": "^33.0.0",
"expo-font": "~5.0.1",
"lodash": "^4.17.15",
"native-base": "^2.13.1",
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
"react-native-gesture-handler": "~1.2.1",
"react-native-modal": "^11.5.4",
"react-native-paper": "^3.6.0",
"react-native-platform-touchable": "^1.1.1",
"react-native-reanimated": "1.0.1",
"react-native-safe-area-context": "^0.7.3",
"react-native-safe-area-view": "^1.0.0",
"react-native-status-bar-height": "^2.1.0",
"react-native-tab-view": "^2.13.0",
"react-native-vector-icons": "^5.0.0",
"react-redux": "^5.1.0",
"redux": "^4.0.1",
"redux-axios-middleware": "^4.0.0",
"redux-persist": "^5.10.0",
"save": "^2.4.0",
"victory-native": "^30.6.0"
"devDependencies": {
"babel-preset-expo": "^5.0.0",
"nodemon": "^2.0.2",
"react-native-dotenv": "^0.2.0"
The app was working with these dependencies that time.
1st issue is that error says Expo SDK v(null). But version is specified in both package.json and app.json.
2nd issue is error says Expo client requires v35.0.0. How can i run the app without upgrading sdk from v33 to v35
This is what worked for me.
Run npm i -g expo-cli (You may have to use sudo if on a Mac. I did.) then run expo upgrade
Follow the prompts and it should work.

undefined is not an object (evaluating 'viewConfig.Manager')

Im trying to upgrade expo sdk from version 33 to 34 and getting undefined is not an object (evaluating 'viewConfig.Manager') inside react-native package
package.json
"date-fns": "^2.0.1",
"eslint-plugin-react-hooks": "^1.7.0",
"expo": "^34.0.1",
"expo-analytics-amplitude": "~5.0.1",
"expo-asset": "^5.0.1",
"expo-constants": "^6.0.0",
"expo-font": "~5.0.1",
"expo-intent-launcher": "^6.0.0",
"expo-keep-awake": "~5.0.1",
"expo-linear-gradient": "~5.0.1",
"expo-localization": "~5.0.1",
"expo-location": "^5.0.1",
"expo-permissions": "^6.0.0",
"expo-yarn-workspaces": "^1.1.0",
"i18n-js": "3.2.2",
"pomeranian-durations": "^1.8.1",
"prop-types": "15.7.2",
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"react-native-app-intro-slider": "^3.0.0",
"react-native-gifted-chat": "0.9.0",
"react-native-keyboard-spacer": "^0.4.1",
"react-navigation": "^3.9.1",
"react-redux": "6.0.1",
"redux": "^4.0.1",
"redux-devtools-extension": "2.13.8",
"redux-logger": "3.0.6",
"redux-optimist": "^1.0.0",
"redux-sentry-middleware": "^0.1.1",
"redux-persist": "6.0.0",
"redux-thunk": "2.3.0",
"sentry-expo": "2.0.0",
"styled-components": "^4.2.0",
"synced-interval": "^0.2.0"
I was struggling with the same issue for the last two hours.
In my case there were some outdated libraries (including one I authored) using the old version of react-native which somehow causes this error.
Try running:
npm outdated
And then install new versions of outdated libraries listed using expo-cli one by one.
Hope this helps :)