[英]Expo.launchCameraAsync custom image view?
I am creating camera feature for my app so that after the user takes the photo, they can rescale and move it around a bounding box. 我正在为我的应用程序创建相机功能,以便用户拍摄照片后,他们可以重新缩放并在边框周围移动。
Expo
have an out of box API that does what I want: Expo
会有一个开箱即用的API,可以满足我的需求:
ImagePicker.launchCameraAsync({ allowsEditing: true, aspect: [4,3] })
but I would also like the camera screen itself to be full screen, so no black bars on top and bottom, I have the view here: 但是我也希望相机屏幕本身是全屏的,所以顶部和底部没有黑条,我在这里有视图:
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>
The detail isn't important, the point is that I can create a Camera
view. 细节并不重要,关键是我可以创建“
Camera
视图。 Now the question is is there a way to pass in this camera view into launchCameraAsync
? 现在的问题是,有没有办法将此相机视图传递给
launchCameraAsync
? The documentation does not seem to provide a solution. 该文档似乎没有提供解决方案。
I think this combinition is not possible. 我认为这种组合是不可能的。
ImagePicker.launchCameraAsync({ allowsEditing: true, aspect: [4,3] })
is calling a full capsuled expo component. ImagePicker.launchCameraAsync({ allowsEditing: true, aspect: [4,3] })
正在调用完整封装的expo组件。
If you want to create a customized view, you have to handle all states and video/photo actions by you're own. 如果要创建自定义视图,则必须自己处理所有状态和视频/照片操作。
Try launching an ImageManipulator after the picture is taken. 拍照后,尝试启动ImageManipulator 。 After calling takePictureAsync, wait for the promise to resolve, then you'll get the local uri of the image, being able to pass that to the ImageManipulator.
调用takePictureAsync之后,等待promise解析,然后您将获得图像的本地uri,并将其传递给ImageManipulator。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.