After upgrading React Native to 0.62.2, and installing react-native-material-dropdown` library, project is giving this error:
-
1github.com/n4kz/react-native-material-dropdown/issues/220 this might helpNeetin Solanki– Neetin Solanki2020-04-15 11:02:33 +00:00Commented Apr 15, 2020 at 11:02
10 Answers
I solved this by,
Commenting
itemTextStyle: Text.propTypes.stylein
..\node_modules\react-native-material-dropdown\src\components\dropdownfile.And remove
AnimatedinAnimated.Text.propTypes.styleinaffix/index
helper/index
label/index
of
react-native-material-textfield.And added
import { Animated, Text} from 'react-native';in each of above three files.
5 Comments
node_modules is not recommended. You can't add these files to source control since files under node_modules should be ignored. So there is no way for other developers on the same project to get the changes. And what happens if you want to upgrade to a newer version of that package? Your changes will be overwritten. A better approach would be to fork the react-native-material-dropdown package and publish a new package or get the changes integrated.react-native-material-dropdown-no-proptypes.Animated.Text.propTypes.style by Text.propTypesHere is another solution I've found.
Remove installed package
react-native-material-dropdownyarn remove react-native-material-dropdownInstall new packages
react-native-material-dropdown-v2andreact-native-paperyarn add react-native-material-dropdown-v2 react-native-paperSwap
react-native-material-dropdowntoreact-native-material-dropdown-v2in your codee.g.
import { Dropdown } from 'react-native-material-dropdown'toimport { Dropdown } from 'react-native-material-dropdown-v2'
2 Comments
I found the same problem while using @react-navigation/drawer
I've solved it by these steps.
- Open
node_modulesand then search forreact-native-material-textfieldopen the file and go tosrcfolder - Under
srcyou will seeaffix,helper,labelfolder - under each folder, there is anindex.js - open the
index.jsof the mentioned folders one by one (all 3 folders) and search for the textstyle: Animated.Text.propTypes.style, and replace it bystyle: Text.propTypes - And import text form react-native like this
import { Animated , Text} from 'react-native'; - And now reload the terminal, and you are good to go
5 Comments
There is an issue open on github about this problem. As mentioned in the comment, it is possible to use this option to edit node modules, or create a patch so that it is not necessary to edit the files every time you add a new library or run an npm install.
Instruction:
- Create patches directory in your project's root
- Copy patch to patches/react-native-material-textfield+0.16.1.patch
- yarn add patch-package postinstall-postinstall or npm i patch-package
- yarn patch-package or npx patch-package
Fix is already applied. Add the following to package.json to not repeat the same next time:
"scripts": {
+ "postinstall": "patch-package"
}
https://github.com/n4kz/react-native-material-textfield/issues/249#issuecomment-625791243
Comments
I faced the same issue while using react-native-material-dropdown.
Fix:
- navigate to
node_modules/react-native-material-textfield/src/components - Open files
affix/index.js,helper/index.jsandlabel/index.js - Replace
style: Animated.Text.propTypes.stylewithstyle: Text.propType - import {Text} in each of these 3 files
import { Animated ,Text} from 'react-native'
This should fix the issue
react-native version: 0.64.0
Comments
For me it was the package "react-native-easy-toast" at version 2.0.0. The weird thing was, that I couldn't find "propTypes" or "Animated" anywhere in my Code or in my libs (node-modules). I'd expect to find it somewhere in the react-native-easy-toast folder in node_modules...
Anyway, after commenting all my toasts the app started again.
I now also found a patch for this: "https://github.com/crazycodeboy/react-native-easy-toast/issues/118" and with this and from other here mentioned patch-package it worked with the toasts and the patch gets automatically applied after npm install:)
1 Comment
"react-native-easy-toast": "~2.3.0" when updated to expo 46Just update the library they updated their library with fixes here is the link https://www.npmjs.com/package/react-native-material-dropdown-v2-fixed
Comments
I am using react-native-material-textfield package, and I also faced this error so I added this piece of code in my JS file right before importing:
import { Animated, Text } from 'react-native';
Animated.Text.propTypes = Animated.Text.propTypes || Text.propTypes;
import { TextField } from 'react-native-material-textfield';


