@@ -35,6 +35,47 @@ jest.mock("react-native/Libraries/Image/Image", () => {
3535 } ;
3636} ) ;
3737
38+ jest . mock ( "@d11/react-native-fast-image" , ( ) => {
39+ const React = jest . requireActual ( "react" ) as typeof import ( "react" ) ;
40+ // eslint-disable-next-line @typescript-eslint/no-var-requires
41+ const { resolveAssetSource } = require ( "react-native/Libraries/Image/Image" ) ;
42+ const FastImage = ( {
43+ testID,
44+ style,
45+ source : originalSource ,
46+ resizeMode
47+ } : {
48+ testID : string ;
49+ style : any ;
50+ source : any ;
51+ resizeMode : string ;
52+ } ) : any => {
53+ let source = originalSource ;
54+ try {
55+ if ( typeof originalSource === "number" ) {
56+ const asset = resolveAssetSource ( originalSource ) ;
57+ source = asset ? { height : asset . height , width : asset . width } : { height : 0 , width : 0 } ;
58+ } else if ( originalSource ?. uri ) {
59+ // Dynamic image: use fixed dimensions to match stored snapshots
60+ source = { height : 1111 , width : 2222 } ;
61+ }
62+ } catch ( _ ) {
63+ source = { height : 0 , width : 0 } ;
64+ }
65+ return React . createElement (
66+ "View" ,
67+ { style : [ { overflow : "hidden" } , Array . isArray ( style ) ? style : [ style ] ] } ,
68+ React . createElement ( "FastImageView" , {
69+ testID,
70+ style : { position : "absolute" , top : 0 , left : 0 , right : 0 , bottom : 0 } ,
71+ source,
72+ resizeMode
73+ } )
74+ ) ;
75+ } ;
76+ return { __esModule : true , default : FastImage } ;
77+ } ) ;
78+
3879const onLayoutEventData = {
3980 nativeEvent : {
4081 layout : {
0 commit comments