Procházet zdrojové kódy

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

Also listen to contextualMenuDismissed event in Actions screen
Guy Carmeli před 7 roky
rodič
revize
a34ccb61a0

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/screens/Screen.java Zobrazit soubor

@@ -74,8 +74,8 @@ public abstract class Screen extends RelativeLayout implements Subscriber {
74 74
     @Override
75 75
     public void onEvent(Event event) {
76 76
         if (ContextualMenuHiddenEvent.TYPE.equals(event.getType()) && isShown()) {
77
-            setStyle();
78 77
             topBar.onContextualMenuHidden();
78
+            setStyle();
79 79
         }
80 80
         if (ViewPagerScreenChangedEvent.TYPE.equals(event.getType()) && isShown() ) {
81 81
             topBar.dismissContextualMenu();

+ 20
- 12
example/src/screens/Actions.js Zobrazit soubor

@@ -1,17 +1,25 @@
1 1
 import React from 'react';
2
-import { StyleSheet, ScrollView } from 'react-native';
2
+import {StyleSheet, ScrollView} from 'react-native';
3 3
 import Row from '../components/Row';
4 4
 
5 5
 class Actions extends React.Component {
6 6
 
7
-    constructor() {
8
-        super();
7
+    constructor(props) {
8
+        super(props);
9 9
 
10 10
         this._fab = false;
11 11
         this._rightButton = null;
12 12
         this._contextualMenu = false;
13 13
         this._toggleTabs = 'shown';
14 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 25
     setTitle = () => {
@@ -134,15 +142,15 @@ class Actions extends React.Component {
134 142
     render() {
135 143
         return (
136 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 154
             </ScrollView>
147 155
         );
148 156
     }