Skip to content

Commit 93b1ced

Browse files
authored
Merge pull request Expensify#68764 from dmkt9/fix/68494
2 parents e3e07d8 + ac0445e commit 93b1ced

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

src/components/Modal/ReanimatedModal/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ function ReanimatedModal({
142142
if (handleRef.current) {
143143
InteractionManager.clearInteractionHandle(handleRef.current);
144144
}
145-
if (getPlatform() !== CONST.PLATFORM.IOS) {
145+
// Because on Android, the Modal's onDismiss callback does not work reliably. There's a reported issue at:
146+
// https://stackoverflow.com/questions/58937956/react-native-modal-ondismiss-not-invoked
147+
// Therefore, we manually call onModalHide() here for Android.
148+
if (getPlatform() === CONST.PLATFORM.ANDROID) {
146149
onModalHide();
147150
}
148151
}, [onModalHide]);
@@ -204,7 +207,7 @@ function ReanimatedModal({
204207
testID={testID}
205208
onDismiss={() => {
206209
onDismiss?.();
207-
if (getPlatform() === CONST.PLATFORM.IOS) {
210+
if (getPlatform() !== CONST.PLATFORM.ANDROID) {
208211
onModalHide();
209212
}
210213
}}

src/pages/settings/Profile/CustomStatus/StatusPage.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ import useOnyx from '@hooks/useOnyx';
2121
import useStyleUtils from '@hooks/useStyleUtils';
2222
import useTheme from '@hooks/useTheme';
2323
import useThemeStyles from '@hooks/useThemeStyles';
24+
import {isMobileChrome} from '@libs/Browser';
2425
import DateUtils from '@libs/DateUtils';
2526
import focusAfterModalClose from '@libs/focusAfterModalClose';
27+
import focusComposerWithDelay from '@libs/focusComposerWithDelay';
2628
import {formatPhoneNumber} from '@libs/LocalePhoneNumber';
2729
import Navigation from '@libs/Navigation/Navigation';
2830
import {getPersonalDetailByEmail} from '@libs/PersonalDetailsUtils';
@@ -209,7 +211,15 @@ function StatusPage() {
209211
role={CONST.ROLE.PRESENTATION}
210212
defaultValue={defaultEmoji}
211213
style={styles.mb3}
212-
onModalHide={() => focusAfterModalClose(inputRef.current)}
214+
onModalHide={() => {
215+
// On mobile Chrome, the input will blur immediately upon focus if the focus function is called right after the modal closes, even though the modal has fully closed.
216+
// Therefore, use the `focusComposerWithDelay` helper as used in `ComposerWithSuggestions` for this case.
217+
if (isMobileChrome()) {
218+
focusComposerWithDelay(inputRef.current)(true);
219+
} else {
220+
focusAfterModalClose(inputRef.current);
221+
}
222+
}}
213223
// eslint-disable-next-line @typescript-eslint/no-unused-vars
214224
onInputChange={(emoji: string): void => {}}
215225
/>

0 commit comments

Comments
 (0)