Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions packages/react-native/Libraries/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,16 @@ class Modal extends React.Component<ModalProps, ModalState> {
return null;
}

const containerStyles = {
backgroundColor:
this.props.transparent === true
? 'transparent'
: (this.props.backdropColor ?? 'white'),
};
// Only override backgroundColor when transparent or backdropColor are
// explicitly set, so that these Modal-specific props take precedence
// over the generic style prop. The default backgroundColor ('white')
// is defined in styles.container below.
const containerStyles = {};
if (this.props.transparent === true) {
containerStyles.backgroundColor = 'transparent';
} else if (this.props.backdropColor != null) {
containerStyles.backgroundColor = this.props.backdropColor;
}

let animationType = this.props.animationType || 'none';

Expand Down Expand Up @@ -349,7 +353,7 @@ class Modal extends React.Component<ModalProps, ModalState> {
<ScrollView.Context.Provider value={null}>
<View
// $FlowFixMe[incompatible-type]
style={[styles.container, containerStyles]}
style={[styles.container, this.props.style, containerStyles]}
collapsable={false}>
{innerChildren}
</View>
Expand Down Expand Up @@ -380,6 +384,7 @@ const styles = StyleSheet.create({
[side]: 0,
top: 0,
flex: 1,
backgroundColor: 'white',
},
});

Expand Down