Commit 5a98c180 authored by 李彥志's avatar 李彥志

add dialog and remove alert

parent 84636ee5
...@@ -12,8 +12,8 @@ import { ...@@ -12,8 +12,8 @@ import {
Modal Modal
} from 'react-native'; } from 'react-native';
import styles from './styles'; import styles from './styles';
// import DialogBox from 'react-native-dialogbox'; // import DialogBox from 'react-native-dialogbox'
import Dialog from '../../src/Dialog';
export default class home extends React.Component { export default class home extends React.Component {
...@@ -48,22 +48,37 @@ export default class home extends React.Component { ...@@ -48,22 +48,37 @@ export default class home extends React.Component {
// }); // });
// } // }
logout () { constructor (props) {
const title = "你確定嗎?" super(props);
const message = "登出後系統會將移動裝置中的資料進行刪除" this.state = {
visible: false
Alert.alert( }
title,
message,
[
{text: '取消', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
{text: '登出', onPress: () => console.log('OK Pressed')},
],
)
} }
render() { // logout () {
// const title = "你確定嗎?"
// const message = "登出後系統會將移動裝置中的資料進行刪除"
// Alert.alert(
// title,
// message,
// [
// {text: '取消', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
// {text: '登出', onPress: () => console.log('OK Pressed')},
// ],
// )
// }
closeCheckModal() {
this.setState({ visible: false });
}
doConfirmSave() {
this.setState({ visible: true });
}
render() {
const {visible} = this.state;
return ( return (
<View style={styles.container}> <View style={styles.container}>
...@@ -171,13 +186,21 @@ Alert.alert( ...@@ -171,13 +186,21 @@ Alert.alert(
<View style={styles.emptyRowContainer} /> <View style={styles.emptyRowContainer} />
</ScrollView> </ScrollView>
<TouchableOpacity style={styles.btnLogout} onPress={this.logout}> <TouchableOpacity style={styles.btnLogout} onPress={() => this.doConfirmSave()}>
<Text style={styles.btnLogoutText}> <Text style={styles.btnLogoutText}>
登出 登出
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
<Dialog
showCancel
show={visible}
title='你確定嗎?'
content='登出後系統會將移動裝置中的資料進行刪除'
cancelFun={() => this.closeCheckModal()}
confirmFun={() => this.closeCheckModal()}
contentStyle={styles.dialog_text}
/>
{/* <DialogBox ref={dialogbox => { this.dialogbox = dialogbox }}/> */} {/* <DialogBox ref={dialogbox => { this.dialogbox = dialogbox }}/> */}
</View> </View>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment