Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
practiceTask
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
李彥志
practiceTask
Commits
5a98c180
Commit
5a98c180
authored
Nov 07, 2018
by
李彥志
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add dialog and remove alert
parent
84636ee5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
17 deletions
+40
-17
containers/home/index.js
containers/home/index.js
+40
-17
No files found.
containers/home/index.js
View file @
5a98c180
...
...
@@ -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
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment