Skip to content

Commit 1a43ee5

Browse files
authored
fix: prefer Image.resolveAssetSource over direct import (#80)
1 parent 93c4206 commit 1a43ee5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

useResponsiveImageView.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import { Image } from 'react-native';
3-
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
43

54
// A cancelable version of Image.getSize, adapted from
65
// https://github.com/kodefox/react-native-flex-image
@@ -117,7 +116,7 @@ function useResponsiveImageView({
117116
);
118117
} else {
119118
// Retrieve image dimensions from imported resource
120-
const imageSource = resolveAssetSource(initialSource);
119+
const imageSource = Image.resolveAssetSource(initialSource);
121120
if (imageSource && imageSource.width && imageSource.height) {
122121
const { width, height } = imageSource;
123122
handleImageSizeSuccess(width, height);

0 commit comments

Comments
 (0)