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

Mobile: Fixes #9502: Fix note editor crash when trying to edit text quickly after opening a note (#9581)

This commit is contained in:
Henry Heino 2023-12-24 06:54:24 -08:00 committed by GitHub
parent 8ae3210378
commit 02232c0ca3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1347,7 +1347,9 @@ class NoteScreenComponent extends BaseScreenComponent<Props, State> implements B
let fieldToFocus = this.state.note.is_todo ? 'title' : 'body';
if (this.state.mode === 'view') fieldToFocus = '';
if (fieldToFocus === 'title' && this.titleTextFieldRef.current) {
// Avoid writing `this.titleTextFieldRef.current` -- titleTextFieldRef may
// be undefined.
if (fieldToFocus === 'title' && this.titleTextFieldRef?.current) {
this.titleTextFieldRef.current.focus();
}
// if (fieldToFocus === 'body' && this.markdownEditorRef.current) {