Giter VIP home page Giter VIP logo

Comments (16)

Grom-S avatar Grom-S commented on May 18, 2024 4

I a have the same problem. Canvas in webview is blank. Setting android:hardwareAccelerated="false" works, but then you don't get the acceleration and the app is slow.
Is there any other way to solve this issue? @Rice-M how did you solved it?

from react-native-view-shot.

Manweill avatar Manweill commented on May 18, 2024 1

is Android WebView. and, I thinks you don't mean what i say .
the WebView snapshot is work ,but the canvas is blank.

from react-native-view-shot.

Manweill avatar Manweill commented on May 18, 2024 1

@gre yes ,is in . maybe i expressions has worng. i will fork react-native-view-shot-example and code the problem

from react-native-view-shot.

Manweill avatar Manweill commented on May 18, 2024

but, if move the webview element after <View ref="form"></View> , is not blank.
like this:

       <View
          ref="form"
          style={styles.form}>
          <View style={styles.btns}>
            <Btn label="😻 Reset" onPress={() => this.setState({ previewSource: catsSource })} />
            <Btn label="📷 Head Section" onPress={this.snapshot("header")} />
            <Btn label="📷 Form" onPress={this.snapshot("form")} />
            <Btn label="📷 Experimental Section" onPress={this.snapshot("complex")} />
            <Btn label="📷 All (ScrollView)" onPress={this.snapshot("full")} />
            <Btn label="📷 GL React" onPress={this.snapshot("gl")} />
            <Btn label="📷 MapView" onPress={this.snapshot("mapview")} />
            <Btn label="📷 WebView" onPress={this.snapshot("webview")} />
            <Btn label="📷 Video" onPress={this.snapshot("video")} />
            <Btn label="📷 Empty View (should crash)" onPress={this.snapshot("empty")} />
          </View>

          <View
            ref="webview"
            collapsable={false}
            style={{ width: 300, height: 500 }}>
            <WebView
              source={require('./assets/cavans.html')}
            />
          </View>

from react-native-view-shot.

oakis avatar oakis commented on May 18, 2024

What platform are you developing on?

This is what it says in the docs:

Android WebView:
Only supported by wrapping a parent and snapshotting it.

from react-native-view-shot.

gre avatar gre commented on May 18, 2024

as said in the README here https://github.com/gre/react-native-view-shot#interoperability-table

Android WebView is only supported by wrapping a <View collapsable={false}> parent and snapshotting it.

for some reason, directly attempting to snapshot the WebView won't work. to avoid this confusion, I might introduce that #48 so you don't have to think about this problem. What do you think?

from react-native-view-shot.

Manweill avatar Manweill commented on May 18, 2024

@gre see in https://github.com/manweill/react-native-view-shot-example

from react-native-view-shot.

gre avatar gre commented on May 18, 2024

I've tested your code in a WebView and I can successfully snapshot in Android so maybe this was recently fixed

screen shot 2017-08-25 at 22 15 40

from react-native-view-shot.

Rice-M avatar Rice-M commented on May 18, 2024

@Manweill Hi, how did you solve this, in my case some canvas in webview can not be captured

from react-native-view-shot.

gre avatar gre commented on May 18, 2024

are you sure the canvas is rendered at the time you capture it?

from react-native-view-shot.

Rice-M avatar Rice-M commented on May 18, 2024

@gre yes, I can see the rendered canvas in the srceen, bug when capture to img some canvas not shown

from react-native-view-shot.

Rice-M avatar Rice-M commented on May 18, 2024

wechatimg120

wechatimg121
You can see the img1 some section is blank

from react-native-view-shot.

 avatar commented on May 18, 2024

solved?

from react-native-view-shot.

csfwff avatar csfwff commented on May 18, 2024

try to set android:hardwareAccelerated="false", it works.

from react-native-view-shot.

leonsimple avatar leonsimple commented on May 18, 2024

hint https://developer.android.com/reference/android/view/PixelCopy

from react-native-view-shot.

salman-ar-sar avatar salman-ar-sar commented on May 18, 2024

Did anyone find a solution for this without setting android:hardwareAccelerated="false"? That is not a real solution right?

I am facing this issue on Android only when capturing a view containing TradingView in a WebView.

@gre Please let me know if I am missing anything.

from react-native-view-shot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.