Browse Source

Fix status bar color not changing after dismissing contextual menu (#1267)

Also listen to contextualMenuDismissed event in Actions screen
Guy Carmeli 7 years ago
parent
commit
a34ccb61a0

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/screens/Screen.java View File

74
     @Override
74
     @Override
75
     public void onEvent(Event event) {
75
     public void onEvent(Event event) {
76
         if (ContextualMenuHiddenEvent.TYPE.equals(event.getType()) && isShown()) {
76
         if (ContextualMenuHiddenEvent.TYPE.equals(event.getType()) && isShown()) {
77
-            setStyle();
78
             topBar.onContextualMenuHidden();
77
             topBar.onContextualMenuHidden();
78
+            setStyle();
79
         }
79
         }
80
         if (ViewPagerScreenChangedEvent.TYPE.equals(event.getType()) && isShown() ) {
80
         if (ViewPagerScreenChangedEvent.TYPE.equals(event.getType()) && isShown() ) {
81
             topBar.dismissContextualMenu();
81
             topBar.dismissContextualMenu();

+ 20
- 12
example/src/screens/Actions.js View File

1
 import React from 'react';
1
 import React from 'react';
2
-import { StyleSheet, ScrollView } from 'react-native';
2
+import {StyleSheet, ScrollView} from 'react-native';
3
 import Row from '../components/Row';
3
 import Row from '../components/Row';
4
 
4
 
5
 class Actions extends React.Component {
5
 class Actions extends React.Component {
6
 
6
 
7
-    constructor() {
8
-        super();
7
+    constructor(props) {
8
+        super(props);
9
 
9
 
10
         this._fab = false;
10
         this._fab = false;
11
         this._rightButton = null;
11
         this._rightButton = null;
12
         this._contextualMenu = false;
12
         this._contextualMenu = false;
13
         this._toggleTabs = 'shown';
13
         this._toggleTabs = 'shown';
14
         this._toggleNavBar = 'shown';
14
         this._toggleNavBar = 'shown';
15
+        this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
16
+    }
17
+
18
+    onNavigatorEvent(event) {
19
+        if (event.id === 'contextualMenuDismissed') {
20
+            console.log('guyca', 'contextualMenuDismissed');
21
+            this._contextualMenu = false;
22
+        }
15
     }
23
     }
16
 
24
 
17
     setTitle = () => {
25
     setTitle = () => {
134
     render() {
142
     render() {
135
         return (
143
         return (
136
             <ScrollView style={styles.container}>
144
             <ScrollView style={styles.container}>
137
-                <Row title={'Set Title'} onPress={this.setTitle} />
138
-                <Row title={'Toggle Tabs'} onPress={this.toggleTabs} />
139
-                <Row title={'Set Tab Badge'} onPress={this.setTabBadge} />
140
-                <Row title={'Switch To Tab 0'} onPress={this.switchToTab} />
141
-                <Row title={'Toggle Nav Bar'} onPress={this.toggleNavBar} />
142
-                <Row title={'Show Snackbar'} onPress={this.showSnackbar} platform={'android'} />
143
-                <Row title={'Toggle Contextual Menu'} onPress={this.toggleContextualMenu} platform={'android'} />
144
-                <Row title={'Set Right Buttons'} onPress={this.setButtons} />
145
-                <Row title={'Toggle FAB'} onPress={this.toggleFAB} platform={'android'} />
145
+                <Row title={'Set Title'} onPress={this.setTitle}/>
146
+                <Row title={'Toggle Tabs'} onPress={this.toggleTabs}/>
147
+                <Row title={'Set Tab Badge'} onPress={this.setTabBadge}/>
148
+                <Row title={'Switch To Tab 0'} onPress={this.switchToTab}/>
149
+                <Row title={'Toggle Nav Bar'} onPress={this.toggleNavBar}/>
150
+                <Row title={'Show Snackbar'} onPress={this.showSnackbar} platform={'android'}/>
151
+                <Row title={'Toggle Contextual Menu'} onPress={this.toggleContextualMenu} platform={'android'}/>
152
+                <Row title={'Set Right Buttons'} onPress={this.setButtons}/>
153
+                <Row title={'Toggle FAB'} onPress={this.toggleFAB} platform={'android'}/>
146
             </ScrollView>
154
             </ScrollView>
147
         );
155
         );
148
     }
156
     }