Expo.launchCameraAsync 自定义图像视图?

Expo.launchCameraAsync custom image view?

我正在为我的应用程序创建相机功能,以便在用户拍摄照片后,他们可以重新缩放并围绕边界框移动照片。 Expo 有一个开箱即用的 API 可以满足我的要求:

ImagePicker.launchCameraAsync({ allowsEditing: true, aspect: [4,3] })

但我也希望相机屏幕本身是全屏的,所以顶部和底部没有黑边,我这里有视图:

import { ImagePicker, Camera, Permissions, FileSystem } from 'expo';

    <View style={{ flex: 1 }}>
        <Camera 
            style = {{ flex: 1 }} 
            type  = {this.state.type}
            ref   = {ref => { this.camera = ref }} 
        >
            <View style={camera.container}>
                <TouchableOpacity 
                    style = {this.state.css.touchable}
                    onPress={this.onTap}
                />

                <Button transparent
                    onPress = {this.onSnapShot}
                    style   = {[camera.buttonContainer, this.state.css.button]}
                >
                    <Entypo 
                        name  = 'circle' 
                        size  = {fonts.camera} 
                        color = {colors.wineWhite}
                    />
                </Button>
            </View>
        </Camera>
    </View>

细节并不重要,关键是我可以创建一个 Camera 视图。现在的问题是有没有办法将这个相机视图传递给 launchCameraAsync?文档似乎没有提供解决方案。

我认为这种组合是不可能的。

ImagePicker.launchCameraAsync({ allowsEditing: true, aspect: [4,3] }) 正在调用完整封装的 expo 组件。

如果您想创建自定义视图,您必须自己处理所有状态和 video/photo 操作。

拍照后尝试启动ImageManipulator。调用 takePictureAsync 后,等待 promise 解析,然后您将获得图像的本地 uri,能够将其传递给 ImageManipulator。