Skip to content

Commit

Permalink
Fix ScrollView context warning in Modal.js
Browse files Browse the repository at this point in the history
Summary: This fixes the following warning from appearing when you have a FlatList render a Modal where the content of the Modal also contains a FlatList: https://fburl.com/p953k985.  Spencer addressed an issue similar to this in D7863625, but we still get a yellow box due to the fact that `scrollContext` still exists, but `this.context.virtualizedList` is null from this line in Modal.js https://fburl.com/nqc261a1.

Reviewed By: cpojer

Differential Revision: D16160666

fbshipit-source-id: ba222d3eef234f4c8c4c2bddbc71bec27df81e0a
  • Loading branch information
Blair Vanderhoof authored and facebook-github-bot committed Jul 10, 2019
1 parent 7dc0d4b commit 45b0907
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Libraries/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import NativeModalManager from './NativeModalManager';
const Platform = require('../Utilities/Platform');
const React = require('react');
const PropTypes = require('prop-types');
const ScrollView = require('../Components/ScrollView/ScrollView');
const StyleSheet = require('../StyleSheet/StyleSheet');
const View = require('../Components/View/View');

Expand Down Expand Up @@ -258,7 +259,11 @@ class Modal extends React.Component<Props> {
onStartShouldSetResponder={this._shouldSetResponder}
supportedOrientations={this.props.supportedOrientations}
onOrientationChange={this.props.onOrientationChange}>
<View style={[styles.container, containerStyles]}>{innerChildren}</View>
<ScrollView.Context.Provider value={null}>
<View style={[styles.container, containerStyles]}>
{innerChildren}
</View>
</ScrollView.Context.Provider>
</RCTModalHostView>
);
}
Expand Down

0 comments on commit 45b0907

Please # to comment.