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
aed87281
Commit
aed87281
authored
Jul 30, 2019
by
Tonk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update open only one swipeable
parent
f31bc19c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
23 deletions
+17
-23
components/SwipeableRow.js
+8
-22
screens/Private/TimerScreen/TimerScreen.js
+9
-1
No files found.
components/SwipeableRow.js
View file @
aed87281
...
@@ -63,23 +63,6 @@ const Row = ({ data }) => (
...
@@ -63,23 +63,6 @@ const Row = ({ data }) => (
);
);
class
SwipeableRow
extends
Component
{
class
SwipeableRow
extends
Component
{
// renderLeftActions = (progress, dragX) => {
// const scale = dragX.interpolate({
// inputRange: [0, 80],
// outputRange: [0, 1],
// extrapolate: 'clamp',
// });
// return (
// <RectButton style={styles.leftAction} onPress={this.close}>
// <AnimatedIcon
// name="archive"
// size={30}
// color="#fff"
// style={[styles.actionIcon, { transform: [{ scale }] }]}
// />
// </RectButton>
// );
// };
selectedRow
=
null
;
selectedRow
=
null
;
state
=
{
state
=
{
isVisible
:
false
,
isVisible
:
false
,
...
@@ -123,8 +106,9 @@ class SwipeableRow extends Component {
...
@@ -123,8 +106,9 @@ class SwipeableRow extends Component {
<
/
>
<
/
>
);
);
};
};
updateRef
=
ref
=>
{
updateRef
=
instance
=>
{
this
.
_swipeableRow
=
ref
;
this
.
_swipeableRow
=
instance
;
this
.
swipeInstance
=
instance
;
};
};
cfDelete
=
()
=>
{
cfDelete
=
()
=>
{
this
.
_swipeableRow
.
close
();
this
.
_swipeableRow
.
close
();
...
@@ -137,17 +121,19 @@ class SwipeableRow extends Component {
...
@@ -137,17 +121,19 @@ class SwipeableRow extends Component {
this
.
setState
({
isVisible
:
false
});
this
.
setState
({
isVisible
:
false
});
};
};
_onSwipeOpen
=
()
=>
{
this
.
props
.
onSwipeOpen
(
this
.
swipeInstance
);
};
render
()
{
render
()
{
return
(
return
(
<
Swipeable
<
Swipeable
ref
=
{
this
.
updateRef
}
ref
=
{
this
.
updateRef
}
friction
=
{
2
}
friction
=
{
2
}
// leftThreshold={80}
rightThreshold
=
{
40
}
rightThreshold
=
{
40
}
// renderLeftActions={this.renderLeftActions}
renderRightActions
=
{
this
.
renderRightActions
}
renderRightActions
=
{
this
.
renderRightActions
}
containerStyle
=
{{
backgroundColor
:
color
.
primary
}}
containerStyle
=
{{
backgroundColor
:
color
.
primary
}}
onSwipeableWillOpen
=
{
this
.
_onSwipeOpen
}
>
>
<
Row
data
=
{
this
.
props
.
item
}
/
>
<
Row
data
=
{
this
.
props
.
item
}
/
>
<
/Swipeable
>
<
/Swipeable
>
...
...
screens/Private/TimerScreen/TimerScreen.js
View file @
aed87281
...
@@ -363,7 +363,13 @@ export default class TimerScreen extends Component {
...
@@ -363,7 +363,13 @@ export default class TimerScreen extends Component {
<
/Fab
>
<
/Fab
>
);
);
};
};
_onSwipeOpen
=
swipeInstance
=>
{
if
(
this
.
currentlyOpenSwipe
&&
this
.
currentlyOpenSwipe
!==
swipeInstance
)
{
this
.
currentlyOpenSwipe
.
close
();
}
this
.
currentlyOpenSwipe
=
swipeInstance
;
};
render
()
{
render
()
{
return
(
return
(
<>
<>
...
@@ -396,7 +402,9 @@ export default class TimerScreen extends Component {
...
@@ -396,7 +402,9 @@ export default class TimerScreen extends Component {
)}
)}
ItemSeparatorComponent
=
{()
=>
<
View
style
=
{
styles
.
separator
}
/>
}
ItemSeparatorComponent
=
{()
=>
<
View
style
=
{
styles
.
separator
}
/>
}
ListFooterComponent
=
{()
=>
item
.
timer
.
length
>
0
&&
<
View
style
=
{
styles
.
separator
}
/>
}
ListFooterComponent
=
{()
=>
item
.
timer
.
length
>
0
&&
<
View
style
=
{
styles
.
separator
}
/>
}
renderItem
=
{({
item
,
index
})
=>
<
SwipeableRow
item
=
{
item
}
index
=
{
index
}
/>
}
renderItem
=
{({
item
,
index
})
=>
(
<
SwipeableRow
item
=
{
item
}
index
=
{
index
}
onSwipeOpen
=
{
this
.
_onSwipeOpen
}
/
>
)}
keyExtractor
=
{(
item
,
index
)
=>
`timer
${
index
}
`
}
keyExtractor
=
{(
item
,
index
)
=>
`timer
${
index
}
`
}
/
>
/
>
<
/Tab
>
<
/Tab
>
...
...
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