Skip to content

Commit

Permalink
Modal: disable view flattening explicitly for the children of Modal, …
Browse files Browse the repository at this point in the history
…the content wrappers

Summary:
I noticed that in ModalHostShadowNode.java (not used in Fabric), there's an assumption that the Modal will have exactly one child on the native side; this child is explicitly specified in Modal.js.

However, in Fabric, these views are flattened and so the Modal will actually have N children - whatever children the product code passes into the Modal.

In *theory* this should be fine, but might be causing issues. Not sure.

This is an experiment and shouldn't be landed until we verify that (1) this actually matters, (2) that it fixes an issue with Modal on iOS or Android.

Changelog: [Internal] Change to make Fabric consistent with non-Fabric Modal

Reviewed By: mdvacca

Differential Revision: D21191822

fbshipit-source-id: 9d65f346387fd056649d4063d70220f637ba8828
  • Loading branch information
JoshuaGross authored and facebook-github-bot committed Apr 23, 2020
1 parent 17adf54 commit bda8aae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class Modal extends React.Component<Props> {
supportedOrientations={this.props.supportedOrientations}
onOrientationChange={this.props.onOrientationChange}>
<ScrollView.Context.Provider value={null}>
<View style={[styles.container, containerStyles]}>
<View style={[styles.container, containerStyles]} collapsable={false}>
{innerChildren}
</View>
</ScrollView.Context.Provider>
Expand Down
1 change: 1 addition & 0 deletions Libraries/Modal/__tests__/__snapshots__/Modal-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ exports[`<Modal /> should render as <RCTModalHostView> when not mocked 1`] = `
}
>
<View
collapsable={false}
style={
Array [
Object {
Expand Down

0 comments on commit bda8aae

Please sign in to comment.