我在我的应用上使用反应原生相机和重叠图像。现在我想用一个按钮截取该屏幕的截图。但是当我拍摄截图时,图像上只显示重叠的图像。我需要使用相机视图和覆盖图像捕捉屏幕。
return (
<Camera
ref={(cam) => {
this.camera = cam;
}}
style={styles.preview}
aspect={Camera.constants.Aspect.fill}
captureTarget={Camera.constants.CaptureTarget.disk}
>
<Image
style={{width: 400, height: 400}}
source={require('./image/shilpamela.png')}
/>
<TouchableHighlight
style={styles.capture}
//onPress={this.takePicture.bind(this)}
onPress={
() => {
captureScreen({
format: "jpg",
quality: 0.8
})
.then(
uri => {
CameraRollExtended.saveToCameraRoll({
uri: uri,
album: 'Name'
}, 'photo')
},
error => console.error("Oops, snapshot failed", error)
);
}
}
underlayColor="rgba(255, 255, 255, 0.5)"
>
<View>
<Image
style={{width: 60, height: 60}}
source={require('./image/cam_button.png')}
/>
</View>
</TouchableHighlight>
</Camera>
);