Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
safetcut-app
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
atichat
safetcut-app
Commits
c86bb658
Commit
c86bb658
authored
Jul 22, 2019
by
Tonk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add confirm delete modal to TimerScreen
parent
b91cbfb4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
10 deletions
+60
-10
components/SwipeableRow.js
+60
-10
No files found.
components/SwipeableRow.js
View file @
c86bb658
import
React
,
{
Component
}
from
'react'
;
import
{
Text
}
from
'native-base'
;
import
{
Text
,
Button
}
from
'native-base'
;
import
{
View
,
Animated
,
StyleSheet
}
from
'react-native'
;
import
{
color
}
from
'../constants/Styles'
;
import
{
RectButton
}
from
'react-native-gesture-handler'
;
import
Swipeable
from
'react-native-gesture-handler/Swipeable'
;
import
IconMaterialIcons
from
'react-native-vector-icons/MaterialIcons'
;
import
{
Overlay
}
from
'react-native-elements'
;
const
AnimatedIcon
=
Animated
.
createAnimatedComponent
(
IconMaterialIcons
);
...
...
@@ -68,6 +69,9 @@ class SwipeableRow extends Component {
// </RectButton>
// );
// };
state
=
{
isVisible
:
false
,
};
renderRightActions
=
(
progress
,
dragX
)
=>
{
const
scale
=
dragX
.
interpolate
({
inputRange
:
[
-
80
,
0
],
...
...
@@ -75,21 +79,48 @@ class SwipeableRow extends Component {
extrapolate
:
'clamp'
,
});
return
(
<
RectButton
style
=
{
styles
.
rightAction
}
onPress
=
{
this
.
close
}
>
<
AnimatedIcon
name
=
"delete-forever"
size
=
{
30
}
color
=
"#fff"
style
=
{[
styles
.
actionIcon
,
{
transform
:
[{
scale
}]
}]}
/
>
<
/RectButton
>
<>
<
RectButton
style
=
{
styles
.
rightAction
}
onPress
=
{
this
.
cfDelete
}
>
<
AnimatedIcon
name
=
"delete-forever"
size
=
{
30
}
color
=
"#fff"
style
=
{[
styles
.
actionIcon
,
{
transform
:
[{
scale
}]
}]}
/
>
<
/RectButton
>
<
Overlay
borderRadius
=
{
20
}
height
=
{
'25%'
}
width
=
{
'90%'
}
overlayStyle
=
{
styles
.
cfDelOverlay
}
isVisible
=
{
this
.
state
.
isVisible
}
onBackdropPress
=
{()
=>
this
.
setState
({
isVisible
:
false
})}
>
<
Text
style
=
{
styles
.
cfDelText
}
>
Are
you
sure
you
want
to
delete
this
item
?
<
/Text
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
}}
>
<
Button
transparent
style
=
{{
width
:
'40%'
}}
onPress
=
{
this
.
cancel
}
>
<
Text
style
=
{{
color
:
color
.
timerGrey
}}
>
Cancel
<
/Text
>
<
/Button
>
<
Button
style
=
{
styles
.
delBtn
}
onPress
=
{
this
.
delete
}
>
<
Text
>
Delete
<
/Text
>
<
/Button
>
<
/View
>
<
/Overlay
>
<
/
>
);
};
updateRef
=
ref
=>
{
this
.
_swipeableRow
=
ref
;
};
c
los
e
=
()
=>
{
c
fDelet
e
=
()
=>
{
this
.
_swipeableRow
.
close
();
this
.
setState
({
isVisible
:
true
});
};
cancel
=
()
=>
{
this
.
setState
({
isVisible
:
false
});
};
delete
=
()
=>
{
this
.
setState
({
isVisible
:
false
});
};
render
()
{
...
...
@@ -165,4 +196,23 @@ const styles = StyleSheet.create({
fontFamily
:
'Avenir-Roman'
,
color
:
'#9b9b9b'
,
},
delBtn
:
{
width
:
'40%'
,
backgroundColor
:
'#ee5454'
,
color
:
'white'
,
justifyContent
:
'center'
,
borderRadius
:
9
,
},
cfDelText
:
{
marginHorizontal
:
30
,
textAlign
:
'center'
,
color
:
color
.
grey3
,
fontSize
:
18
,
fontFamily
:
'Avenir-Roman'
,
},
cfDelOverlay
:
{
padding
:
20
,
alignItems
:
'center'
,
justifyContent
:
'space-around'
,
},
});
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