24jieqi / react-native-xiaoshu

🌈 React Native UI library
https://24jieqi.github.io/react-native-xiaoshu
Apache License 2.0
188 stars 21 forks source link

DatePicker.range支持动态选中“开始时间”或“结束时间”? #52

Closed junjie-zeng closed 4 months ago

junjie-zeng commented 4 months ago

例如:在当前页面的按钮点击后调用DatePicker.range方法,默认选中结束时间。

onlyling commented 4 months ago
// 不传时间,默认开始时间是当前时间,结束时间未选择,点击确定返回 [当前时间对象, null]
DatePicker.range({
  title: '选择时间',
})

// 设置特别时间值,默认开始当前时间,结束时间是 defaultValue 的第二个时间,点击确定返回 [当前时间, defaultValue 的第二个时间]
DatePicker.range({
  title: '选择时间',
  defaultValue: [null, new Date()],
})