1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-05 22:57:29 +02:00

Chore: Mobile: Update mobile components for compatibility with React Native 0.79 (#12154)

This commit is contained in:
Henry Heino
2025-04-24 00:48:58 -07:00
committed by GitHub
parent cf626bee76
commit dfa340a137
22 changed files with 93 additions and 61 deletions

View File

@@ -5,7 +5,7 @@ import Setting from '@joplin/lib/models/Setting';
import shim from '@joplin/lib/shim';
import { themeStyle } from '@joplin/lib/theme';
import { Theme } from '@joplin/lib/themes/type';
import { MutableRefObject, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
import { BackHandler, Platform } from 'react-native';
import ExtendedWebView from '../../ExtendedWebView';
import { OnMessageEvent, WebViewControl } from '../../ExtendedWebView/types';
@@ -83,7 +83,7 @@ const useCss = (editorTheme: Theme) => {
const ImageEditor = (props: Props) => {
const editorTheme: Theme = themeStyle(props.themeId);
const webviewRef: MutableRefObject<WebViewControl>|null = useRef(null);
const webviewRef = useRef<WebViewControl|null>(null);
const [imageChanged, setImageChanged] = useState(false);
const dialogs = useContext(DialogContext);
@@ -124,10 +124,10 @@ const ImageEditor = (props: Props) => {
onRequestCloseEditor(true);
return true;
};
BackHandler.addEventListener('hardwareBackPress', hardwareBackPressListener);
const handle = BackHandler.addEventListener('hardwareBackPress', hardwareBackPressListener);
return () => {
BackHandler.removeEventListener('hardwareBackPress', hardwareBackPressListener);
handle.remove();
};
}, [onRequestCloseEditor]);