Open stuart-responsible opened 3 days ago
Hello, I would say that the issue is probably with react-native-gesture-detector. We didn't experience this problem. Do you you use the latest version? If the problem persists, you can use scrollContainerProps={{hitSlop: undefined}} and it should work.
@LukasFridmansky Thanks for the quick response. We are using the latest version of this package. Unfortunately passing the hitSlop value in the scroll container props object has not worked.
I've tested this on a clean react native expo app and still seem to be getting the error when running tsc. The component itself works fine the issue is only present during type-checking.
❯ npx tsc
node_modules/@birdwingo/react-native-swipe-modal/src/components/SwipeModal/scroll.tsx:21:6 - error TS2322: Type '{ children: ReactNode; testID: string; ref: RefObject<ScrollView>; showsVe
node_modules/@birdwingo/react-native-swipe-modal/src/components/SwipeModal/scroll.tsx:21:6 - error TS2322: Type '{ children: ReactNode; testID: string; ref: RefObject<ScrollView>; showsVerticalScrollIndicator: false; onScrollBeginDrag: () => void; onScroll: (e: NativeSyntheticEvent<...>) => void; ... 137 more ...; persistentScrollbar?: boolean | undefined; }' is not assig
node_modules/@birdwingo/react-native-swipe-modal/src/components/SwipeModal/scroll.tsx:21:6 - error TS2322: Type '{ children: ReactNode; testID: string; ref: RefObject<ScrollView>; showsVerticalScrollIndicator: false; onScrollBeginDrag: () => void; onScroll: (e: NativeSyntheticEvent<...>) => void; ... 137 more ...; persistentScrollbar?: boolean | undefined; }' is not assignable to type 'RestProps<ScrollViewProps & NativeViewGestureHandlerProps & RefAttributes<ScrollView>>'.
Types of property 'hitSlop' are incompatible.
Type 'number | Insets | null | undefined' is not assignable to type '((number | Insets | null) & HitSlop) | SharedValue<((number | Insets | null) & HitSlop) | undefined> | undefined'.
Type 'null' is not assignable to type '((number | Insets | null) & HitSlop) | SharedValue<((number | Insets | null) & HitSlop) | undefined> | undefined'.
21 <AnimatedScrollView
~~~~~~~~~~~~~~~~~~
Found 1 error in node_modules/@birdwingo/react-native-swipe-modal/src/components/SwipeModal/scroll.tsx:21
We are seeing a typescript error when building with this package.
Here is the diff that solved my problem: