react-native-swipe-list icon indicating copy to clipboard operation
react-native-swipe-list copied to clipboard

Add ref support and typescript fixes

Open sivantha96 opened this issue 10 months ago • 0 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-swipe-list/dist/SwipeableFlatList.d.ts b/node_modules/react-native-swipe-list/dist/SwipeableFlatList.d.ts
index 2db8d26..6891956 100644
--- a/node_modules/react-native-swipe-list/dist/SwipeableFlatList.d.ts
+++ b/node_modules/react-native-swipe-list/dist/SwipeableFlatList.d.ts
@@ -5,7 +5,7 @@ declare type SwipableListProps<ItemT> = {
     renderRightActions?: (info: ListRenderItemInfo<ItemT>) => React.ReactNode;
     closeOnScroll?: boolean;
 };
-declare type Props<ItemT> = SwipableListProps<ItemT> & FlatListProps<ItemT>;
+declare type Props<ItemT> = SwipableListProps<ItemT> & FlatListProps<ItemT> & { ref?: React.Ref<FlatList<ItemT>> };
 export declare const SwipeableFlatList: <ItemT extends {}>(props: Props<ItemT>) => JSX.Element;
 export {};
 //# sourceMappingURL=SwipeableFlatList.d.ts.map
\ No newline at end of file
diff --git a/node_modules/react-native-swipe-list/dist/SwipeableFlatList.js b/node_modules/react-native-swipe-list/dist/SwipeableFlatList.js
index e1abb50..90b16b7 100644
--- a/node_modules/react-native-swipe-list/dist/SwipeableFlatList.js
+++ b/node_modules/react-native-swipe-list/dist/SwipeableFlatList.js
@@ -10,8 +10,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
 const react_1 = __importStar(require("react"));
 const react_native_1 = require("react-native");
 const SwipeableRow_1 = require("./SwipeableRow");
-exports.SwipeableFlatList = (props) => {
+exports.SwipeableFlatList = react_1.forwardRef((props, _flatListRef1) => {
     const _flatListRef = react_1.useRef();
+    react_1.useImperativeHandle(_flatListRef1, () => _flatListRef.current);
     const [isScrolling, setScrolling] = react_1.useState(false);
     const _onScrollBeginDrag = (e) => {
         // Close any opens rows on ListView scroll
@@ -36,4 +37,4 @@ exports.SwipeableFlatList = (props) => {
                 _flatListRef.current = ref;
             }
         }, onScrollBeginDrag: _onScrollBeginDrag, onScrollEndDrag: _onScrollEndDrag, renderItem: _renderItem })));
-};
+})
diff --git a/node_modules/react-native-swipe-list/dist/SwipeableQuickActions.d.ts b/node_modules/react-native-swipe-list/dist/SwipeableQuickActions.d.ts
index a378ce0..4f9b8ae 100644
--- a/node_modules/react-native-swipe-list/dist/SwipeableQuickActions.d.ts
+++ b/node_modules/react-native-swipe-list/dist/SwipeableQuickActions.d.ts
@@ -2,6 +2,7 @@ import React from 'react';
 import { StyleProp, ViewStyle } from 'react-native';
 declare type Props = {
     style?: StyleProp<ViewStyle>;
+    children: React.ReactNode;
 };
 export declare const SwipeableQuickActions: React.FC<Props>;
 export {};

This issue body was partially generated by patch-package.

sivantha96 avatar Sep 06 '23 06:09 sivantha96