Basic ExpandableCell implementation

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 ...

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.