- Let's start by focusing on the Panel component. First, we need to import all the dependencies that we are going to use for this class:
import React, { Component } from 'react';import { View, LayoutAnimation, StyleSheet, Text, TouchableOpacity,} from 'react-native';
- Once we have the dependencies, let's declare the defaultProps for initializing this component. In this recipe, we only need to initialize the expanded property to false:
export default class Panel extends Component { static defaultProps = { expanded: false };}const styles = StyleSheet.create({ // Defined on later step});
- We are going to use the height property on the state object to expand or collapse the container. The first time this component gets created, ...