react-native 报错记录

Warning: Failed child context type: Invalid child context virtualizedCell.cellKey of type number supplied to CellRenderer, expected string. #18291

keyExtractor={(item, index) => index.toString()}                         

加个toString()

在调用相机或相册的时候,报错Error: Missing camera or camera roll permission.

expo =>27.0.1

  • 解决方法:把授权相机和相册都调一遍
showCamera = async () => {
        const { status } = await Permissions.askAsync(Permissions.CAMERA);
        const cameraRollPermission = await Permissions.askAsync(Permissions.CAMERA_ROLL);
        if (status === 'granted' && cameraRollPermission.status) {
            let result = await ImagePicker.launchCameraAsync({
                allowsEditing: true,
                aspect: [4, 3],
            });
            let file = { uri: result.uri, type: 'multipart/form-data', name: 'image.jpg' };
            if (!result.cancelled) {
               ......
            }
        }
    }

在安卓上 overFlow:hidden 需要加个zIndex:-1

Module @babel/runtime/helpers/interopRequireDefault does not exist in the Haste module map

-解决方法:

npm install --save-dev @babel/core
npm install --save-dev @babel/runtime
npm add @babel/runtime
npm install

推荐阅读更多精彩内容