File tree Expand file tree Collapse file tree 3 files changed +19
-9
lines changed Expand file tree Collapse file tree 3 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " react-native-gesture-image-viewer " : patch
3+ ---
4+
5+ fix: resolve Metro bundler error for optional FlashList dependency (cherry pick)
6+
7+ - Separate optional library imports into dedicated file
8+ - Fix "Requiring unknown module" error when FlashList is not installed
Original file line number Diff line number Diff line change 1+ export let FlashList : any = null ;
2+
3+ try {
4+ FlashList = require ( '@shopify/flash-list' ) . FlashList ;
5+ } catch {
6+ FlashList = null ;
7+ }
Original file line number Diff line number Diff line change 11import { FlatList as RNFlatList , ScrollView as RNScrollView } from 'react-native' ;
22import { FlatList as GestureFlatList , ScrollView as GestureScrollView } from 'react-native-gesture-handler' ;
3- import type { FlatListComponent , ScrollViewComponent } from './types' ;
3+ import type { FlatListComponent , ScrollViewComponent } from '../types' ;
4+ import { FlashList } from './FlashList' ;
45
56export const isScrollViewLike = ( component : React . ComponentType < any > ) : component is ScrollViewComponent => {
67 return component === RNScrollView || component === GestureScrollView ;
@@ -15,14 +16,8 @@ export const isFlatListLike = (component: React.ComponentType<any>): component i
1516} ;
1617
1718export const isFlashListLike = ( component : React . ComponentType < any > ) : boolean => {
18- try {
19- const FlashList = require ( '@shopify/flash-list' ) ?. FlashList ;
20-
21- if ( FlashList && component === FlashList ) {
22- return true ;
23- }
24- } catch {
25- // do nothing
19+ if ( FlashList && component === FlashList ) {
20+ return true ;
2621 }
2722
2823 return component ?. displayName === 'FlashList' || component ?. name === 'FlashList' ;
You can’t perform that action at this time.
0 commit comments