Skip to content

Add dismissOnClickOutside to Android Modal (#60418) - #60418

Open
evankatz14 wants to merge 3 commits into
react:mainfrom
evankatz14:export-D132200976
Open

evankatz14 wants to merge 3 commits into
react:mainfrom
evankatz14:export-D132200976

Conversation

@evankatz14

@evankatz14 evankatz14 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Add an opt-in dismissOnClickOutside prop to Android Modal, used together with contentSized.

Presses outside the content-sized window are routed through the existing onRequestClose callback, so JS still owns visible. Without contentSized the window fills the parent and the prop has no effect.

Changelog:
[Android][Added] - Add dismissOnClickOutside prop to Modal to request closing on presses outside a contentSized window.

Differential Revision: D132200976

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 1, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels Dec 1, 2026
@meta-codesync

meta-codesync Bot commented Dec 1, 2026

Copy link
Copy Markdown

@evankatz14 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D132200976.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

Summary:
Pull Request resolved: react#60388

Add the Android-only `Modal.dimAmount` prop to control system dimming behind a non-transparent modal. The native value is clamped to `0–1` and defaults to `0.5` when omitted or reset. `transparent={true}` still disables system dimming and keeps the container transparent.

On Android, explicitly setting `dimAmount` makes the JS container transparent unless an explicit `backdropColor` is provided. With `dimAmount` omitted, existing background behavior is unchanged: `transparent` takes precedence, then `backdropColor`, then `style.backgroundColor` or the white default. An explicit `dimAmount` also takes precedence over `style.backgroundColor` when neither `transparent` nor `backdropColor` is set.

Deprecate `Modal.backdropColor` in the public prop types without changing its behavior. Prefer `style={{backgroundColor: ...}}` for custom container colors, except when combining a custom color with an explicit Android `dimAmount`: that combination still needs `backdropColor` in this version.

Replace the duplicate Android dim-flag mask with the equivalent `addFlags(FLAG_DIM_BEHIND)` call. Update the Android, C++, and JavaScript API snapshots, and cover prop forwarding and reset, transparent container defaults, and explicit `backdropColor` precedence in the Modal integration tests.

Changelog:
[Android][Added] - Add `Modal.dimAmount` to configure system dimming behind non-transparent modals.
[General][Deprecated] - Deprecate `Modal.backdropColor` without removing it.

Reviewed By: Abbondanzo

Differential Revision: D125038408
Summary:
Pull Request resolved: react#60408

Add an opt-in `contentSized` prop to Android `Modal`.

RN normally measures modal content against the full parent size. With `contentSized`, Fabric and the JS wrapper measure the content instead, and the native window is sized to it and centered after layout. Outside presses are consumed by the dialog window, so they do not reach the parent.

Ordinary `Modal` keeps its existing window, layout, and animation theme selection.

Changelog:
[Android][Added] - Add `contentSized` prop to `Modal` to size the native window to its content.

Differential Revision: D126114637
Summary:
Pull Request resolved: react#60418

Add an opt-in `dismissOnClickOutside` prop to Android `Modal`, used together with `contentSized`.

Presses outside the content-sized window are routed through the existing `onRequestClose` callback, so JS still owns `visible`. Without `contentSized` the window fills the parent and the prop has no effect.

Changelog:
[Android][Added] - Add `dismissOnClickOutside` prop to `Modal` to request closing on presses outside a `contentSized` window.

Differential Revision: D132200976
@meta-codesync meta-codesync Bot changed the title Add dismissOnClickOutside to Android Modal Add dismissOnClickOutside to Android Modal (#60418) Dec 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant