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

add dialog and remove alert

parent 84636ee5
......@@ -12,8 +12,8 @@ import {
Modal
} from 'react-native';
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 {
......@@ -48,22 +48,37 @@ export default class home extends React.Component {
// });
// }
logout () {
const title = "你確定嗎?"
const message = "登出後系統會將移動裝置中的資料進行刪除"
Alert.alert(
title,
message,
[
{text: '取消', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
{text: '登出', onPress: () => console.log('OK Pressed')},
],
)
constructor (props) {
super(props);
this.state = {
visible: false
}
}
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 (
<View style={styles.container}>
......@@ -171,13 +186,21 @@ Alert.alert(
<View style={styles.emptyRowContainer} />
</ScrollView>
<TouchableOpacity style={styles.btnLogout} onPress={this.logout}>
<TouchableOpacity style={styles.btnLogout} onPress={() => this.doConfirmSave()}>
<Text style={styles.btnLogoutText}>
登出
</Text>
</TouchableOpacity>
<Dialog
showCancel
show={visible}
title='你確定嗎?'
content='登出後系統會將移動裝置中的資料進行刪除'
cancelFun={() => this.closeCheckModal()}
confirmFun={() => this.closeCheckModal()}
contentStyle={styles.dialog_text}
/>
{/* <DialogBox ref={dialogbox => { this.dialogbox = dialogbox }}/> */}
</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