n4kz / react-native-material-dropdown

Material dropdown with consistent behaviour on iOS and Android
Other
732 stars 597 forks source link

TypeError #220

Open shahanshah87 opened 4 years ago

shahanshah87 commented 4 years ago

What I did just install this library. And I am getting TypeError as:- Screenshot 2020-04-02 at 6 52 32 PM Version:- Screenshot 2020-04-02 at 8 05 40 PM

Please Help!!! Thanks in advance!!!

ckasek commented 4 years ago

I'm wondering if it's an issue with the latest version of React Native. It works for me in a project that is on 59.9, but my new project using 62.0 gets a similar TypeError: Cannot read property 'style' of undefined

EricWiener commented 4 years ago

React Native 0.62 removed propTypes. You need to remove the line:

itemTextStyle: Text.propTypes.style,
shahanshah87 commented 4 years ago

React Native 0.62 removed propTypes. You need to remove the line:

itemTextStyle: Text.propTypes.style,

I did remove this line from node_module/react-native-material-dropdown/src/component/index.js line 136 but this not working too. I even tried after removing itemTextStyle from line 582 and 633, but it does not work again. What should I do now?

EricWiener commented 4 years ago

Try removing any occurrence of Text.propTypes.style. I was using this library in an old component that wasn't in production anymore, so I just removed the library.

OrLevy23 commented 4 years ago

React Native 0.62 removed propTypes. You need to remove the line:

itemTextStyle: Text.propTypes.style,

I did remove this line from node_module/react-native-material-dropdown/src/component/index.js line 136 but this not working too. I even tried after removing itemTextStyle from line 582 and 633, but it does not work again. What should I do now?

just found out that another library that is used in react-native-material-dropdown also use those deprecated props: it's react-native-material-textfield

anshumanburman commented 4 years ago

i also have the same issue and have tried with above solution but still not working.

shahanshah87 commented 4 years ago

Its working fine in version 0.61.5 but this issue is in 0.62.0

shahanshah87 commented 4 years ago

Try removing any occurrence of Text.propTypes.style. I was using this library in an old component that wasn't in production anymore, so I just removed the library.

I did search all the Text.propTypes.style and remove that but still does not work. I think this issue is with version 0.62.0 because it is working fine in version 0.61.5

anshumanburman commented 4 years ago

@Shahanshah87 i have the same issue it is working fine in 0.61.5 version but not in 0.62 and not any updated of this library. i think, i have to leave using this library.

OrLevy23 commented 4 years ago

@Shahanshah87 i have the same issue it is working fine in 0.61.5 version but not in 0.62 and not any updated of this library. i think, i have to leave using this library. You can use my fork https://github.com/OrLevy23/react-native-material-dropdown

noway commented 4 years ago

OrLevy23's fork doesn't show layout for me right, so i've prepared my own fork off latest 0.11.1:

npm i https://github.com/noway/react-native-material-dropdown
shahanshah87 commented 4 years ago

OrLevy23's fork doesn't show layout for me right, so i've prepared my own fork off latest 0.11.1:

npm i https://github.com/noway/react-native-material-dropdown

This is working fine. Thanks @noway for this.

subrahmanyam-mahaswami commented 4 years ago
    npm i https://github.com/noway/react-native-material-dropdown

This is working fine, thank you @noway

eriffat896 commented 4 years ago

OrLevy23's fork doesn't show layout for me right, so i've prepared my own fork off latest 0.11.1:

npm i https://github.com/noway/react-native-material-dropdown

after entering npm i https://github.com/noway/react-native-material-dropdown in command prompt it is giving errors.

pschorey commented 4 years ago

The below worked for me, got the answer from the link: Afifa Khan, Stack Overflow

And remove Animated in Animated.Text.propTypes.style in

of react-native-material-textfield.

citadelio commented 4 years ago

The below worked for me, got the answer from the link: Afifa Khan, Stack Overflow

  • 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.

This Worked for me, on a project using RN 0.62. Thank you @pschorey

muhammadashfaq commented 4 years ago

OrLevy23's fork doesn't show layout for me right, so i've prepared my own fork off latest 0.11.1:

npm i https://github.com/noway/react-native-material-dropdown

Working thanks

jasonjin220 commented 4 years ago

I've solved it by these steps..

  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 used 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'

Bulu507 commented 3 years ago

3. import { Dropdown } from 'react-native-material-dropdown-v2'

its work for me, thanks

yefimchuk commented 2 years ago

OrLevy23's fork doesn't show layout for me right, so i've prepared my own fork off latest 0.11.1:

npm i https://github.com/noway/react-native-material-dropdown

thanks, it's work for me

AndreyPatseiko commented 2 years ago

npm i https://github.com/noway/react-native-material-dropdown and react-native-material-dropdown-v2 don't work now :( RN 0.69.3. This fact force me to use this more fresh library https://github.com/hoaphantn7604/react-native-element-dropdown