siemiatj / react-native-modal-dropdown

Fork of the original https://github.com/sohobloo/react-native-modal-dropdown
MIT License
119 stars 98 forks source link

How do i call the show method? Kindly help #21

Open patrickkabwe opened 3 years ago

patrickkabwe commented 3 years ago

Screenshot 2021-03-05 at 6 25 25 AM

Hi donni106, Thanks for following up, In the above image there is a show( ) method which triggers the dropdown Modal to show. My question was how can i call the show( ) method in a case where i am using a custom Icon to display the dropdown modal? Thank you

donni106 commented 3 years ago

can you elaborate a bit more please what you need to know

smriti-spotnana commented 3 years ago

I think they want to know how to call the show() method manually? - rather than lib calling it itself

patrickkabwe commented 3 years ago

@smriti-spotnana Any suggestion?

smriti-spotnana commented 3 years ago

Nope, I couldn't figure out myself ..

donni106 commented 3 years ago

Please have a look in the examples, there you can find one for using show() (dropdown_5).

Code for examples with Expo: https://github.com/siemiatj/react-native-modal-dropdown/blob/master/expo-example/App.js Code for examples without Expo: https://github.com/siemiatj/react-native-modal-dropdown/blob/master/example/index.js

You can also try the examples running on a phone or simulator.

jayarajm commented 3 years ago

Yes I can call show(), But the drop is not open. I hope the fullscreen overlay is coming but dropdown is not open.

gorbs commented 3 years ago
const dropdownRef = useRef();

return (
<View>
<Button title="press" onPress={() => dropdownRef.current.show()} />
<ModalDropdown
  ref={dropdownRef}
  options={['aaa','bbb','ccc']}
/> 
</View>
)