fix focus on dialog open

This commit is contained in:
ammarahm-ed
2020-03-02 12:12:23 +05:00
parent 437f7ade9a
commit 17618d6d65
2 changed files with 7 additions and 4 deletions

View File

@@ -206,9 +206,7 @@ export class AddNotebookDialog extends React.Component {
animated
animationType="fade"
onShow={() => {
setTimeout(() => {
this.titleRef.focus();
}, 300);
}}
onRequestClose={this.close}>
<KeyboardAvoidingView

View File

@@ -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,