Skip to content

fix: 修复react-native-fast-image引用问题#2423

Merged
hiyuki merged 5 commits intomasterfrom
bugfix-fast-image-require
Feb 3, 2026
Merged

fix: 修复react-native-fast-image引用问题#2423
hiyuki merged 5 commits intomasterfrom
bugfix-fast-image-require

Conversation

@Blackgan3
Copy link
Collaborator

  • 修复 react-native-fast-image 引用问题

const Component: React.ComponentType<ImageProps | FastImageProps> = enableFastImage ? require('@d11/react-native-fast-image') : Image
const FastImageModule = enableFastImage ? require('@d11/react-native-fast-image') : null
const FastImage = FastImageModule && FastImageModule.default ? FastImageModule.default : FastImageModule
const Component: React.ComponentType<ImageProps | FastImageProps> = enableFastImage && FastImage ? FastImage : Image
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

写得好麻烦啊

let Component = Image
if(enableFastImage) {
const fastImageModule = require('@d11/react-native-fast-image')
Component = fastImageModule.default || fastImageModule
}

// eslint-disable-next-line @typescript-eslint/no-var-requires
const FastImage = require('@d11/react-native-fast-image')
const FastImageModule = require('@d11/react-native-fast-image')
const FastImage = FastImageModule && FastImageModule.default ? FastImageModule.default : FastImageModule
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const fastImageModule = require('@d11/react-native-fast-image')
Component = fastImageModule.default || fastImageModule

@hiyuki hiyuki merged commit d30fb97 into master Feb 3, 2026
6 checks passed
@hiyuki hiyuki deleted the bugfix-fast-image-require branch February 3, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants