redux-form-material-ui for react-native - reactjs

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.

Related

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

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/

How to make create-react-app support .mjs files with webpack?

I'm trying to work with this twitch npm package (https://www.npmjs.com/package/twitch) and am running into some issues when deploying via creat-react-app / react-scripts.
From my understanding, the webpack config that is bundled with create-react-app doesn't like .mjs files that this npm package is using. So, I get the error below when I try to build the app.
./node_modules/twitch/es/API/Kraken/Channel/ChannelApi.mjs
app_1 | Can't import the named export 'Cacheable' from non EcmaScript module (only default export is available)
If I manually deleted the "es" folder, then the build worked and everything functioned as expected. However, this isn't a real solution because when I push to production and deploy there the node modules are re-installed and the build fails once again.
Build processes aren't really my strong suit and after googling around for a while I'm unable to find a solution. If anyone can assist or can point me in the right direction, that would be much appreciated!
If it helps, here is my package.json
{
"name": "ui",
"version": "1.0.0",
"license": "UNLICENCED",
"private": true,
"dependencies": {
"#babel/core": "^7.9.0",
"#babel/plugin-syntax-dynamic-import": "^7.2.0",
"#babel/register": "^7.0.0",
"axios": "^0.19.2",
"babel-plugin-dynamic-import-node": "^2.2.0",
"btoa": "^1.2.1",
"clipboard-copy": "^3.0.0",
"connected-react-router": "^6.8.0",
"dateformat": "^3.0.3",
"dotenv": "^8.0.0",
"draft-js": "^0.11.0",
"draft-js-export-html": "^1.4.1",
"express": "^4.16.4",
"file-loader": "^3.0.1",
"firebase": "^5.2.0",
"history": "^4.7.2",
"human-date": "^1.4.0",
"ignore-styles": "^5.0.1",
"immutability-helper": "^3.0.0",
"jwt-decode": "^2.2.0",
"lodash": "^4.17.11",
"normalizr": "^3.2.4",
"prop-types": "^15.6.1",
"qs": "^6.5.2",
"react": "^16.8.0",
"react-animations": "^1.0.0",
"react-dnd": "^7.4.5",
"react-dnd-html5-backend": "^7.4.4",
"react-dom": "^16.8.0",
"react-ga": "^2.5.3",
"react-gtm-module": "^2.0.10",
"react-helmet": "^5.2.0",
"react-image-crop": "^8.3.0",
"react-is": "^16.8.0",
"react-loadable": "^5.5.0",
"react-loading-skeleton": "^2.0.1",
"react-on-screen": "^2.1.1",
"react-pdf": "^4.0.5",
"react-pose": "^4.0.6",
"react-redux": "^6.0.1",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.0",
"react-stripe-elements": "^2.0.0",
"redux": "^4.0.0",
"redux-devtools-extension": "^2.13.2",
"redux-thunk": "^2.2.0",
"reselect": "^3.0.1",
"semantic-ui-calendar-react": "^0.15.3",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^0.87.1",
"styled-components": "^4.2.0",
"twitch": "^4.2.4",
"url-loader": "^1.1.2",
"validator": "^11.1.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"lint": "eslint src",
"server": "NODE_ENV=production node server/bootstrap.js"
},
"engines": {
"node": "^10.0.0",
"yarn": "^1.12.3"
},
"devDependencies": {
"#babel/plugin-proposal-class-properties": "^7.4.4",
"#babel/plugin-transform-runtime": "^7.4.4",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-import": "^2.11.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.8.1",
"eslint-plugin-react-hooks": "^3.0.0",
"prettier": "^2.0.2"
},
"proxy": "http://api:8080",
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"jest": {
"moduleNameMapper": {
"\\.worker.js": "<rootDir>/__mocks__/workerMock.js"
}
}
}
A suggestion presented at this GitHub comment was to add react-app-rewired to your project and then use this config-overrides.js file:
module.exports = function override(config) {
config.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
});
return config;
}
In my project I was already using react-app-rewired, so I just added the rule from that snippet. This workaround fixed the error for me.
In the specific case of the twitch library, the author has suggested trying the #next release, although I haven't personally verified that solution yet.
Upgrading to the latest react-scripts version of 5.0.1 in my package.json as of writing this, has solved the issue for me.
Upgrading tolatest react-scripts version of 5.0.1 in my package.json as of writing this
use the code
npm install --save --save-exact react-scripts#5.0.1
or
yarn add --exact react-scripts#5.0.1

Unable to resolve expo-font. Expo modules does not exist in the Haste module map

