fix: Fixed issue on Android where pressing backspace in Super notes would delete characters on both side of the cursor (#2336)

This commit is contained in:
Aman Harwara
2023-05-29 17:00:01 +05:30
committed by GitHub
parent 5d98c86592
commit 0cb73b5d18
5 changed files with 109 additions and 54 deletions

View File

@@ -1,15 +1,17 @@
import { ReactNativeToWebEvent } from '@standardnotes/snjs'
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { Button, Keyboard, Platform, Text, View } from 'react-native'
import { Button, Keyboard, Platform, requireNativeComponent, Text, View } from 'react-native'
import VersionInfo from 'react-native-version-info'
import { WebView, WebViewMessageEvent } from 'react-native-webview'
import { OnShouldStartLoadWithRequest } from 'react-native-webview/lib/WebViewTypes'
import { NativeWebViewAndroid, OnShouldStartLoadWithRequest } from 'react-native-webview/lib/WebViewTypes'
import { AndroidBackHandlerService } from './AndroidBackHandlerService'
import { AppStateObserverService } from './AppStateObserverService'
import { ColorSchemeObserverService } from './ColorSchemeObserverService'
import { MobileDevice, MobileDeviceEvent } from './Lib/MobileDevice'
import { IsDev } from './Lib/Utils'
const CustomWebView: NativeWebViewAndroid = requireNativeComponent('CustomWebView')
const LoggingEnabled = IsDev
export const MobileWebAppContainer = () => {
@@ -354,6 +356,12 @@ const MobileWebAppContents = ({ destroyAndReload }: { destroyAndReload: () => vo
* This is needed to prevent the keyboard from pushing the webview up and down when it appears and disappears.
*/
scrollEnabled={false}
overScrollMode="never"
nativeConfig={Platform.select({
android: {
component: CustomWebView,
},
})}
/>
)
}