如何使用NativeBase DatePicker

use*_*870 6 datepicker react-native native-base

鉴于NativeBase v2.5.1中的这个DatePicker Api,我应该如何使用新选择的日期捕获更改日期事件?

如果我很了解,那么所选日期仅在组件的内部状态中可用:

setDate(date) {
    this.setState({ chosenDate: new Date(date) });
}
Run Code Online (Sandbox Code Playgroud)

我想我可以使用react native ref api,但由于其他类似组件确实提供了onDateChange事件,因此它似乎不正确,例如:react-native-datepicker

Sup*_*tgi 2

检查日期选择器的文档https://docs.nativebase.io/Components.html#date-picker-def-headref

NativeBase KitchenSink 的示例示例https://github.com/GeekyAnts/NativeBase-KitchenSink/blob/master/src/screens/datepicker/index.js

v2.5.2已修复

  • @Supriya Kalghatgi,当我使用 Native Base 的日期选择器时,当日期选择器显示在 ios 上时,会显示白色背景,而不是调用日期选择器的 UI。Native-base版本:“2.7.2”,有什么解决方案还是一个错误?,请检查 (2认同)