Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Workaround Android 12 webview crash #42517

Merged
merged 2 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion packages/components/src/sandbox/index.native.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/**
* External dependencies
*/
import { Dimensions, Platform } from 'react-native';
import { Dimensions, StyleSheet } from 'react-native';
import { WebView } from 'react-native-webview';

/**
* WordPress dependencies
*/
import {
Platform,
renderToString,
memo,
useRef,
Expand Down Expand Up @@ -307,6 +308,7 @@ function Sandbox( {
style={ [
sandboxStyles[ 'sandbox-webview__content' ],
getSizeStyle(),
Platform.isAndroid && workaroundStyles.webView,
] }
onMessage={ checkMessageForResize }
scrollEnabled={ false }
Expand All @@ -317,4 +319,15 @@ function Sandbox( {
);
}

const workaroundStyles = StyleSheet.create( {
webView: {
/**
* The slight opacity below is a workaround for an Android crash caused from combining Android
* 12's new scroll overflow behavior and webviews.
* https://github.com/react-native-webview/react-native-webview/issues/1915#issuecomment-808869253
*/
opacity: 0.99,
},
} );

export default memo( Sandbox );
1 change: 1 addition & 0 deletions packages/react-native-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ For each user feature we should also add a importance categorization label to i

- [*] Add React Native FastImage [#42009]
- [*] Block inserter displays block collections [#42405]
- [**] Fix a crash when scrolling posts containing Embed blocks (Android 12 only) [#42514]

## 1.79.0
- [*] Add 'Insert from URL' option to Video block [#41493]
Expand Down