React Native's Datepickerios components

Source: Internet
Author: User

1. First introduce the Datepickerios component as shown in the code set his time is the current time

Export default class Alertdemo extends Component {  render () {    return (      <view Style={styles.container} >          <datepickerios date={new Date ()} mode= "Time"/>      </View>    );}  }

  

Where the mode attribute represents the total of his display mode is ' date ', ' Time ', ' datetime ', these three modes

However, this status is selected and will be returned to the current time so the State property should be set as follows

Export default class Alertdemo extends Component {  static defaultprops ={    date:new date ()    //Initialize static current time  }  Constructor (props) {    super (props);    this.state={         //Dynamic state    Date:this.props.date    }  }  render () {    return (      <view style={styles.container}>        <datepickerios             date={this.state.date}              ondatechange={(date) = This.setstate ({date})}//start this function             mode= ' time '/> </View>) when the content       changes    ;}  }

This allows you to resolve changes that do not appear and automatically run to the current time after changing the time

React Native's Datepickerios components

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.