Skip to content

Commit be85754

Browse files
committed
[feat] Add reanimated scroll view
1 parent 5a2129d commit be85754

File tree

3 files changed

+549
-5
lines changed

3 files changed

+549
-5
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@
6767
"react": "18.2.0",
6868
"react-native": "0.73.4",
6969
"react-native-builder-bob": "^0.20.0",
70+
"react-native-reanimated": "^3.17.5",
7071
"typescript": "^5.5.4"
7172
},
7273
"peerDependencies": {
7374
"react": "*",
74-
"react-native": "*"
75+
"react-native": "*",
76+
"react-native-reanimated": "*"
7577
},
7678
"workspaces": [
7779
"example"
@@ -130,4 +132,4 @@
130132
"directories": {
131133
"example": "example"
132134
}
133-
}
135+
}

src/responsive-grid/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
/* eslint-disable react-native/no-inline-styles */
33

44
import React, { useEffect, useMemo, useRef, useState } from 'react';
5-
import { ScrollView, View } from 'react-native';
5+
import { View } from 'react-native';
66
import type { ResponsiveGridProps, TileItem } from './types';
77
import { calcResponsiveGrid } from './calc-responsive-grid';
88
import type { NativeSyntheticEvent, NativeScrollEvent } from 'react-native';
99
import useThrottle from '../hooks/use-throttle';
10+
import Animated from 'react-native-reanimated';
1011
import { renderPropComponent } from '../libs/render-prop-component';
1112

1213
export const ResponsiveGrid: React.FC<ResponsiveGridProps> = ({
@@ -155,7 +156,7 @@ export const ResponsiveGrid: React.FC<ResponsiveGridProps> = ({
155156
setContainerSize({ width, height });
156157
}}
157158
>
158-
<ScrollView
159+
<Animated.ScrollView
159160
onScroll={onScroll}
160161
contentContainerStyle={{
161162
height: sumScrollViewHeight || '100%',
@@ -195,7 +196,7 @@ export const ResponsiveGrid: React.FC<ResponsiveGridProps> = ({
195196
>
196197
{renderPropComponent(FooterComponent)}
197198
</View>
198-
</ScrollView>
199+
</Animated.ScrollView>
199200
</View>
200201
);
201202
};

0 commit comments

Comments
 (0)