簡體   English   中英

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組件。

如果要創建自定義視圖,則必須自己處理所有狀態和視頻/照片操作。

拍照后,嘗試啟動ImageManipulator 調用takePictureAsync之后,等待promise解析,然后您將獲得圖像的本地uri,並將其傳遞給ImageManipulator。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM