File tree 2 files changed +17
-10
lines changed
react-native/components/createStackRoutingComponent/Card 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -24,17 +24,14 @@ export const Card: React.FunctionComponent<
24
24
return (
25
25
< Swipeable
26
26
ref = { ref }
27
+ enabled = { allowsSwiping }
27
28
childrenContainerStyle = { styles . swipeableChildrenContainer }
28
- { ...( allowsSwiping
29
- ? {
30
- renderLeftActions : ( ) => < View style = { styles . leftActionsView } /> ,
31
- onSwipeableLeftOpen ( ) {
32
- onBack ( pop , ( ) => {
33
- ref . current ?. close ( ) ;
34
- } ) ;
35
- } ,
36
- }
37
- : { } ) }
29
+ renderLeftActions = { ( ) => < View style = { styles . leftActionsView } /> }
30
+ onSwipeableLeftOpen = { ( ) => {
31
+ onBack ( pop , ( ) => {
32
+ ref . current ?. close ( ) ;
33
+ } ) ;
34
+ } }
38
35
>
39
36
{ children }
40
37
</ Swipeable >
Original file line number Diff line number Diff line change @@ -25,10 +25,19 @@ test(`renders as expected when disallowing swiping`, () => {
25
25
children : `Example Children` ,
26
26
} ,
27
27
} ) ,
28
+ renderLeftActions : expect . any ( Function ) ,
29
+ onSwipeableLeftOpen : expect . any ( Function ) ,
30
+ enabled : false ,
28
31
} ,
29
32
} ) ,
30
33
} ) ;
31
34
35
+ expect (
36
+ ( renderer . toTree ( ) ?. rendered as TestRenderer . ReactTestRendererTree ) . props [
37
+ `renderLeftActions`
38
+ ] ( )
39
+ ) . toEqual ( < View style = { { width : `100%` } } /> ) ;
40
+
32
41
expect ( pop ) . not . toHaveBeenCalled ( ) ;
33
42
expect ( onBack ) . not . toHaveBeenCalled ( ) ;
34
43
expect (
@@ -62,6 +71,7 @@ test(`renders as expected when allowing swiping`, () => {
62
71
} ) ,
63
72
renderLeftActions : expect . any ( Function ) ,
64
73
onSwipeableLeftOpen : expect . any ( Function ) ,
74
+ enabled : true ,
65
75
} ,
66
76
} ) ,
67
77
} ) ;
You can’t perform that action at this time.
0 commit comments