【问题标题】:React-Native Image: using blurRadius intermittently hides imageReact-Native Image:使用 blurRadius 间歇性隐藏图像
【发布时间】:2022-07-20 00:59:37
【问题描述】:

使用带有 uri 类型源的 react-native <Image /> 组件和 blurRadius={8} 间歇性地隐藏整个组件。理想情况下,图像每次都会加载模糊效果。没有迹象表明 onLoad、onError、onLoadEnd 或 onLoadStart 道具存在加载错误,但在 iOS 模拟器的发布版本中,该问题似乎较少发生。这使它看起来像是 Metro bundler 问题,或者可能是渲染问题,如果在使用 blurRadius 时 uri 源加载缓慢,则组件无法渲染图像。

我尝试了一个<ImageBackground /> 组件,源对象中的不同“缓存”选项和记忆,但注意到了相同的结果。我在 StackOverflow 或 react-native github repo 上没有看到关于此的其他问题。

这是我在 FlatList 中渲染的相关组件,该组件存在于相当大的代码库中:

<Image
    accessibilityIgnoresInvertColors
    blurRadius={8}
    source={{ uri: imageUrl }}
    style={{
        aspectRatio: 15 / 8,
        position: 'absolute',
        width: '100%',
        zIndex: 0
    }}
    resizeMode="cover"
/>

【问题讨论】:

    标签: javascript react-native


    【解决方案1】:

    能否提供imageUrl的来源?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-13
      • 2019-05-29
      • 1970-01-01
      • 2019-07-16
      • 2016-12-08
      • 2021-03-31
      • 2022-11-25
      相关资源
      最近更新 更多