Reactnative(expo)内的滚动视图不起作用
Scroll View inside Reactnative (expo) is not working
这是我的代码片段:
return (
<View style={{ backgroundColor: "#FFF", flex: 1 }}>
<ScrollView>
<Image
source={require("../images/image.jpg")}
style={{ width: "100%", height: "60%" }}
/>[![enter image description here][1]][1]
<View
style={{
flexDirection: "row",
alignItems: "center",
marginHorizontal: 55,
borderWidth: 2,
marginTop: 40,
paddingHorizontal: 10,
paddingRight: 30,
borderColor: "#00716F",
borderRadius: 23,
paddingVertical: 2,
}}
>
<Icon name="mail" color="#00716F" size={24} />
<TextInput
style={{ height: 40, width: "100%", paddingLeft: 5 }}
placeholder="Email"
value={email}
onChangeText={setEmail}
autoCapitalize="none"
autoCorrect={false}
/>
</View>
<View
style={{
flexDirection: "row",
alignItems: "center",
marginHorizontal: 55,
borderWidth: 2,
marginTop: 15,
paddingHorizontal: 10,
paddingRight: 30,
borderColor: "#00716F",
borderRadius: 23,
paddingVertical: 2,
}}
>
<Icon name="lock" color="#00716F" size={24} />
<TextInput
style={{ height: 40, width: "100%", paddingLeft: 5 }}
placeholder="Password"
secureTextEntry
value={password}
onChangeText={setPassword}
/>
</View>
<TouchableOpacity onPress={() => signin({ email, password })}>
<View
style={{
marginHorizontal: 55,
alignItems: "center",
justifyContent: "center",
marginTop: 30,
backgroundColor: "#00716F",
paddingVertical: 10,
borderRadius: 23,
}}
>
</View>
</TouchableOpacity>
<NavLink routeName="Signin" text="New User ? Signup Here." />
</ScrollView>
</View>
);
我已经尝试了所有我不知道为什么我的滚动视图不起作用
我有多个 TextInput 元素,但其中只有少数只呈现在屏幕上,其余的 trim。请帮忙
这里附上输出的截图
我正在使用 react-native expo
这是任何包裹问题
帮帮我
尝试如下设置 ScrollView 属性 contentContainerStyle
<ScrollView
contentContainerStyle={{flex:0}}
>
问题已解决
有一个很小的错误
我给了一个元素 -200 的边距
所以它没有滚动
在我删除那个边距之后
工作顺利
这是我的代码片段:
return (
<View style={{ backgroundColor: "#FFF", flex: 1 }}>
<ScrollView>
<Image
source={require("../images/image.jpg")}
style={{ width: "100%", height: "60%" }}
/>[![enter image description here][1]][1]
<View
style={{
flexDirection: "row",
alignItems: "center",
marginHorizontal: 55,
borderWidth: 2,
marginTop: 40,
paddingHorizontal: 10,
paddingRight: 30,
borderColor: "#00716F",
borderRadius: 23,
paddingVertical: 2,
}}
>
<Icon name="mail" color="#00716F" size={24} />
<TextInput
style={{ height: 40, width: "100%", paddingLeft: 5 }}
placeholder="Email"
value={email}
onChangeText={setEmail}
autoCapitalize="none"
autoCorrect={false}
/>
</View>
<View
style={{
flexDirection: "row",
alignItems: "center",
marginHorizontal: 55,
borderWidth: 2,
marginTop: 15,
paddingHorizontal: 10,
paddingRight: 30,
borderColor: "#00716F",
borderRadius: 23,
paddingVertical: 2,
}}
>
<Icon name="lock" color="#00716F" size={24} />
<TextInput
style={{ height: 40, width: "100%", paddingLeft: 5 }}
placeholder="Password"
secureTextEntry
value={password}
onChangeText={setPassword}
/>
</View>
<TouchableOpacity onPress={() => signin({ email, password })}>
<View
style={{
marginHorizontal: 55,
alignItems: "center",
justifyContent: "center",
marginTop: 30,
backgroundColor: "#00716F",
paddingVertical: 10,
borderRadius: 23,
}}
>
</View>
</TouchableOpacity>
<NavLink routeName="Signin" text="New User ? Signup Here." />
</ScrollView>
</View>
);
我已经尝试了所有我不知道为什么我的滚动视图不起作用 我有多个 TextInput 元素,但其中只有少数只呈现在屏幕上,其余的 trim。请帮忙
这里附上输出的截图 我正在使用 react-native expo 这是任何包裹问题 帮帮我
尝试如下设置 ScrollView 属性 contentContainerStyle
<ScrollView
contentContainerStyle={{flex:0}}
>
问题已解决
有一个很小的错误 我给了一个元素 -200 的边距 所以它没有滚动 在我删除那个边距之后 工作顺利