AdelRedaa97 / react-native-select-dropdown

react-native-select-dropdown is a highly customized dropdown | select | picker | menu for react native that works for andriod and iOS platforms.
MIT License
314 stars 134 forks source link

I need onRequestClose prop of React Native Modal #110

Closed yashpatel100 closed 1 year ago

yashpatel100 commented 1 year ago

I need to come back when clicking on the android back button like below code

import React from 'react'; import {Modal} from 'react-native'; import { useNavigation } from '@react-navigation/native'

const DropdownModal = ({setIsVisible, visible, statusBarTranslucent, children}) => { const navigation = useNavigation(); const defaults = { statusBarTranslucent: statusBarTranslucent || false, }; return ( <Modal onRequestClose={()=>{ setIsVisible(false) navigation.goBack() }} supportedOrientations={['portrait', 'landscape']} animationType="none" transparent={true} statusBarTranslucent={defaults.statusBarTranslucent} visible={visible}> {children} ); }; export default DropdownModal;

btooom1999 commented 1 year ago

i am using 3.3.0 version, try this by patch-package

diff --git a/node_modules/react-native-select-dropdown/src/SelectDropdown.js b/node_modules/react-native-select-dropdown/src/SelectDropdown.js index a59b78d..3bdac77 100644 --- a/node_modules/react-native-select-dropdown/src/SelectDropdown.js +++ b/node_modules/react-native-select-dropdown/src/SelectDropdown.js @@ -166,7 +166,7 @@ const SelectDropdown = ( const renderDropdown = () => { return ( isVisible && (

-const DropdownModal = ({visible, statusBarTranslucent, children}) => { +const DropdownModal = ({visible, statusBarTranslucent, children, onRequestClose}) => { const defaults = { statusBarTranslucent: statusBarTranslucent || false, }; @@ -10,6 +10,7 @@ const DropdownModal = ({visible, statusBarTranslucent, children}) => { supportedOrientations={['portrait', 'landscape']} animationType="none" transparent={true}

AdelRedaa97 commented 1 year ago

Thanks, @btooom1999 this issue has been fixed in v3.3.2 in this commit 743d62e