【问题标题】:React Native. ScrollView Height反应原生。滚动视图高度
【发布时间】:2019-09-17 10:11:20
【问题描述】:

我正在尝试将滚动视图的高度设置为屏幕高度的 72.5%。如果我在周围加上边框,我可以看到边框表明这是正确的。但是,如果我在 ScrollView 中插入一些东西,则里面的元素比预期的要小得多。它的高度也成正比(22%)。我在 ScrollView 中输入的东西越多,这些元素就越大(即滚动视图的内容越来越大,因此里面的元素正在缩放)。我不想要这个,我希望元素是固定 72.5% 的 22%。我尝试插入一个 100% 的滚动高度的视图(尽管边框显示它渲染得更少),我尝试了各种不同的包装视图并尝试直接将高度设置为滚动视图,但这些似乎都没有修复它。有什么建议么?提前致谢。

<View style={{ width: "100%", height: "72.5%", flexDirection: "column" }}>
   <View style={{width:"100%", height:"100%"}}>     
     <ScrollView  showsVerticalScrollIndicator={false} style={{ width: "100%", height:"100%", flexDirection: "column" ,borderWidth:2}}>
         <View style={{width:"100%", height:"100%", borderWidth:2}}>
             <Bio height={"22%"} plays={10} audience={10} ownUsername={"TestUser"}/>
             <Bio height={"22%"} plays={10} audience={10} ownUsername={"TestUser"}/>
         </View>
     </ScrollView>
   </View> 
 </View>

【问题讨论】:

    标签: react-native scrollview


    【解决方案1】:

    很难理解你的问题,但如果我认为是这样的话......请查看React Native Documentation on contentContainerStyle of a ScrollView

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-14
      • 1970-01-01
      • 2017-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多