react-native-material-dropdown
react-native-material-dropdown copied to clipboard
TypeError: undefined is not an object (evaluating '_reactNative.Animated.Text.propTypes.style')
On recent version react-native (0.63.0) appears this error, I tryied to fix, but I didnt
TypeError: undefined is not an object (evaluating '_reactNative.Animated.Text.propTypes.style')
i am also getting the same issue with react-native 0.63.2.
Same issue
Obviously is the library deprecated. I see some PR that are maybe fixing the issue. Try to fork the project and merge those pull requests to your fork.
you may wanna take a look at this :) https://medium.com/swlh/how-to-add-a-dropdown-list-to-react-native-2441d6fe40c2
Also seeing the same issue after upgrading to RN 0.63.2. This lib should be marked as incompatible with at least 0.63.2 and maybe older versions too.
fixing in node_modules is not a good solution :(
https://github.com/n4kz/react-native-material-dropdown/issues/241#issuecomment-658078613
this actually works
same issue with react-native 0.63.2
Hopefully This will help you out https://stackoverflow.com/a/62794092/10806465
use this to resolve problem
Open node_modules and then search for react-native-material-textfield open the file and go to src folder Under src you will see affix, helper, label folder - under each folder, there is an index.js open the 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 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
use this to resolve problem
Open node_modules and then search for react-native-material-textfield open the file and go to src folder Under src you will see affix, helper, label folder - under each folder, there is an index.js open the 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 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
This is wrong and DO NOT do it like that because next time you install npm packages your changes will be overwritten ;)
use this to resolve problem Open node_modules and then search for react-native-material-textfield open the file and go to src folder Under src you will see affix, helper, label folder - under each folder, there is an index.js open the 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 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
This is wrong and DO NOT do it like that because next time you install npm packages your changes will be overwritten ;)
pls tell me how to solve this problem
For those who don't want to edit node_modules each time, here is a patch file according to @Fabrice-Beya advice using patch-package.
Instruction:
Create patches directory in your project's root Copy patch to patches/react-native-material-textfield+0.12.0patch 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"
}
Fix using example from https://github.com/n4kz/react-native-material-textfield/issues/249#issuecomment-625791243 editing version of patch only
I encounter the same issue with using expo 40.0.0
and react-native 40.0.0
in my project
i find the solution in stackoverflow, second answer
https://stackoverflow.com/questions/61226530/typeerror-undefined-is-not-an-object-evaluating-reactnative-animated-text-pr
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
e.g. import { Dropdown } from 'react-native-material-dropdown' to import { Dropdown } from 'react-native-material-dropdown-v2'
@yeukfei02, @zapcriativo Thanks for this info, It really helped a lot. But now my dropdown's appearance is completely changed
Original:
After using V2
Do you have any recommendations on how to go about solving this? Or should I wait for the fix in the original react-native-material-dropdown?
@theforceofhabit
I guess the worst case is to avoid to use react-native-material-dropdown
because expo will keep update, but this lib wont update.
so better switch to use another dropdown lib in react native with expo
I fixed it by adding react-native-material-dropdown, react-native-material-textfield, react-native-material-buttons libraries locally and then changing Animated.Text.propTypes.style to Text.propTypes.style inside react-native-material-textfield. Not an elegant solution but worked for me.
@yeukfei02, @zapcriativo Thanks for this info, It really helped a lot. But now my dropdown's appearance is completely changed Original:
After using V2
Do you have any recommendations on how to go about solving this? Or should I wait for the fix in the original react-native-material-dropdown?
It's because you replace react-native-material-dropdown to react-native-material-dropdown-v2 , I had this problem too so I just created the patch
Animated.Text.propTypes.style
i dnt find folder in node_modules? can you explain me??
(Use node --trace-warnings ...
to show where the warning was created)
System:
OS: macOS 11.6.8
CPU: (4) x64 Intel(R) Core(TM) i5-4308U CPU @ 2.80GHz
Memory: 78.20 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 18.9.1 - /usr/local/bin/node
Yarn: Not Found
npm: 8.19.1 - /usr/local/bin/npm
Watchman: 2022.09.19.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK:
API Levels: 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33
Build Tools: 27.0.1, 27.0.2, 27.0.3, 28.0.0, 28.0.1, 28.0.2, 28.0.3, 29.0.0, 29.0.1, 29.0.2, 29.0.3, 30.0.0, 30.0.1, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0, 33.0.0, 33.0.0
System Images: android-30 | Google Play Intel x86 Atom
Android NDK: 22.1.7171670
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8815526
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.13 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.70.1 => 0.70.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found