From 1fe6910089fc5eb7054184a090d7d20ffd62e746 Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Thu, 13 Oct 2022 14:04:07 -0700 Subject: [PATCH] Chore: Fix scroll on iOS -- only pass scrollEnabled=false if we aren't scrolling the outermost view (#6925) --- packages/app-mobile/components/ExtendedWebView.tsx | 8 +++++--- packages/app-mobile/components/NoteEditor/NoteEditor.tsx | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/app-mobile/components/ExtendedWebView.tsx b/packages/app-mobile/components/ExtendedWebView.tsx index 11dc500c7..3b0e5cf0c 100644 --- a/packages/app-mobile/components/ExtendedWebView.tsx +++ b/packages/app-mobile/components/ExtendedWebView.tsx @@ -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; onMessage: OnMessageCallback; onError: OnErrorCallback; @@ -118,8 +122,6 @@ const ExtendedWebView = (props: Props, ref: Ref) => { // - `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 ( ) => { ...(props.style as any), }} ref={webviewRef} - scrollEnabled={false} + scrollEnabled={props.scrollEnabled} useWebKit={true} source={source} setSupportMultipleWindows={true} diff --git a/packages/app-mobile/components/NoteEditor/NoteEditor.tsx b/packages/app-mobile/components/NoteEditor/NoteEditor.tsx index 2ec7c2876..0cc3cad4f 100644 --- a/packages/app-mobile/components/NoteEditor/NoteEditor.tsx +++ b/packages/app-mobile/components/NoteEditor/NoteEditor.tsx @@ -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 (