react-native-view-shot: Android Crash after taking a shot

bug report

After capturing a snapshot with ViewShot:

       <ScrollView>
               <ViewShot
                    ref={this.handleViewShot}
                    options={{
                        result: 'data-uri',
                        format: 'png',
                    }}
                    snapshotContentContainer
                >
   share = async () => {
        const { navigation } = this.props
        const title = setTitle(navigation.state.params.chiefComplaintTitle)
        const uri = await this.viewShot.capture()
        const shareImageBase64 = {
            title,
            url: uri,
            subject: title,
        }
        Share.open(shareImageBase64)
    }

Version & Platform

react-native-view-shot@2.1.1

Platform: Android

Expected behavior

To take a snapshot (in IOS it works)

Actual behavior

screen shot 2017-11-16 at 15 59 40

Steps to reproduce the behavior

try to use this.viewShot.capture()

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

it should

@iddan commit mentioned by @khaled-cliqz is available in most recent release (up to date) - 2.2.0 on npm.

ok I see, I think there is a bug in data-uri mode and the JS code should never call releaseSnapshot in such mode.