react-native-material-textfield
react-native-material-textfield copied to clipboard
react-native-material-textfield module with issue undefined is not an object Animated.Text.propTypes.style
E | ReactNativeJS ▶︎ TypeError: undefined is not an object (evaluating '_reactNative.Animated.Text.propTypes.style')
i have same issues, i'm using react native 0.62.0. #238
Same issue here with react native 0.62.0
It doesn't work with 0.62.
See this commit: https://github.com/facebook/react-native/commit/86d90c03ebe39ebc4b2c6dcc0747b4f3a34f5f2f
Changelog:
[General] [Removed] - Removed propTypes from Animated components.
Same issue here with react native 0.62.0, Any suggestion ?
Pull the project and change Animated.Text.propTypes to Text.propType and removed Animated from the imports.
style: Animated.Text.propTypes.style
I also have the issue. It doesn't for for react-native from version 0.62.0 and above as propTypes for Animated components have been removed. On changing react-native version in package.json to lower versions the app compiled with several warnings but the app didn't run eventually probably due to incompatible libraries used in other packages/modules in the framework.
use react-native version0.61.5
in @0.62.1 not working
As @mike-niemand mentioned as a workaround i replaced:
style: Animated.Text.propTypes.style
with:
style: Text.propType
in the following 3 files in the directory: .../node_modules/react-native-material-textfield/src/components/
Affix/index.js Helper/index.js label/index.js
And also import {Text} from react-native in all three files, so youll have {Animated, Text} from 'react-native'
Seems to be working fine on react-native 0.62.1.
https://github.com/n4kz/react-native-material-textfield/issues/238#issuecomment-596026010
@Fabrice-Beya worked like a charm (0.62.2)! Thanks!
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
patchesdirectory in your project's root - Copy patch to
patches/react-native-material-textfield+0.16.1.patch yarn add patch-package postinstall-postinstallornpm i patch-packageyarn patch-packageornpx patch-package- Fix is already applied. Add the following to
package.jsonto not repeat the same next time:
"scripts": {
+ "postinstall": "patch-package"
}
I have forked this and modify.
Now try npm install https://github.com/javarahulsharma/react-native-material-textfield.git will solve this issue.
@javarahulsharma, Very good. Here it worked perfectly
@Fabrice-Beya Awesome, Thanks U :)
It is happening with me too on 0.62.2
@javarahulsharma using your fork by now, thank you
To resolve all errors and yellow boxes just remove all propTypes and set them on all Animeted components useNativeDriver={true}
i have created fork https://github.com/iOSUser110/react-native-material-textfield/blob/master/src/components/helper/index.js , and using this as i was facing the same issue
I have forked this and modify. Now try
npm install https://github.com/javarahulsharma/react-native-material-textfield.gitwill solve this issue.
It gives many warning such as 'style' is invalid

I have forked this and modify. Now try
npm install https://github.com/javarahulsharma/react-native-material-textfield.gitwill solve this issue.It gives many warning such as
'style' is invalid
yes it is giving warnings. Any Idea how to resolve?
I created a new patch file for #283 and #285 for react-native 0.62
this should solve your problem @mohity777 and @saadi-ninjasCode
I've solved it by these steps..
-
Remove installed package
react-native-material-dropdownyarn remove react-native-material-dropdown -
Install new packages
react-native-material-dropdown-v2andreact-native-paper.yarn add react-native-material-dropdown-v2 react-native-paper -
Swap
react-native-material-dropdownused toreact-native-material-dropdown-v2in your codee.g.
import { Dropdown } from 'react-native-material-dropdown'toimport { Dropdown } from 'react-native-material-dropdown-v2'
As @mike-niemand mentioned as a workaround i replaced:
style: Animated.Text.propTypes.style
with:
style: Text.propType
in the following 3 files in the directory: .../node_modules/react-native-material-textfield/src/components/
Affix/index.js Helper/index.js label/index.js
And also import {Text} from react-native in all three files, so youll have {Animated, Text} from 'react-native'
Seems to be working fine on react-native 0.62.1.
I do not have style: Animated.Text.propTypes.style inside of the three index.js files, instead I have style: Text.propTypes.style
@KingBlacc you should replace Text.propType in this case
or type npm install react-native-material-textfield again. After that you can run this patch file
I build a workaround until update. To use do the following:
-
download this repo inside a folder called patches in your project root.
-
add this script @ your package.json's script section: "postinstall": "./patches/script-patch.sh"
-
run yarn to install the patch
this fix will allow you to run these patches automatically every time you install your project's dependencies. Remove it when we have a proper fix from the lib's author.
- postinstall
When following this approach, I get an error because the Text variable is not imported
@KingBlacc you should replace Text.propType in this case
or type npm install react-native-material-textfield again. After that you can run this patch file
Following the above steps worked, but I also had to update the material dropdown to v2
Applying the new fix I have this issue https://github.com/facebook/react-native/issues/22927
Default props: https://github.com/n4kz/react-native-material-textfield/blob/master/src/components/field/index.js#L58
Where it's calculated: https://github.com/n4kz/react-native-material-textfield/blob/master/src/components/line/index.js#L89
Some said we have to add a margin: sameBorderWithValue to make it works, but it becomes ugly if the width is bigger.
Any idea?
@mwegener-com thank you so mutch for your patch! Works perfect! @n4kz is it possible to apply this patch to the future update?
Note that if you have already applied another patch before, you have to first reinstall the module before applying it
I have forked this and modify. Now try
npm install https://github.com/javarahulsharma/react-native-material-textfield.gitwill solve this issue.
Thank you sir! I understand how propTypes work but I can't seem to find a resource/documentation about ".propType". Is this like undocumented props react-native components?
I logged the Text component and the property that it has is .propTypes and not .propType