After upgrading React Native to 0.62.2
, and installing react-native-material-dropdown ` library, project is giving this error:
I solved this by,
Commenting itemTextStyle: Text.propTypes.style
in
..\node_modules\react-native-material-dropdown\src\components\dropdown
file.
And remove Animated
in Animated.Text.propTypes.style
in
affix/index
helper/index
label/index
of react-native-material-textfield
.
And added import { Animated, Text} from 'react-native';
in each of above three files.
Here is another solution I've found.
Remove installed package react-native-material-dropdown
yarn remove react-native-material-dropdown
Install new packages react-native-material-dropdown-v2
and react-native-paper
yarn add react-native-material-dropdown-v2 react-native-paper
Swap react-native-material-dropdown
to react-native-material-dropdown-v2
in your code
eg import { Dropdown } from 'react-native-material-dropdown'
to import { Dropdown } from 'react-native-material-dropdown-v2'
I found the same problem while using @react-navigation/drawer
I've solved it by these steps.
node_modules
and then search for react-native-material-textfield
open the file and go to src
foldersrc
you will see affix
, helper
, label
folder - under each folder, there is an index.js
index.js
of the mentioned folders one by one (all 3 folders) and search for the text style: Animated.Text.propTypes.style
, and replace it by style: Text.propTypes
import { Animated, Text} from 'react-native';
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:
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
I faced the same issue while using react-native-material-dropdown.
Fix:
node_modules/react-native-material-textfield/src/components
affix/index.js
, helper/index.js
and label/index.js
style: Animated.Text.propTypes.style
with style: Text.propType
import { Animated,Text} from 'react-native'
This should fix the issue
react-native version: 0.64.0
Just update the library they updated their library with fixes here is the link https://www.npmjs.com/package/react-native-material-dropdown-v2-fixed
Im using react-native-material-textfield
. Add in my js file before import:
import { Animated, Text } from 'react-native';
Animated.Text.propTypes = Animated.Text.propTypes || Text.propTypes;
import { TextField } from 'react-native-material-textfield';
I have resolved my issue by using this lib
react-native-material-dropdown-no-proptypes
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.