Skip to content

Commit 5fa7b83

Browse files
mountinyOSBotify
authored andcommitted
Merge pull request #71568 from situchan/revert-71264-fix/70912
[CP Staging] Revert "Fix/70912 - Edit composer isn't automatically focused" (cherry picked from commit c5ee5c5) (cherry-picked to staging by mountiny)
1 parent 17cd17a commit 5fa7b83

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

  • src/components/Modal/ReanimatedModal

src/components/Modal/ReanimatedModal/index.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,13 @@ function ReanimatedModal({
145145
if (handleRef.current) {
146146
InteractionManager.clearInteractionHandle(handleRef.current);
147147
}
148-
// On the web platform, the Modal's onDismiss callback may not be triggered if the dismiss process is interrupted by other actions such as navigation.
149-
// Specifically on Android, the Modal's onDismiss callback does not work reliably. There's a reported issue at:
148+
// Because on Android, the Modal's onDismiss callback does not work reliably. There's a reported issue at:
150149
// https://stackoverflow.com/questions/58937956/react-native-modal-ondismiss-not-invoked
151-
// Therefore, we manually call onDismiss and onModalHide here.
152-
onDismiss?.();
153-
onModalHide();
154-
}, [onDismiss, onModalHide]);
150+
// Therefore, we manually call onModalHide() here for Android.
151+
if (getPlatform() === CONST.PLATFORM.ANDROID) {
152+
onModalHide();
153+
}
154+
}, [onModalHide]);
155155

156156
const containerView = (
157157
<Container
@@ -208,6 +208,12 @@ function ReanimatedModal({
208208
onRequestClose={onBackButtonPressHandler}
209209
statusBarTranslucent={statusBarTranslucent}
210210
testID={testID}
211+
onDismiss={() => {
212+
onDismiss?.();
213+
if (getPlatform() !== CONST.PLATFORM.ANDROID) {
214+
onModalHide();
215+
}
216+
}}
211217
// eslint-disable-next-line react/jsx-props-no-spreading
212218
{...props}
213219
>

0 commit comments

Comments
 (0)