This is my component code and my style code:
function StartGameScreen() {
return (
<View style={styles.inputContainer}>
<TextInput
style={styles.numberInput}
maxLength={2}
keyboardType="number-pad"
autoCapitalize="none"
autoCorrect={false}
/>
<PrimaryButton>Reset</PrimaryButton>
<PrimaryButton>Confirm</PrimaryButton>
</View>
);
}
const styles = StyleSheet.create({
inputContainer: {
backgroundColor: "#ff6868",
marginTop: 100,
padding: 16,
marginHorizontal: 24,
borderRadius: 8,
shadowColor: "black",
shadowOffset: { width: 0, height: 2 },
shadowRadius: 6,
shadowOpacity: 0.25,
},
numberInput: {
height: 50,
width: 50,
fontSize: 32,
borderBottomColor: "yellow",
borderBottomWidth: 2,
color: "yellow",
marginVertical: 8,
fontWeight: "bold",
textAlign: "center",
},
});
And this picture is a result when I rendered:
But when I change View to ScrollView, it rendered to this (View component to ScrollView):
I'm curious that I used the same style elements but I got different result.


Wrapping your
ScrollViewinsideSafeAreaViewwill fix this issue for you.It's happening because your
ScrollViewwill take whatever height is available to it and by default it is100%.Another, solution could be to wrap your container
Viewinside of aScrollView.