My package.json looks like this, and I am getting an error that unable to resolve expo-font. Please help me to resolve this issue.
{
"name": "myProject",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios"
},
"dependencies": {
"#babel/polyfill": "^7.4.4",
"#babel/runtime": "^7.4.5",
"#expo/vector-icons": "^10.0.2",
"express": "^4.17.1",
"react": "16.6.0-alpha.8af6728",
"react-native": "0.57.5",
"react-native-gesture-handler": "^1.3.0",
"react-native-vector-icons": "^6.5.0",
"react-navigation": "^3.11.0",
"redux": "^4.0.1",
"socket.io": "^2.2.0",
"socket.io-client": "^2.2.0"
},
"devDependencies": {
"#babel/core": "^7.4.5",
"#babel/plugin-transform-runtime": "^7.4.4",
"babel-preset-expo": "^5.0.0"
}
}
I just found out the solution to this.
rm -rf /tmp/metro-cache
This resolves the issue.

Invariant Violation: Element type is invalid: expected a string or a class/function but got: object- Possible Babel Issue

Everything in my project was working until randomly everything crashed upon launch. I am guessing that this has something to do with babel because it was working on second and now it isn't. As you can see the error persists throughout different parts of my application.
Something to note is it says "check the render method of 'SceneView'", but I do not have a SceneView.
I was getting this error: undefined is not an object (evaluating 'regeneratorRuntime.mark'), until I decided to switch from npm to yarn and now I am getting the error you are currently seeing.
package.json:
{
"name": "roam",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-jest": "^23.2.0",
"babel-preset-react-native": "^2.0.0",
"babel-preset-react-native-stage-0": "^1.0.1",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"jest": "^22.4.4",
"jest-enzyme": "^6.0.2",
"jest-react-native": "^18.0.0",
"react-test-renderer": "^16.4.1",
"redux-mock-store": "^1.5.3"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "node node_modules/jest/bin/jest.js"
},
"jest": {
"preset": "react-native",
"transform": {
"^.+\\.jsx?$": "babel-jest"
},
"transformIgnorePatterns": [
"node_modules/(?!react-native|react-navigation)/"
]
},
"dependencies": {
"axios": "^0.18.0",
"babel-preset-env": "^1.6.1",
"expo": "^28.0.0",
"native-base": "^2.6.1",
"prop-types": "^15.6.2",
"react": "^16.2.0",
"react-dom": "^16.4.1",
"react-native": "^0.49.5",
"react-native-elements": "^0.19.1",
"react-native-pages": "^0.7.0",
"react-native-sensitive-info": "^5.1.0",
"react-native-swiper": "^1.5.13",
"react-native-vector-icons": "^4.5.0",
"react-navigation": "^2.9.3",
"react-redux": "^5.0.7",
"react-scripts": "^1.1.4",
"redux": "^3.7.2",
"redux-axios-middleware": "^4.0.0",
"redux-persist": "^5.10.0",
"redux-persist-sensitive-storage": "^1.0.0",
"redux-thunk": "^2.3.0",
"tcomb-form-native": "^0.6.14",
"util": "*"
}
}
.babelrc:
{
"presets": [["env", {"modules": false}], "react-native"],
"env": {
"test": {
"presets": [["env", {"modules": false}], "react-native"]
}
}
}
Fixed the bug by downgrading react dependency.

react-native expo publish showing a white screen

I have a very strange behaviour with a react native app building with Expo Kit. Things can run local, but just show a white screen when I publish or build apk/ipa. Here is pcakage.json
{
"name": "ezymo",
"version": "0.1.0",
"private": true,
"devDependencies": {
"express": "^4.16.2",
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-connect": "^5.0.0",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.6.1",
"jest-cli": "^21.2.1",
"jest-expo": "^22.0.0",
"object-assign": "^4.1.1",
"react-native-scripts": "1.7.0",
"react-test-renderer": "16.0.0-beta.5",
"run-sequence": "^2.2.0",
"socket.io": "^2.0.3"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"axios": "^0.16.2",
"dateformat": "^3.0.2",
"events": "^1.1.1",
"expo": "^22.0.2",
"lodash.times": "^4.3.2",
"prop-types": "^15.6.0",
"react": "16.0.0-beta.5",
"react-native": "^0.49.5",
"react-native-camera": "^0.10.0",
"react-native-datepicker": "^1.6.0",
"react-native-modal": "^4.1.0",
"react-native-ratings": "^4.1.0",
"react-native-vector-icons": "^4.4.2",
"react-navigation": "^1.0.0-beta.22",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-saga": "^0.15.6",
"redux-thunk": "^2.2.0",
"uuid": "^3.1.0",
"when": "^3.7.8"
}
}
It's very strange that didn't happen for my other projects. Anyone encounter before and any suggestions?

Resources