0
這是我的代碼。我希望產品視圖佔用其父項的90%寬度。但是,下面的設置不起作用。反應本地,孩子的寬度百分比
...任何想法如何實現它,而無需使用尺寸?
return (
<LazyloadScrollView
style={styles.container}
contentContainerStyle={styles.content}
name="scrollImage" >
{list.map((product, i) => <View key={i} style={styles.product}>
<LazyloadImage
host="scrollImage"
style={styles.image}
source={image}
animation={false}>
<View style={styles.id}>
<Text style={styles.idText}>{product.id}</Text>
</View>
</LazyloadImage>
</View>)
}
</LazyloadScrollView>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#ffffff'
},
content: {
paddingTop: 20,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#eee'
},
product: {
flex: 0.9,
marginTop: 5,
flexDirection: 'row',
alignItems: 'center',
backgroundColor: '#FFFFFF'
},
不知道'LazyLoadImage'但'Image'必須指定'寬度:null'和'高度:null'如果你想使用'flex' – FuzzyTree
實際上我希望爲其父級的80%寬度,而不是圖像 –
Hammer