mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-11 17:21:11 +08:00
Fix the Portal display to not rerender the entire tree
Summary:public We now wrap the <RootComponent> in an <View> where we can control the accessibility at a high level. This was only used to turn it off for the faded out background view when we show a pop up. We use setNativeProps instead of setState to avoid the render. We really just want to pass this value to the native Android View. Reviewed By: davidaurelio Differential Revision: D2928371 fb-gh-sync-id: 19c34471c33650acb526a2f5a02b6070e844e8d0 shipit-source-id: 19c34471c33650acb526a2f5a02b6070e844e8d0
This commit is contained in:
committed by
facebook-github-bot-7
parent
b26f699c9a
commit
7dc1d460c6
@@ -73,8 +73,8 @@ var AppContainer = React.createClass({
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
rootImportanceForAccessibility: modalVisible ? 'no-hide-descendants' : 'auto',
|
||||
this.refs.accessibilityWrapper.setNativeProps({
|
||||
importantForAccessibility: modalVisible ? 'no-hide-descendants' : 'auto',
|
||||
});
|
||||
},
|
||||
|
||||
@@ -85,10 +85,14 @@ var AppContainer = React.createClass({
|
||||
ref="main"
|
||||
collapsable={!this.state.inspectorVisible}
|
||||
style={styles.appContainer}>
|
||||
<RootComponent
|
||||
{...this.props.initialProps}
|
||||
rootTag={this.props.rootTag}
|
||||
importantForAccessibility={this.state.rootImportanceForAccessibility}/>
|
||||
<View
|
||||
ref="accessibilityWrapper"
|
||||
collapsable={true}
|
||||
style={styles.appContainer}>
|
||||
<RootComponent
|
||||
{...this.props.initialProps}
|
||||
rootTag={this.props.rootTag}/>
|
||||
</View>
|
||||
<Portal
|
||||
onModalVisibilityChanged={this.setRootAccessibility}/>
|
||||
</View>;
|
||||
|
||||
Reference in New Issue
Block a user