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

DatePickerAndroid and TimePickerAndroid example

Remove DatePickerIOS and ExpandableCell from the import statements:

// Tasks/app/components/EditTask/index.android.js ... import {   ...   DatePickerAndroid,   TimePickerAndroid, } from 'react-native'; ... 

I removed the expanded Boolean from state in this component's constructor function:

export default class EditTask extends Component {   ... 

This new Button for DatePicker calls _showAndroidDatePicker when pressed. It is placed right below TextInput and replaces ExpandableCell:

  render () {     ...     return (       <View style={ styles.editTaskContainer }>         ...         <View style={ styles.androidButtonContainer }>           <Button             color={ '#80B546' }             title={ this.state.dateSelected ? dueDateSetTitle :  noDueDateTitle ...

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