Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 在react native中滚动时删除iPhone标题_React Native - Fatal编程技术网

React native 在react native中滚动时删除iPhone标题

React native 在react native中滚动时删除iPhone标题,react-native,React Native,每当我用ScrollView组件滚动页面时,iPhone的标题总是跟着我的滚动,看起来很奇怪。有什么建议吗 您可以将marginTop添加到ScrollView <ScrollView style={{marginTop:getStatusBarHeight()}}> .... </ScrollView> .... 要获得所需的状态栏高度,您可以将marginTop添加到ScrollView <ScrollView style={{marginTop:get

每当我用
ScrollView
组件滚动页面时,iPhone的标题总是跟着我的滚动,看起来很奇怪。有什么建议吗


您可以将marginTop添加到ScrollView

<ScrollView style={{marginTop:getStatusBarHeight()}}> 
....
</ScrollView>

....

要获得所需的状态栏高度,您可以将marginTop添加到ScrollView

<ScrollView style={{marginTop:getStatusBarHeight()}}> 
....
</ScrollView>

....

要获取状态栏高度,您需要将屏幕组件包装在SafeAreaView中

从'react native'导入{SafeAreaView}
const MyScreen=()=>{
返回(
{/*您的jsx在这里*/}
)

}
您应该将屏幕组件包装在安全区域视图中

从'react native'导入{SafeAreaView}
const MyScreen=()=>{
返回(
{/*您的jsx在这里*/}
)
}