1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Chore: Fix scroll on iOS -- only pass scrollEnabled=false if we aren't scrolling the outermost view (#6925)

This commit is contained in:
Henry Heino 2022-10-13 14:04:07 -07:00 committed by GitHub
parent 0d5f96f5bb
commit 1fe6910089
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -51,6 +51,10 @@ interface Props {
// Initial javascript. Must evaluate to true.
injectedJavaScript: string;
// iOS only: Scroll the outer content of the view. Set this to `false` if
// the main view container doesn't scroll.
scrollEnabled?: boolean;
style?: StyleProp<ViewStyle>;
onMessage: OnMessageCallback;
onError: OnErrorCallback;
@ -118,8 +122,6 @@ const ExtendedWebView = (props: Props, ref: Ref<WebViewControl>) => {
// - `setSupportMultipleWindows` must be `true` for security reasons:
// https://github.com/react-native-webview/react-native-webview/releases/tag/v11.0.0
// - `scrollEnabled` prevents iOS from scrolling the document (has no effect on Android)
// when an editable region (e.g. a the full-screen NoteEditor) is focused.
return (
<WebView
style={{
@ -127,7 +129,7 @@ const ExtendedWebView = (props: Props, ref: Ref<WebViewControl>) => {
...(props.style as any),
}}
ref={webviewRef}
scrollEnabled={false}
scrollEnabled={props.scrollEnabled}
useWebKit={true}
source={source}
setSupportMultipleWindows={true}

View File

@ -356,6 +356,8 @@ function NoteEditor(props: Props, ref: any) {
console.error('NoteEditor: webview error');
}, []);
// - `scrollEnabled` prevents iOS from scrolling the document (has no effect on Android)
// when an editable region (e.g. a the full-screen NoteEditor) is focused.
return (
<View style={{
...props.style,
@ -376,6 +378,7 @@ function NoteEditor(props: Props, ref: any) {
<ExtendedWebView
webviewInstanceId='NoteEditor'
themeId={props.themeId}
scrollEnabled={false}
ref={webviewRef}
html={html}
injectedJavaScript={injectedJavaScript}