React Native入门篇—react-native-datepicker的安装和使用

注意:未经允许不可私自转载,违者必究

React Native官方文档:https://reactnative.cn/docs/getting-started/

react-native-datepicker官方文档:https://github.com/xgfe/react-native-datepicker

项目地址GitHub地址:https://github.com/zhouwei1994/nativeCase.git

安装react-native-datepicker

在项目目录下cmd里面运行以下命令:

yarn add react-native-datepicker

没有安装yarn镜像的请看教程:https://blog.csdn.net/weixin_40614372/article/details/86154119

使用方法

import React, { Component } from 'react';
import { ScrollView, StyleSheet, Text, View } from 'react-native';
import DatePicker from 'react-native-datepicker';
class Home extends Component {
    static navigationOptions = {
        title: '日期/时间选择器',
    };
    constructor(props) {
        super(props);
        this.state = {
            date: "2016-05-15"
        }
    }
    render() {
        return (
            
                DatePicker
                 { this.setState({ date: date }) }}
                />
                 { this.setState({ date: date }) }}
                />
            
        );
    }
}
export default Home;
const styles = StyleSheet.create({

});

项目地址GitHub地址:https://github.com/zhouwei1994/nativeCase.git

注意:未经允许不可私自转载,违者必究

 

你可能感兴趣的:(React Native入门篇—react-native-datepicker的安装和使用)