mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 14:39:34 +01:00
fix focus on dialog open
This commit is contained in:
@@ -206,9 +206,7 @@ export class AddNotebookDialog extends React.Component {
|
||||
animated
|
||||
animationType="fade"
|
||||
onShow={() => {
|
||||
setTimeout(() => {
|
||||
this.titleRef.focus();
|
||||
}, 300);
|
||||
}}
|
||||
onRequestClose={this.close}>
|
||||
<KeyboardAvoidingView
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, {createRef} from 'react';
|
||||
import {Modal, Text, TouchableOpacity, View} from 'react-native';
|
||||
import {TextInput} from 'react-native-gesture-handler';
|
||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
@@ -18,6 +18,7 @@ export class AddTopicDialog extends React.Component {
|
||||
};
|
||||
|
||||
this.title;
|
||||
this.titleRef = createRef();
|
||||
}
|
||||
|
||||
addNewTopic = async () => {
|
||||
@@ -52,6 +53,9 @@ export class AddTopicDialog extends React.Component {
|
||||
animated
|
||||
animationType="fade"
|
||||
transparent={true}
|
||||
onShow={() => {
|
||||
this.titleRef.current?.focus();
|
||||
}}
|
||||
onRequestClose={() => {
|
||||
refs = [];
|
||||
this.close();
|
||||
@@ -102,6 +106,7 @@ export class AddTopicDialog extends React.Component {
|
||||
</View>
|
||||
|
||||
<TextInput
|
||||
ref={this.titleRef}
|
||||
style={{
|
||||
padding: pv,
|
||||
borderWidth: 1.5,
|
||||
|
||||
Reference in New Issue
Block a user