|
|
@@ -285,56 +285,73 @@ export const DashboardView = ({isCharging=false, connectorInfo={}}) => {
|
|
|
|
|
|
export const EnterStationDialog = ({visible, stationId, onConfirm, onClose}) => {
|
|
|
var [inputStationId, setInput] = useState('')
|
|
|
+ var [iosKillDialog, killDialog] = useState(true)
|
|
|
|
|
|
const enterStatioinId= () => {
|
|
|
//console.log(inputStationId);
|
|
|
if (inputStationId) {
|
|
|
- QRResult.applyInputStation(inputStationId, stationId, (success, err) => {
|
|
|
- setInput('')
|
|
|
- if (success) {
|
|
|
- if (onConfirm) onConfirm()
|
|
|
- } else if (err) {
|
|
|
- toastShort(err)
|
|
|
- }
|
|
|
- if (onClose) onClose()
|
|
|
- });
|
|
|
+ if (isIOS && iosKillDialog) {
|
|
|
+ onClose();
|
|
|
+ killDialog(false);
|
|
|
+ } else {
|
|
|
+ QRResult.applyInputStation(inputStationId, stationId, (success, err) => {
|
|
|
+ setInput('')
|
|
|
+ if (success) {
|
|
|
+ if (onConfirm) onConfirm()
|
|
|
+ } else if (err) {
|
|
|
+ toastShort(err)
|
|
|
+ }
|
|
|
+ if (onClose) onClose()
|
|
|
+ });
|
|
|
+ }
|
|
|
} else {
|
|
|
toastShort('Please input Station ID')
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if (!visible && !iosKillDialog) {
|
|
|
+ killDialog(true);
|
|
|
+ setTimeout(() => {
|
|
|
+ enterStatioinId();
|
|
|
+ }, 100);
|
|
|
+ }
|
|
|
+ }, [iosKillDialog])
|
|
|
+
|
|
|
return (
|
|
|
- <Modal
|
|
|
- isVisible={visible}
|
|
|
- {...ModalProps}
|
|
|
- onBackdropPress={() => onClose}
|
|
|
- onBackButtonPress={() => onClose}>
|
|
|
- <View style={styles.stationDialog}>
|
|
|
- <Text style={styles.stationInputTitle}>Enter Station ID</Text>
|
|
|
- <TextInput
|
|
|
- style={styles.stationInput}
|
|
|
- defaultValue={inputStationId}
|
|
|
- placeholder='e.g: LEMOC0002-1'
|
|
|
- placeholderTextColor={textPlacehoder}
|
|
|
- onChangeText={text => setInput(text)}
|
|
|
- />
|
|
|
- <View style={styles.dialogButtons}>
|
|
|
- <Button
|
|
|
- textSize={17}
|
|
|
- style={styles.buttonCancel}
|
|
|
- viewStyle={ViewHeight(42)}
|
|
|
- text='Close'
|
|
|
- textColor={textCancel}
|
|
|
- onClick={onClose}/>
|
|
|
- <Button
|
|
|
- textSize={17}
|
|
|
- style={styles.buttonOK}
|
|
|
- viewStyle={ViewHeight(42)}
|
|
|
- text='Confirm'
|
|
|
- onClick={() => enterStatioinId()}/>
|
|
|
+ iosKillDialog
|
|
|
+ ? <Modal
|
|
|
+ isVisible={visible}
|
|
|
+ {...ModalProps}
|
|
|
+ onBackdropPress={() => onClose}
|
|
|
+ onBackButtonPress={() => onClose}>
|
|
|
+ <View style={styles.stationDialog}>
|
|
|
+ <Text style={styles.stationInputTitle}>Enter Station ID</Text>
|
|
|
+ <TextInput
|
|
|
+ style={styles.stationInput}
|
|
|
+ defaultValue={inputStationId}
|
|
|
+ placeholder='e.g: LEMOC0002-1'
|
|
|
+ placeholderTextColor={textPlacehoder}
|
|
|
+ onChangeText={text => setInput(text)}
|
|
|
+ />
|
|
|
+ <View style={styles.dialogButtons}>
|
|
|
+ <Button
|
|
|
+ textSize={17}
|
|
|
+ style={styles.buttonCancel}
|
|
|
+ viewStyle={ViewHeight(42)}
|
|
|
+ text='Close'
|
|
|
+ textColor={textCancel}
|
|
|
+ onClick={onClose}/>
|
|
|
+ <Button
|
|
|
+ textSize={17}
|
|
|
+ style={styles.buttonOK}
|
|
|
+ viewStyle={ViewHeight(42)}
|
|
|
+ text='Confirm'
|
|
|
+ onClick={() => enterStatioinId()}/>
|
|
|
+ </View>
|
|
|
</View>
|
|
|
- </View>
|
|
|
- </Modal>
|
|
|
+ </Modal>
|
|
|
+ : <></>
|
|
|
)
|
|
|
}
|
|
|
|