Reputation: 316
I am using react-native-collapsible for a project. Everything working well but I would like the user to be able to close the collapsible by clicking anywhere on the screen when it is opened. On a desktop it would be easy with a !event.target match but since I am new to React Native (expo) I am a bit out of solution. Thanks a lot, I pasted no code because I am currently using the Lorem example from the lib so won't be much useful.
Upvotes: 0
Views: 472
Reputation: 584
You can Make one useState variable and pass it into the property of
collapsed={Your useState Veriable}
react-native-collapsible .
also make all the Design wrap into TouchableOpacity
and it's onPress event to make it true.
Upvotes: 0