如何将Stack.Screen
中的内容包括标头垂直居中?
[当前,如果我尝试使元素在屏幕上垂直居中,由于Stack.Screen
标头,它会稍微移到屏幕底部。我想在不使用Stack.Screen
的情况下计算此大小,其中margin-top: -N
是标题的大小。
为什么没有边距?因为它增加了处理iOS和Android设备的复杂性。
navigator.component.tsx
N
sign.in.component.tsx
<Stack.Navigator>
<Stack.Screen
name='SignIn'
component={SignInComponent}
/>
</Stack.Navigator>
const SignInComponent = () => {
return (
<View style={{ height: '100%', justifyContent: 'center' }}>
<Text>Example</Text>
</View>
)
}
为什么没有边距?因为它增加了处理iOS和Android设备的复杂性。