2017-08-15 31 views
0

我如何在React Native中制作一个简单的带有黑色背景的ScrollView,其中包含围绕框的20px边框的白色框?使用React Native在ScrollView内部创建完整宽度和高度框

enter image description here

我已经试过

<ScrollView style={{ backgroundColor: '#000', flex: 1 }}> 
    <View style={{ flex: 1, margin: 20, backgroundColor: '#fff' }} 
    <Text>Text</Text> 
    </View> 
</ScrollView> 

,但它不填满屏幕的整个宽度和高度。

回答

0

你应该ScrollView使用填充像这样:

<ScrollView style={{ backgroundColor: '#000', flex: 1, padding: 20}}> 
    <View style={{ flex: 1, backgroundColor: '#fff' }}> 
    <Text>Text</Text> 
    </View> 
</ScrollView> 
相关问题