Skip to content

Commit

Permalink
Merge pull request #22621 from tienifr/fix/22271-room-name-input-bloc…
Browse files Browse the repository at this point in the history
…k-screen-transition

Fix: Room name input blocks screen transition
  • Loading branch information
roryabraham authored Jul 12, 2023
2 parents e673d3f + 5e62e4b commit a3404b1
Showing 1 changed file with 9 additions and 3 deletions.
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

0 comments on commit a3404b1

Please sign in to comment.