This is how we can start building ExpandableCell:
// Tasks/app/components/ExpandableCell/index.js import React, { Component, PropTypes } from 'react'; import { LayoutAnimation, Text, TouchableHighlight, View } from 'react-native'; import styles from './styles'; export default class ExpandableCell extends Component {
This sets the title as an expected string PropTypes for the component:
static propTypes = { title: PropTypes.string.isRequired }
Now we track a Boolean named expanded in the component state. By default, our child components should not be visible:
constructor (props) { super (props); this.state = { expanded: false } }
Set the LayoutAnimation style for whenever this component ...