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
|
animated
|
||||||
animationType="fade"
|
animationType="fade"
|
||||||
onShow={() => {
|
onShow={() => {
|
||||||
setTimeout(() => {
|
this.titleRef.focus();
|
||||||
this.titleRef.focus();
|
|
||||||
}, 300);
|
|
||||||
}}
|
}}
|
||||||
onRequestClose={this.close}>
|
onRequestClose={this.close}>
|
||||||
<KeyboardAvoidingView
|
<KeyboardAvoidingView
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, {createRef} from 'react';
|
||||||
import {Modal, Text, TouchableOpacity, View} from 'react-native';
|
import {Modal, Text, TouchableOpacity, View} from 'react-native';
|
||||||
import {TextInput} from 'react-native-gesture-handler';
|
import {TextInput} from 'react-native-gesture-handler';
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
@@ -18,6 +18,7 @@ export class AddTopicDialog extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.title;
|
this.title;
|
||||||
|
this.titleRef = createRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
addNewTopic = async () => {
|
addNewTopic = async () => {
|
||||||
@@ -52,6 +53,9 @@ export class AddTopicDialog extends React.Component {
|
|||||||
animated
|
animated
|
||||||
animationType="fade"
|
animationType="fade"
|
||||||
transparent={true}
|
transparent={true}
|
||||||
|
onShow={() => {
|
||||||
|
this.titleRef.current?.focus();
|
||||||
|
}}
|
||||||
onRequestClose={() => {
|
onRequestClose={() => {
|
||||||
refs = [];
|
refs = [];
|
||||||
this.close();
|
this.close();
|
||||||
@@ -102,6 +106,7 @@ export class AddTopicDialog extends React.Component {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<TextInput
|
<TextInput
|
||||||
|
ref={this.titleRef}
|
||||||
style={{
|
style={{
|
||||||
padding: pv,
|
padding: pv,
|
||||||
borderWidth: 1.5,
|
borderWidth: 1.5,
|
||||||
|
|||||||
Reference in New Issue
Block a user