I'm facing issue that when I choose date from DatePickerIOS it allows me to choose month but when I scroll date and year it doesn't allow me to choose/scroll and it is caused due to width problem. The code is given below:
<View style={{flex:1}}> <TouchableOpacity activeOpacity={0.8} onPress={this._selectFromDate} style={s.flex_direction_row} > <Text style={s.detail_txtinput_drpdown}> {this.state.from_d} </Text> <Icon style={s.calendar_icon} name="md-calendar" size={33} color="#00796b"/> </TouchableOpacity> { this.state.showFromDatePicker ? <DatePickerIOS date={this.state.from_date} onDateChange={(from_date)=>this._onFromDateChange(from_date)} mode="date" /> : null } </View> when I use flex:1 then it looks like below:
https://i.stack.imgur.com/PS7fp.png
and when I remove flex:1 it looks like below:
https://i.stack.imgur.com/5oktw.png
in second image I can select/scroll month(April) but I can't select/scroll date and year. Any help is appreciated. Thank you.
1 Answers
Answers 1
I just change place of DatePickerIOS's View I removed it from <TouchableOpacity>'s View and put it in main <View> after <View style={{flex:1}}>. It solved my problem.
<View style={{flex:1}}> <TouchableOpacity activeOpacity={0.8} onPress={this._selectFromDate} style={s.flex_direction_row} > <Text style={s.detail_txtinput_drpdown}> {this.state.from_d} </Text> <Icon style={s.calendar_icon} name="md-calendar" size={33} color="#00796b"/> </TouchableOpacity> </View> <View style={{justifyContent: 'center'}}> { this.state.showFromDatePicker ? <DatePickerIOS date={this.state.from_date} onDateChange={(from_date)=>this._onFromDateChange(from_date)} mode="date" /> : null } </View>
0 comments:
Post a Comment