selvamk-js / sharingan-rn-modal-dropdown

A simple and customizable react-native dropdown created using react-native-modal and react-native-paper.
MIT License
86 stars 29 forks source link

Bump your version of react-native-modal to latest to avoid unmount errors in RN 0.70 #51

Open ashsharma1 opened 2 years ago

ashsharma1 commented 2 years ago

When the dropdown component unmounts in RN 0.70.1, it throws an error on removeListner() in react-native-modal. This is due to the changes in react native where removeListner has been renamed to just "remove".

I would suggest you explicitly raise react-native-modal's version in your dependencies.

Maribhuvan commented 1 year ago

I'm also facing this issue while using dropdown in Stack navigation modal screen while close it throw below error .

TypeError: undefined is not a function This error is located at: in ReactNativeModal (created by Dropdown) in RCTView (created by View)

**Example Code :** 

 <DropDown
    value={value}
    data={selectData} 
    placeholder={placeholder}
    onChange={onHandleChange}
/>

package.json
"@gorhom/bottom-sheet": "^4.4.5",
"@hookform/resolvers": "^2.9.10",
"@react-native-async-storage/async-storage": "^1.17.11",
"@react-native-community/blur": "^4.3.0",
"@react-native-community/netinfo": "^9.3.6",
"@react-navigation/bottom-tabs": "^6.5.1",
"@react-navigation/native": "^6.0.13",
"@react-navigation/stack": "^6.3.3",
"@shopify/flash-list": "^1.4.0",
"amazon-cognito-identity-js": "^6.0.1",
"aws-amplify": "^5.0.1",
"axios": "^1.2.1",
"i18next": "^22.0.5",
"lodash": "^4.17.21",
"react": "18.1.0",
"react-hook-form": "^7.39.2",
"react-i18next": "^12.0.0",
"react-native": "0.70.4",
"react-native-biometrics": "^3.0.1",
"react-native-config": "^1.4.11",
"react-native-device-info": "^10.3.0",
"react-native-encrypted-storage": "^4.0.3",
"react-native-gesture-handler": "^2.8.0",
"react-native-inappbrowser-reborn": "^3.7.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-mask-input": "^1.2.2",
"react-native-paper": "^4.12.5",
"react-native-reanimated": "^2.12.0",
"react-native-reanimated-carousel": "^3.1.5",
"react-native-safe-area-context": "^4.4.1",
"react-native-screens": "^3.18.2",
"react-native-splash-screen": "^3.3.0",
"react-native-vector-icons": "^9.2.0",
"sharingan-rn-modal-dropdown": "^1.4.0",
"yup": "^0.32.11",
"yup-password": "^0.2.2"

Simulator Screen Shot - iPhone 14 Pro Max - 2022-12-20 at 15 44 51

ashsharma1 commented 1 year ago

Try adding this to your package.json as a dependency: "react-native-modal": "^13.0.1",

Then yarn/npm and then try.

Maribhuvan commented 1 year ago

@ashsharma1 I tried but its not working

ashsharma1 commented 1 year ago

@Maribhuvan You need to do a fresh install of node_modules. I would recommend you delete your node_module/ directory and yarn.lock/package.lock.json file. And then do reinstall with yarn/npm. Then try.

This is how I made it work for me.

Maribhuvan commented 1 year ago

@ashsharma1 i tried your steps sharma but dropdown package have react-native-modal version is 11.5.6 . so they refer locally installed react-native-modal not refer "react-native-modal": "^13.0.1". so need to update dropdown package "react-native-modal": "^11.5.6" to "react-native-modal": "^13.0.1"

SohaibKtb commented 1 year ago

@Maribhuvan you can override it in your package.json file

add this line under devDependencies

  "overrides": {
    "sharingan-rn-modal-dropdown": {
      "react-native-modal": "^13.0.1"
    }
  },

if overrides didn't work try


 "resolutions": { 
   "sharingan-rn-modal-dropdown/react-native-modal" : "^13.0.1"
  }