【问题标题】:React-Native Background Image - how to repeat horizontally and 100% heightReact-Native 背景图像 - 如何水平重复和 100% 高度
【发布时间】:2019-09-16 11:26:20
【问题描述】:

我需要一个水平重复的背景图像来填充父元素并占据 100% 的高度(不重复)。

我尝试将图像设置为“重复”和高度 100%,但没有成功。有什么建议如何在 react-native 中做到这一点?

<ImageBackground
     source={staticImages.background.image}
     imageStyle={{ resizeMode: 'repeat', height: '100%' }}
     style={{ flex: 1, width: undefined, height: undefined }}
 >
   .....Content

<ImageBackground/>

【问题讨论】:

    标签: reactjs react-native background-image react-native-stylesheet


    【解决方案1】:

    外出resizeMode

    <ImageBackground
     source={staticImages.background.image}
     imageStyle={{ flex: 1 }}
     resizeMode='repeat'
     style={{ flex: 1, width: undefined, height: undefined }}
     >
       .....Content
    
    <ImageBackground/>
    

    【讨论】:

      猜你喜欢
      • 2018-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-09
      • 1970-01-01
      • 2015-09-11
      • 1970-01-01
      相关资源
      最近更新 更多