react-native 时间组件的使用

安装

1
2
3
4
5
6
yarn add react-native-picker
react-native link react-native-picker
or

npm install react-native-picker --save
react-native link react-native-picker

官网的例子:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import Picker from 'react-native-picker';
let data = [[],[]];
for(var i=0;i<100;i++){
data[0].push(i);
}
for(var j=0;j<100;j++){
data[1].push(j);
}


Picker.init({
pickerData: data,
selectedValue: [25],
onPickerConfirm: data => { // 点击(confirm)确定时回调函数
console.log(data);
},
onPickerCancel: data => { // 点击(cancel)取消时回调函数
console.log(data);
},
onPickerSelect: data => { // 点击确定时回调函数
console.log(data);
}
});
Picker.show();

这也是一个可以自定义的组件: 例如看这里

babel-plugin-root-import

react-native-calendars
react-native-datetime

npm install beeshell beeshell

-------------本文结束感谢您的阅读-------------