【问题标题】:Scroll View not working on android pixel simulator, but its working on ios devices and simulator滚动视图不适用于 android 像素模拟器,但它适用于 ios 设备和模拟器
【发布时间】:2020-03-20 02:49:18
【问题描述】:
    return (
    <View style={{
        flexGrow: 1,
        flex: 1,
        height: Dimensions.get('window').height,
        flexDirection: 'column',
    }}> 
    <ScrollView horizontal={false} contentContainerStyle={{flexGrow: 1}} >

        {<View style={{
            flex: 1
        }}>
            <LocationPicker navigation={this.props.navigation} onLocationPicked={this.locationPickedHandler}/>
        </View>}
        </ScrollView>
    </View>);```

我试过设置 height, flex: 1, flexGrow: 1 除了运气不好

谁能帮我解决这个问题?

【问题讨论】:

    标签: android css react-native flexbox


    【解决方案1】:

    React 原生的 ScrollView 有一个水平属性,当设置为 true 时,它​​的子元素会排成一行。

       return (
        <View style={{
            flex: 1,
            height: Dimensions.get('window').height,
            flexDirection: 'column',
        }}> 
        <ScrollView horizontal={false} contentContainerStyle={{flexGrow: 1}} >
    
            <View style={{
                flex: 1
            }}>
                <LocationPicker navigation={this.props.navigation} onLocationPicked={this.locationPickedHandler}/>
            </View>
            </ScrollView>
        </View>);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-18
      • 1970-01-01
      • 2021-02-15
      • 1970-01-01
      • 2012-11-01
      • 2011-03-08
      相关资源
      最近更新 更多