How it works...
In step 4, we defined the first Modal component. We defined the onClosed and onOpened props, passing the onClose and onOpen class methods to these props. Whenever this Modal component is opened, this.onOpen will fire, and this.onClose will execute when the Modal is closed. While we didn't do anything exciting with these methods in this recipe, these hooks could serve as the perfect opportunity for logging user actions related to the modal. Or if the modal houses a form, onOpen could be used to pre-populate some form inputs with data, and onClose could save the form data to the state object for use as the modal is closed.
In step 5, we defined the method that the first TouchableOpacity button component executes when pressed: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access