Writing a collapsible component

Our collapsible component should accomplish the following goals:

  • It should show and hide other components passed to it when tapped on
  • An animation will accompany this component, adding to the user experience of our app
  • The component should not make any assumptions about the type of data it is showing and hiding; it should not be strictly specific to DatePickerIOS in case we want to reuse the component for other purposes in the future

We'll need to take advantage of React Native's fantastic LayoutAnimation API, which is designed to let us create fluid and meaningful animations.

To begin, I've created an ExpandableCell component within the components folder of our project, like this:

|Tasks |__android |__app ...

Get React Native By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.