1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

iOS: Fix crash on opening the sidebar (#10852)

This commit is contained in:
Henry Heino 2024-08-09 12:49:10 -07:00 committed by GitHub
parent f58d29a6a6
commit 45b61e1f49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,11 +33,15 @@ const AccessibleView: React.FC<Props> = ({ inert, refocusCounter, children, ...v
if ((refocusCounter ?? null) === null) return;
const autoFocus = () => {
// react-native-web defines UIManager.focus for setting the keyboard focus. However,
// this property is not available in standard react-native. As such, access it using type
// narrowing:
// eslint-disable-next-line no-restricted-properties
if ('focus' in UIManager && typeof UIManager.focus === 'function') {
if (Platform.OS === 'web') {
// react-native-web defines UIManager.focus for setting the keyboard focus. However,
// this property is not available in standard react-native. As such, access it using type
// narrowing:
// eslint-disable-next-line no-restricted-properties
if (!('focus' in UIManager) || typeof UIManager.focus !== 'function') {
throw new Error('Failed to focus sidebar. UIManager.focus is not a function.');
}
// Disable the "use focusHandler for all focus calls" rule -- UIManager.focus requires
// an argument, which is not supported by focusHandler.
// eslint-disable-next-line no-restricted-properties