how can i take a screenshot of camera screen using

2019-05-09 18:43发布

I use a react native camera and a overlaying image on my app. Now i want to take a screenshot of that screen using a button. But when i take screenshot then only the overlaying image are shown on the image. i need to capture the screen with camera view and the overlaying image also.

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>
    );

0条回答
登录 后发表回答