React native 在ScrollView中滚动不工作(React Native)
同一个问题我已经见过很多次了,但我发现没有一个解决方案适合我 返回部分React native 在ScrollView中滚动不工作(React Native),react-native,expo,React Native,Expo,同一个问题我已经见过很多次了,但我发现没有一个解决方案适合我 返回部分 <View style={styles.root}> <ScrollView contentContainerStyle={{ flexGrow: 1 }} scrollEnabled={true}> <View style={styles.dpArea}> <Image source={{
<View style={styles.root}>
<ScrollView contentContainerStyle={{ flexGrow: 1 }} scrollEnabled={true}>
<View style={styles.dpArea}>
<Image
source={{
uri: "URI GOES HERE",
}}
style={{ width: "100%", height: "100%" }}
resizeMode="contain"
/>
</View>
<View style={styles.nameArea}>
<View style={{ flex: 8, alignItems: "center" }}>
<Text style={styles.nameText}> {nameUpper}</Text>
</View>
<View style={{ flex: 2, paddingLeft: 10 }}>
<MaterialIcons name="edit" size={24} color="gray" />
</View>
</View>
<View style={styles.emailArea}>
<Text
style={{
fontFamily: "Reg",
fontSize: 12,
color: "gray",
marginRight: 4,
}}
>
Logged in using
</Text>
<Text style={{ fontFamily: "Reg", fontSize: 12 }}>{email}</Text>
</View>
<View style={styles.statsArea}>
<StatsContainer text="STAT 1" number="41" />
<StatsContainer text="STAT 2" number="93" />
</View>
<View style={styles.feedbackArea}>
<Text style={{ fontFamily: "Bold", fontSize: 12, color: "gray" }}>
Send feedbacks, feature requests or report bugs:
</Text>
<FeedbackArea content={feedback} />
</View>
<View style={styles.logoutArea}>
<GenButton content="LOGOUT" />
<DeleteAcButton content="DELETE ACCOUNT" />
</View>
<View style={styles.madeByArea}>
<Text style={styles.madebyText}>Developed by:</Text>
</View>
</ScrollView>
</View>
我尝试过的:使scrollview成为父组件,在根视图中包装scrollview,在contentContainerStyle中flex&flexGrow=1,在scrollview样式参数中flex&flexGrow=1 我所观察到的是,如果我将任何文本的字体大小更改为300,则scroll可以工作,但并非所有组件都被呈现,然而,使用正常字体大小,即使页面超过屏幕大小,也没有滚动
我认为这是由于样式表的配置方式造成的,但我无法找到错误。dpArea类的溢出隐藏属性,删除该属性是否有任何影响?@espressobens感谢您的输入。我试着移除它,同时也移除了返回中的整个DPR区域。它仍然没有滚动。
root: {
flex: 1,
},
dpArea: {
height: "30%",
marginTop: 20,
overflow: "hidden",
alignItems: "center",
justifyContent: "center",
},
nameArea: {
height: "10%",
flexDirection: "row",
justifyContent: "space-around",
alignItems: "center",
},
emailArea: { height: "10%", flexDirection: "row", justifyContent: "center" },
statsArea: { flexDirection: "row", height: "20%", marginBottom: "10%" },
feedbackArea: { height: "20%", marginHorizontal: "5%" },
logoutArea: {
width: "100%",
justifyContent: "space-around",
alignItems: "center",
height: "30%",
marginVertical: "5%",
},
madeByArea: {
height: "10%",
justifyContent: "flex-end",
alignItems: "center",
marginBottom: 3,
},
madebyText: {
fontFamily: "Reg",
fontSize: 12,
color: "gray",
},
nameText: {
fontFamily: "Bold",
fontSize: 30,
},