Skip to content

Capturing partial image only #210

@hitchcocknz

Description

@hitchcocknz

ViewShot fails to capture complete image when have multiple ViewShot's rendered. It is fine on version 2.4.0 but fails on 2.5.0.

Platform information

Android (not tested on IOS yet)
RN 0.58.4
React 16.6.3
ViewShot 2.5.0 (previous versions OK) - saving as png files.
ViewShot children are tables generated via react-native-table-component@1.2.0

Example of ViewShot used:
<ViewShot ref='shootingStats' onCapture={(uri) => {this.onCapture('shootingStats', uri)}} captureMode="mount" options={{ format: "png", quality: 1 }}
onLayout={(event) => { this.viewDimensions('Shooting Statistics', 'shootingStats', event.nativeEvent.layout) }}>
......table component

There are two callbacks - one for getting dimensions and one for capturing. Have combined logic into one callback only but had no impact. There are approximately 9 x ViewShot's being rendered at once and 9 separate captures (9 tables being captured as images). Problem is not a timing issue as have tested waiting some time after rendering complete before capturing.

First few tables captured are fine, then the problem arises. It is almost as if the captured area becomes fixed to a certain size and isn't adjusting to the size of the viewRef.

Expected behavior

All child content is correctly captured into files.

Actual behavior

First few ViewShots capture fine then it starts to incorrectly capture the complete image in the vertical direction (horizontal is fine).

Steps to reproduce the behavior

Need to use multiple ViewShots.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions