跳到主要內容

ImageBackground

從熟悉網頁開發的開發者而來的常見功能請求是 background-image。為了處理這個用例,您可以使用 <ImageBackground> 組件,它具有與 <Image> 相同的 props,並在之上添加您想要疊加的任何子元素。

在某些情況下,您可能不想使用 <ImageBackground>,因為它的實作很基礎。請參考 <ImageBackground>原始碼以獲得更深入的了解,並在需要時建立您自己的自訂組件。

請注意,您必須指定一些寬度和高度樣式屬性。

範例


參考

Props

Image Props

繼承自 Image Props


imageStyle

類型
圖片樣式

imageRef

允許設定內部 Image 組件的參考

類型
參考

style

類型
View 樣式