DatePicker.js 661 B

12345678910111213141516171819202122232425262728293031323334
  1. import React, {Component} from 'react';
  2. import {DatePickerIOS, View, StyleSheet} from 'react-native';
  3. import Module from '../lib/Module';
  4. import Types from '../lib/Types';
  5. export default class DatePicker extends Module{
  6. constructor(props){
  7. super(props)
  8. this.state = { chosenDate : new Date()}
  9. }
  10. setDate(newDate) {
  11. this.setState({chosenDate: newDate});
  12. }
  13. display(){
  14. let { container } = this.props.style || '';
  15. return(
  16. <View style={container}>
  17. <DatePickerIOS
  18. date={this.state.chosenDate}
  19. onDateChange={(date) => this.setDate(date)}
  20. />
  21. </View>
  22. )
  23. }
  24. }
  25. DatePicker.Inputs = {
  26. }