O'Reilly logo

React Native By Example by Richard Kho

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Clearing due date example

Here's what I did to get the button to clear a selected date and expand/collapse our cells to play nicely:

// Tasks/app/components/EditTask/index.js ... import {   Button,   ... } from 'react-native'; ... export default class EditTask extends Component {   constructor (props) {     ...     this.state = {       ...       expanded: false     }   }   render () {     ...     return (       <View style={ styles.editTaskContainer }>         <View style={ [styles.expandableCellContainer,        { maxHeight: this.state.expanded ?         this.state.datePickerHeight : 40 }]}> 

I wrapped a new View around ExpandableCell. Its styling is modified based on the expanded Boolean in the state of EditTask. If the component is expanded, then its maxHeight property is set to the height ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required