ios对话框中的原生日历选择器



react-native-ios中,我使用react-native-datepicker从日历选择日期。为此,我使用以下链接:react-native-ios中的日期选择器

我在我的渲染方法中添加以下代码:

<View style={styles.buttonContainer}>
   <TouchableOpacity
     style={[styles.bubble, styles.button]}
     onPress={() => this.openCalender()}>
     <DatePicker
       style={{width: 150}}
       date={this.state.date}
       mode="date"
       placeholder="Date"
       format="YYYY-MM-DD"
       minDate="2015-01-01"
       maxDate="2025-12-01"
       confirmBtnText="Confirm"
       cancelBtnText="Cancel"
       iconSource={require('./assets/cal.png')}
       onDateChange={(date) => {this.setState({date: date});}}
     />
   </TouchableOpacity>
 </View>

但是我想在对话框中添加这个日期选择器。在react-native-ios中实现的方式是什么?

我想把日期选择器放在导航栏上右键点击。

我正在使用这个库:https://github.com/xgfe/react-native-datepicker

我仍然不确定你想要实现什么,但是你上面的代码将不起作用,除非你把<DatePicker/>移到<TouchableOpacity/>之外。一旦您将其移出,它应该打开选择器,如预期的包。

最新更新