我在我的应用程序上使用了本机反应相机和叠加图像。现在我想使用按钮截取该屏幕的屏幕截图。但是当我截取屏幕截图时,图像上只显示覆盖图像。我还需要使用相机视图和叠加图像来捕获屏幕。
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>
);Run Code Online (Sandbox Code Playgroud)