【发布时间】:2021-02-05 15:31:41
【问题描述】:
我正在尝试在我的 tvOS 应用程序上获取图像。但它没有显示出来。
我的URL 是https,我在Android TV 中使用了相同的代码,它就像一个魅力,当我console.log url 时,它也是完美的。
遵循以下行为:
“粉红色”图像是fast-image。好的,它工作得很好,但是“红色背景”是ImageBackground 并且没有加载图像。两者都使用相同的图像存储库。
按照下面的代码:
<ImageBackground
source={{
uri: getEnvProperties().BASEURL_IMAGES + banner?.imageBanner,
}}
onError={this.handleError}
style={{ height: getScaledValue(350), width, backgroundColor: 'red' }}>
<LinearGradient
start={{ x: 1, y: 0 }}
end={{ x: 0, y: 0 }}
colors={['rgba(0, 0, 0, 0)', 'rgba(0, 0, 0, 0.5)']}
style={styles.linearGradient}>
//other codes....
</LinearGradient>
</ImageBackground>
onError 事件没有捕获任何错误。
谁知道我能做些什么来解决这个问题?
非常感谢。
【问题讨论】:
-
这是否与您的问题有关:stackoverflow.com/questions/62612812/… ?
-
@SamuliHakoniemi 非常感谢。它解决了我的问题!
标签: react-native tvos imagebackground