Skip to content

Commit

Permalink
Fix autofocus being lost when screen mounted
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejSWM committed Sep 15, 2023
1 parent 2ee0a42 commit 5788291
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/RoomNameInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useLocalize from '../../hooks/useLocalize';
import * as roomNameInputPropTypes from './roomNameInputPropTypes';
import * as RoomNameInputUtils from '../../libs/RoomNameInputUtils';

function RoomNameInput({isFocused, autoFocus, disabled, errorText, forwardedRef, value, onBlur, onChangeText, onInputChange}) {
function RoomNameInput({isFocused, autoFocus, disabled, errorText, forwardedRef, value, onBlur, onChangeText, onInputChange, shouldDelayFocus}) {
const {translate} = useLocalize();

const [selection, setSelection] = useState();
Expand Down Expand Up @@ -58,6 +58,7 @@ function RoomNameInput({isFocused, autoFocus, disabled, errorText, forwardedRef,
errorText={errorText}
autoCapitalize="none"
onBlur={() => isFocused && onBlur()}
shouldDelayFocus={shouldDelayFocus}
autoFocus={isFocused && autoFocus}
maxLength={CONST.REPORT.MAX_ROOM_NAME_LENGTH}
spellCheck={false}
Expand Down
1 change: 1 addition & 0 deletions src/pages/workspace/WorkspaceNewRoomPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ function WorkspaceNewRoomPage(props) {
<RoomNameInput
inputID="roomName"
isFocused={props.isFocused}
shouldDelayFocus
autoFocus
/>
</View>
Expand Down

0 comments on commit 5788291

Please sign in to comment.