它是一個愚蠢的問題,但我有問題,我試圖適應圖像到它的容器。圖像溢出寬度:如何使用flexbox將React Native圖像放入其容器中?
代碼:
<View style = {styles.imageContainer}>
<Image style={styles.img} source={require('./img_1.png')} />
</View>
<View style={styles.banner}>
<ScrollView >
<Text>Hellp Boy</Text>
<Text>Hellp Boy</Text>
<Text>Hellp Boy</Text>
</ScrollView>
</View>
和造型部分:
const styles = StyleSheet.create({
imageContainer: {
backgroundColor : '#DB7093',
flex : 1,
padding : 10,
borderColor : '#7FFF00',
borderWidth : 10,
},
img : {
flex : 1 ,
resizeMode : 'stretch',
overflow : 'visible',
},
banner:
{
flex : 2,
padding : 10,
borderColor : '#7FFF00',
borderWidth : 10,
},
});
之前也試了一下,亙古不變的工作。 :( – user3473788