diff --git a/react-native/components/createStackRoutingComponent/Card/index.tsx b/react-native/components/createStackRoutingComponent/Card/index.tsx index 13807f6..69200d5 100644 --- a/react-native/components/createStackRoutingComponent/Card/index.tsx +++ b/react-native/components/createStackRoutingComponent/Card/index.tsx @@ -24,17 +24,14 @@ export const Card: React.FunctionComponent< return ( , - onSwipeableLeftOpen() { - onBack(pop, () => { - ref.current?.close(); - }); - }, - } - : {})} + renderLeftActions={() => } + onSwipeableLeftOpen={() => { + onBack(pop, () => { + ref.current?.close(); + }); + }} > {children} diff --git a/react-native/components/createStackRoutingComponent/Card/unit.tsx b/react-native/components/createStackRoutingComponent/Card/unit.tsx index a0a60a4..db45353 100644 --- a/react-native/components/createStackRoutingComponent/Card/unit.tsx +++ b/react-native/components/createStackRoutingComponent/Card/unit.tsx @@ -25,10 +25,19 @@ test(`renders as expected when disallowing swiping`, () => { children: `Example Children`, }, }), + renderLeftActions: expect.any(Function), + onSwipeableLeftOpen: expect.any(Function), + enabled: false, }, }), }); + expect( + (renderer.toTree()?.rendered as TestRenderer.ReactTestRendererTree).props[ + `renderLeftActions` + ]() + ).toEqual(); + expect(pop).not.toHaveBeenCalled(); expect(onBack).not.toHaveBeenCalled(); expect( @@ -62,6 +71,7 @@ test(`renders as expected when allowing swiping`, () => { }), renderLeftActions: expect.any(Function), onSwipeableLeftOpen: expect.any(Function), + enabled: true, }, }), });