Open yarra2296 opened 6 years ago
The same issue ;(
**
This code will change time also can show your desired time
**
import { Dimensions, Platform, StyleSheet } from "react-native";
const { width, height } = Dimensions.get("window");
const screenWidth = width < height ? width : height;
const halfScreenWidth = screenWidth / 2;
constructor(props) { super(props); this.state = { timeStart: "5:10 AM" } } <DatePicker style={{ width: halfScreenWidth, top: -2, height: 28 }} customStyles={{ btnTextConfirm: { fontFamily: Fonts.type.book, fontSize: Fonts.size.noraml, color: Colors.text.primary }, btnTextCancel: { fontFamily: Fonts.type.medium, fontSize: Fonts.size.normal, color: Colors.text.primary },
dateIcon: {
display: "none"
},
cancelStyle: {},
dateInput: {
borderWidth: 0,
alignItems: "flex-start"
},
dateText: {
color: Colors.text.primary,
fontSize: Fonts.size.normal,
fontFamily: Fonts.type.book
}
}}
date={this.state.timeStart}
mode="time"
format="LT"
confirmBtnText="Confirm"
cancelBtnText="Cancel"
showIcon={false}
onDateChange={timeStart => {
this.setState({ timeStart: timeStart });
}}
/>
I am using TimePicker and I am not able to view the selected Time in the Input
Want to Get the Selected Time Input
Code
<TimePicker style={{width: 200}} time={this.state.time} mode="time" placeholder="select time" format='h:mm' minTime="00:00" maxTime="23:59" confirmBtnText="Confirm" cancelBtnText="Cancel" customStyles={{ dateIcon: { position: 'absolute', left: 0, top: 4, marginLeft: 0 }, dateInput: { marginLeft: 36 } // ... You can check the source to find the other keys. }} onTImeChange={(time) => {this.setState({time: time})}} />
Environment
react-native -v
:node -v
:npm -v
:yarn --version
:target platform
: Android | iOSoperating system
: