Closed Manweill closed 7 years ago
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>
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.
is Android WebView. and, I thinks you don't mean what i say .
the WebView snapshot is work ,but the canvas is blank.
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 https://github.com/gre/react-native-view-shot/issues/48 so you don't have to think about this problem. What do you think?
@gre yes ,is in
I've tested your code in a WebView and I can successfully snapshot in Android so maybe this was recently fixed
@Manweill Hi, how did you solve this, in my case some canvas in webview can not be captured
are you sure the canvas is rendered at the time you capture it?
@gre yes, I can see the rendered canvas in the srceen, bug when capture to img some canvas not shown
You can see the img1 some section is blank
solved?
try to set android:hardwareAccelerated="false", it works.
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?
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.
webview source require this html,captures blank, in the react-native-view-shot-example project @gre