Skip to main content

ImageBackground

熟悉 Web 的开发者的常见功能请求是 background-image。为了处理这个用例,你可以使用 <ImageBackground> 组件,它具有与 <Image> 相同的 props,并添加你想要在其之上分层的任何子组件。

¥A common feature request from developers familiar with the web is background-image. To handle this use case, you can use the <ImageBackground> component, which has the same props as <Image>, and add whatever children to it you would like to layer on top of it.

在某些情况下你可能不想使用 <ImageBackground>,因为实现是基本的。请参阅 <ImageBackground>源代码 了解更多信息,并在需要时创建你自己的自定义组件。

¥You might not want to use <ImageBackground> in some cases, since the implementation is basic. Refer to <ImageBackground>'s source code for more insight, and create your own custom component when needed.

请注意,你必须指定一些宽度和高度样式属性。

¥Note that you must specify some width and height style attributes.

示例

¥Example


参考

¥Reference

属性

¥Props

图片属性

¥Image Props

继承 图片属性

¥Inherits Image Props.


imageStyle

类型
Image 样式

imageRef

允许设置对内部 Image 组件的引用

¥Allows to set a reference to the inner Image component

类型
引用

style

类型
View 样式