File tree Expand file tree Collapse file tree
apps/common-app/src/components/scrollview
packages/react-native-gesture-handler/src/v3/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import React , { useState } from 'react' ;
1+ import React , { useRef , useState } from 'react' ;
22import { Text , StyleSheet , View } from 'react-native' ;
3- import { ScrollView , RefreshControl } from 'react-native-gesture-handler' ;
3+ import {
4+ ScrollView ,
5+ RefreshControl ,
6+ GHScrollViewRef ,
7+ } from 'react-native-gesture-handler' ;
48
59const DATA = Array . from ( { length : 20 } , ( _ , i ) => ( {
610 id : i . toString ( ) ,
@@ -16,8 +20,11 @@ const Item = ({ title }: { title: string }) => (
1620export default function ScrollViewExample ( ) {
1721 const [ refreshing , setRefreshing ] = useState ( false ) ;
1822
23+ const ref = useRef < GHScrollViewRef > ( null ) ;
24+
1925 const onRefresh = ( ) => {
2026 setRefreshing ( true ) ;
27+ console . log ( ref . current ) ;
2128 setTimeout ( ( ) => {
2229 setRefreshing ( false ) ;
2330 } , 1500 ) ;
@@ -26,6 +33,7 @@ export default function ScrollViewExample() {
2633 return (
2734 < ScrollView
2835 contentContainerStyle = { styles . container }
36+ ref = { ref }
2937 refreshControl = {
3038 < RefreshControl refreshing = { refreshing } onRefresh = { onRefresh } />
3139 } >
Original file line number Diff line number Diff line change @@ -48,7 +48,8 @@ const GHScrollView = createNativeWrapper<PropsWithChildren<RNScrollViewProps>>(
4848 DetectorType . Intercepting
4949) ;
5050
51- type ImperativeScrollViewRef = ComponentWrapperRef < RNScrollViewProps > | null ;
51+ export type ImperativeScrollViewRef =
52+ ComponentWrapperRef < RNScrollViewProps > | null ;
5253
5354export const ScrollView = (
5455 props : RNScrollViewProps &
Original file line number Diff line number Diff line change @@ -21,4 +21,7 @@ export {
2121 RefreshControl ,
2222} from './GestureComponents' ;
2323
24- export type { ImperativeFlatListRef as GHFlatListRef } from './GestureComponents' ;
24+ export type {
25+ ImperativeScrollViewRef as GHScrollViewRef ,
26+ ImperativeFlatListRef as GHFlatListRef ,
27+ } from './GestureComponents' ;
You can’t perform that action at this time.
0 commit comments