Skip to content

Commit

Permalink
reapply Expensify#23258
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Aug 11, 2023
1 parent 5dbb34f commit bddc3fb
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,24 +368,8 @@ function ReportActionCompose({
* @param {Boolean} [shouldDelay=false] Impose delay before focusing the composer
* @memberof ReportActionCompose
*/
const focus = useCallback((shouldDelay = false) => {
// There could be other animations running while we trigger manual focus.
// This prevents focus from making those animations janky.
InteractionManager.runAfterInteractions(() => {
if (!textInputRef.current) {
return;
}

if (!shouldDelay) {
textInputRef.current.focus();
} else {
// Keyboard is not opened after Emoji Picker is closed
// SetTimeout is used as a workaround
// https://github.com/react-native-modal/react-native-modal/issues/114
// We carefully choose a delay. 100ms is found enough for keyboard to open.
setTimeout(() => textInputRef.current.focus(), 100);
}
});
const focus = useCallback((shouldDelay) => {
focusWithDelay(textInputRef.current)(shouldDelay);
}, []);

/**
Expand Down

0 comments on commit bddc3fb

Please sign in to comment.