Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/pages/tasks/NewTaskDescriptionPage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {useRef} from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -36,6 +36,8 @@ const defaultProps = {
};

const NewTaskDescriptionPage = (props) => {
const inputRef = useRef(null);

/**
* @param {Object} values - form input values passed by the Form component
* @returns {Object}
Expand All @@ -56,7 +58,16 @@ const NewTaskDescriptionPage = (props) => {
return null;
}
return (
<ScreenWrapper includeSafeAreaPaddingBottom={false}>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
onEntryTransitionEnd={() => {
if (!inputRef.current) {
return;
}

inputRef.current.focus();
}}
>
<HeaderWithCloseButton
title={props.translate('newTaskPage.description')}
onCloseButtonPress={() => Navigation.dismissModal()}
Expand All @@ -76,6 +87,7 @@ const NewTaskDescriptionPage = (props) => {
defaultValue={props.task.description}
inputID="taskDescription"
label={props.translate('newTaskPage.description')}
ref={(el) => (inputRef.current = el)}
/>
</View>
</Form>
Expand Down
17 changes: 14 additions & 3 deletions src/pages/tasks/NewTaskTitlePage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {useRef} from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -37,6 +37,8 @@ const defaultProps = {
};

const NewTaskTitlePage = (props) => {
const inputRef = useRef(null);

/**
* @param {Object} values - form input values passed by the Form component
* @returns {Boolean}
Expand Down Expand Up @@ -64,7 +66,16 @@ const NewTaskTitlePage = (props) => {
return null;
}
return (
<ScreenWrapper includeSafeAreaPaddingBottom={false}>
<ScreenWrapper
onEntryTransitionEnd={() => {
if (!inputRef.current) {
return;
}

inputRef.current.focus();
}}
includeSafeAreaPaddingBottom={false}
>
<HeaderWithCloseButton
title={props.translate('newTaskPage.title')}
onCloseButtonPress={() => Navigation.dismissModal()}
Expand All @@ -82,7 +93,7 @@ const NewTaskTitlePage = (props) => {
<View style={styles.mb5}>
<TextInput
defaultValue={props.task.title}
autoFocus
ref={(el) => (inputRef.current = el)}
inputID="taskTitle"
label={props.translate('newTaskPage.title')}
/>
Expand Down