Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/27.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.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
Reactjs Expo错误:无法读取属性';状态栏高度';空的_Reactjs_React Native_Expo - Fatal编程技术网

Reactjs Expo错误:无法读取属性';状态栏高度';空的

Reactjs Expo错误:无法读取属性';状态栏高度';空的,reactjs,react-native,expo,Reactjs,React Native,Expo,如何在Expov34.0.0中修复此错误 在Expo中,您不能再直接从“Expo”导入,因此更改为(旧方式): 至(更新方式): 同样,如果使用以下功能,请使用此格式: import MapView from 'react-native-maps'; import * as Location from 'expo-location'; import * as Permissions from 'expo-permissions'; import { DeviceMotion } from

如何在Expov34.0.0中修复此错误


在Expo中,您不能再直接从“Expo”导入,因此更改为(旧方式):

至(更新方式):

同样,如果使用以下功能,请使用此格式:

import MapView from 'react-native-maps';

import * as Location from 'expo-location';

import * as Permissions from 'expo-permissions';

import { DeviceMotion } from 'expo-sensors';
这很有帮助

如果您正在使用在线Expo编辑器,系统将提示您安装软件包,因此只需单击“确定”。否则,请运行:

expo install expo-constants

Expo将他们以前加入的许多库分开,而
常量
就是其中之一,要现在获取常量,请按照以下步骤操作:

  • 通过在项目目录中运行以下命令来安装
    expo常量
  • 根据需要导入常量,如下所示
  • 按如下方式检索statusBarHeight:
  • 更多关于世博会SDK 34的新文档,请参见

    希望这有帮助

    import MapView from 'react-native-maps';
    
    import * as Location from 'expo-location';
    
    import * as Permissions from 'expo-permissions';
    
    import { DeviceMotion } from 'expo-sensors';
    
    expo install expo-constants
    
    expo install expo-constants
    
    import Constants from 'expo-constants';
    
    const barHeight = Constants.statusBarHeight;