TypeError: undefined is not an object (evaluating '_reactNative.Animated.Text.propTypes.style')

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.

  1. Remove installed package react-native-material-dropdown

    yarn remove react-native-material-dropdown

  2. Install new packages react-native-material-dropdown-v2 and react-native-paper

    yarn add react-native-material-dropdown-v2 react-native-paper

  3. 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'


I found the same problem while using @react-navigation/drawer

I've solved it by these steps.

  1. Open node_modules and then search for react-native-material-textfield open the file and go to src folder
  2. Under src you will see affix, helper, label folder - under each folder, there is an index.js
  3. 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
  4. And import text form react-native like this import { Animated , Text} from 'react-native';
  5. And now reload the terminal, and you are good to go

Tags:

React Native