File tree Expand file tree Collapse file tree 1 file changed +26
-12
lines changed Expand file tree Collapse file tree 1 file changed +26
-12
lines changed Original file line number Diff line number Diff line change 1- import type React from 'react' ;
2- import { findNodeHandle as _findNodeHandle } from 'react-native' ;
1+ import {
2+ type NodeHandle ,
3+ findNodeHandle as _findNodeHandle ,
4+ } from 'react-native' ;
35
46export function findNodeHandle (
5- componentOrHandle :
6- | null
7- | number
8- // biome-ignore lint/suspicious/noExplicitAny: fix later
9- | React . Component < any , any >
10- // biome-ignore lint/suspicious/noExplicitAny: fix later
11- | React . ComponentClass < any >
7+ componentOrHandle : Parameters < typeof _findNodeHandle > [ '0' ]
128) {
9+ let nodeHandle : NodeHandle | null ;
10+ try {
11+ nodeHandle = _findNodeHandle ( componentOrHandle ) ;
12+ if ( nodeHandle ) {
13+ return nodeHandle ;
14+ }
15+ } catch { }
16+
1317 try {
14- return _findNodeHandle ( componentOrHandle ) ;
15- } catch {
1618 // @ts -ignore
17- return componentOrHandle . getNativeScrollRef ( ) ;
19+ nodeHandle = componentOrHandle . getNativeScrollRef ( ) ;
20+ if ( nodeHandle ) {
21+ return nodeHandle ;
22+ }
23+ } catch { }
24+
25+ // @ts -ignore https://github.com/facebook/react-native/blob/a314e34d6ee875830d36e4df1789a897c7262056/packages/virtualized-lists/Lists/VirtualizedList.js#L1252
26+ nodeHandle = componentOrHandle . _scrollRef ;
27+ if ( nodeHandle ) {
28+ return nodeHandle ;
1829 }
30+
31+ console . warn ( 'could not find scrollable ref!' ) ;
32+ return componentOrHandle ;
1933}
You can’t perform that action at this time.
0 commit comments