Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Room name input blocks screen transition #22621

Merged
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
12 changes: 9 additions & 3 deletions src/pages/settings/Report/RoomNamePage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useCallback} from 'react';
import React, {useCallback, useRef} from 'react';
import {withOnyx} from 'react-native-onyx';
import PropTypes from 'prop-types';
import {View} from 'react-native';
Expand Down Expand Up @@ -37,6 +37,8 @@ function RoomNamePage(props) {
const reports = props.reports;
const translate = props.translate;

const roomNameInputRef = useRef(null);

const validate = useCallback(
(values) => {
const errors = {};
Expand Down Expand Up @@ -66,7 +68,11 @@ function RoomNamePage(props) {
);

return (
<ScreenWrapper includeSafeAreaPaddingBottom={false}>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
// Room name input autofocusing may block screen transition on Safari
onEntryTransitionEnd={() => roomNameInputRef.current && roomNameInputRef.current.focus()}
>
<HeaderWithBackButton
title={translate('newRoomPage.roomName')}
onBackButtonPress={() => Navigation.goBack(ROUTES.getReportSettingsRoute(report.reportID))}
Expand All @@ -81,8 +87,8 @@ function RoomNamePage(props) {
>
<View style={styles.mb4}>
<RoomNameInput
ref={(ref) => (roomNameInputRef.current = ref)}
inputID="roomName"
autoFocus
defaultValue={report.reportName}
/>
</View>
Expand Down