Daniel Zlotin 8 years ago
parent
commit
5750f72a7d

+ 0
- 12
android/app/src/main/java/com/reactnativenavigation/params/parsers/StyleParamsParser.java View File

2
 
2
 
3
 import android.graphics.Color;
3
 import android.graphics.Color;
4
 import android.os.Bundle;
4
 import android.os.Bundle;
5
-import android.support.annotation.NonNull;
6
-import android.support.annotation.Nullable;
7
 
5
 
8
 import com.reactnativenavigation.params.AppStyle;
6
 import com.reactnativenavigation.params.AppStyle;
9
 import com.reactnativenavigation.params.StyleParams;
7
 import com.reactnativenavigation.params.StyleParams;
72
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.selectedTopTabTextColor;
70
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.selectedTopTabTextColor;
73
     }
71
     }
74
 
72
 
75
-    @Nullable
76
     private StyleParams.Color getDefaultNavigationColor() {
73
     private StyleParams.Color getDefaultNavigationColor() {
77
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.navigationBarColor;
74
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.navigationBarColor;
78
     }
75
     }
81
         return AppStyle.appStyle != null && AppStyle.appStyle.forceTitlesDisplay;
78
         return AppStyle.appStyle != null && AppStyle.appStyle.forceTitlesDisplay;
82
     }
79
     }
83
 
80
 
84
-    @Nullable
85
     private StyleParams.Color getDefaultSelectedBottomTabsButtonColor() {
81
     private StyleParams.Color getDefaultSelectedBottomTabsButtonColor() {
86
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.selectedBottomTabsButtonColor;
82
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.selectedBottomTabsButtonColor;
87
     }
83
     }
88
 
84
 
89
-    @Nullable
90
     private StyleParams.Color getDefaultBottomTabsButtonColor() {
85
     private StyleParams.Color getDefaultBottomTabsButtonColor() {
91
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.bottomTabsButtonColor;
86
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.bottomTabsButtonColor;
92
     }
87
     }
93
 
88
 
94
-    @Nullable
95
     private StyleParams.Color getDefaultBottomTabsColor() {
89
     private StyleParams.Color getDefaultBottomTabsColor() {
96
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.bottomTabsColor;
90
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.bottomTabsColor;
97
     }
91
     }
120
         return AppStyle.appStyle != null && AppStyle.appStyle.backButtonHidden;
114
         return AppStyle.appStyle != null && AppStyle.appStyle.backButtonHidden;
121
     }
115
     }
122
 
116
 
123
-    @Nullable
124
     private StyleParams.Color getDefaultTitleBarColor() {
117
     private StyleParams.Color getDefaultTitleBarColor() {
125
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.titleBarTitleColor;
118
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.titleBarTitleColor;
126
     }
119
     }
127
 
120
 
128
-    @Nullable
129
     private StyleParams.Color getTitleBarButtonColor() {
121
     private StyleParams.Color getTitleBarButtonColor() {
130
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.titleBarButtonColor;
122
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.titleBarButtonColor;
131
     }
123
     }
132
 
124
 
133
-    @Nullable
134
     private StyleParams.Color getTitleBarDisabledButtonColor() {
125
     private StyleParams.Color getTitleBarDisabledButtonColor() {
135
         return AppStyle.appStyle == null ? new StyleParams.Color(Color.LTGRAY) : AppStyle.appStyle.titleBarDisabledButtonColor;
126
         return AppStyle.appStyle == null ? new StyleParams.Color(Color.LTGRAY) : AppStyle.appStyle.titleBarDisabledButtonColor;
136
     }
127
     }
139
         return AppStyle.appStyle != null && AppStyle.appStyle.titleBarHidden;
130
         return AppStyle.appStyle != null && AppStyle.appStyle.titleBarHidden;
140
     }
131
     }
141
 
132
 
142
-    @Nullable
143
     private StyleParams.Color getDefaultTopBarColor() {
133
     private StyleParams.Color getDefaultTopBarColor() {
144
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.topBarColor;
134
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.topBarColor;
145
     }
135
     }
146
 
136
 
147
-    @Nullable
148
     private StyleParams.Color getDefaultStatusBarColor() {
137
     private StyleParams.Color getDefaultStatusBarColor() {
149
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.statusBarColor;
138
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.statusBarColor;
150
     }
139
     }
153
         return params.containsKey(key) ? params.getBoolean(key) : defaultValue;
142
         return params.containsKey(key) ? params.getBoolean(key) : defaultValue;
154
     }
143
     }
155
 
144
 
156
-    @NonNull
157
     private StyleParams.Color getColor(String key, StyleParams.Color defaultColor) {
145
     private StyleParams.Color getColor(String key, StyleParams.Color defaultColor) {
158
         StyleParams.Color color = StyleParams.Color.parse(params.getString(key));
146
         StyleParams.Color color = StyleParams.Color.parse(params.getString(key));
159
         if (color.hasColor()) {
147
         if (color.hasColor()) {

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

111
         final Screen previous = stack.peek();
111
         final Screen previous = stack.peek();
112
 
112
 
113
         if (keyboardVisibilityDetector.isKeyboardVisible()) {
113
         if (keyboardVisibilityDetector.isKeyboardVisible()) {
114
-            keyboardVisibilityDetector.closeKeyboard(new Runnable() {
114
+            keyboardVisibilityDetector.setKeyboardCloseListener(new Runnable() {
115
                 @Override
115
                 @Override
116
                 public void run() {
116
                 public void run() {
117
+                    keyboardVisibilityDetector.setKeyboardCloseListener(null);
117
                     swapScreens(animated, toRemove, previous, onScreenPop);
118
                     swapScreens(animated, toRemove, previous, onScreenPop);
118
                 }
119
                 }
119
             });
120
             });
121
+            keyboardVisibilityDetector.closeKeyboard();
120
         } else {
122
         } else {
121
             swapScreens(animated, toRemove, previous, onScreenPop);
123
             swapScreens(animated, toRemove, previous, onScreenPop);
122
         }
124
         }

+ 5
- 2
android/app/src/main/java/com/reactnativenavigation/utils/KeyboardVisibilityDetector.java View File

26
         return keyboardVisibilityListener.isKeyboardVisible();
26
         return keyboardVisibilityListener.isKeyboardVisible();
27
     }
27
     }
28
 
28
 
29
-    public void closeKeyboard(Runnable keyboardClosedListener) {
30
-        this.keyboardCloseListener = keyboardClosedListener;
29
+    public void setKeyboardCloseListener(Runnable keyboardCloseListener) {
30
+        this.keyboardCloseListener = keyboardCloseListener;
31
+    }
32
+
33
+    public void closeKeyboard() {
31
         InputMethodManager imm = (InputMethodManager) screen.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
34
         InputMethodManager imm = (InputMethodManager) screen.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
32
         imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
35
         imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
33
     }
36
     }

+ 1
- 1
package.json View File

7
     "type": "git",
7
     "type": "git",
8
     "url": "https://github.com/wix/react-native-navigation.git"
8
     "url": "https://github.com/wix/react-native-navigation.git"
9
   },
9
   },
10
-  "version": "2.0.0-experimental.64",
10
+  "version": "2.0.0-experimental.66",
11
   "description": "React Native Navigation - truly native navigation for iOS and Android",
11
   "description": "React Native Navigation - truly native navigation for iOS and Android",
12
   "nativePackage": true,
12
   "nativePackage": true,
13
   "bugs": {
13
   "bugs": {

+ 20
- 4
src/Navigation.js View File

29
 
29
 
30
       constructor(props) {
30
       constructor(props) {
31
         super(props);
31
         super(props);
32
-        this.allProps = {...props, ...PropRegistry.load(props.screenInstanceID)};
32
+        this.state = {
33
+          internalProps: {...props, ...PropRegistry.load(props.screenInstanceID)}
34
+        }
35
+      }
36
+  
37
+      componentWillReceiveProps(nextProps) {
38
+        this.setState({
39
+          internalProps: {...PropRegistry.load(this.props.screenInstanceID), ...nextProps}
40
+        })
33
       }
41
       }
34
 
42
 
35
       render() {
43
       render() {
36
         return (
44
         return (
37
-          <InternalComponent navigator={this.navigator} {...this.allProps} />
45
+          <InternalComponent navigator={this.navigator} {...this.state.internalProps} />
38
         );
46
         );
39
       }
47
       }
40
     };
48
     };
52
 
60
 
53
       constructor(props) {
61
       constructor(props) {
54
         super(props);
62
         super(props);
55
-        this.allProps = {...props, ...PropRegistry.load(props.screenInstanceID)};
63
+        this.state = {
64
+          internalProps: {...props, ...PropRegistry.load(props.screenInstanceID)}
65
+        }
66
+      }
67
+      
68
+      componentWillReceiveProps(nextProps) {
69
+        this.setState({
70
+          internalProps: {...PropRegistry.load(this.props.screenInstanceID), ...nextProps}
71
+        })
56
       }
72
       }
57
 
73
 
58
       render() {
74
       render() {
59
         return (
75
         return (
60
           <Provider store={store}>
76
           <Provider store={store}>
61
-            <InternalComponent navigator={this.navigator} {...this.allProps} />
77
+            <InternalComponent navigator={this.navigator} {...this.state.internalProps} />
62
           </Provider>
78
           </Provider>
63
         );
79
         );
64
       }
80
       }

+ 1
- 0
src/deprecated/platformSpecificDeprecated.android.js View File

115
     titleBarHidden: originalStyleObject.navBarHidden,
115
     titleBarHidden: originalStyleObject.navBarHidden,
116
     titleBarTitleColor: originalStyleObject.navBarTextColor,
116
     titleBarTitleColor: originalStyleObject.navBarTextColor,
117
     titleBarButtonColor: originalStyleObject.navBarButtonColor,
117
     titleBarButtonColor: originalStyleObject.navBarButtonColor,
118
+    titleBarDisabledButtonColor: originalStyleObject.titleBarDisabledButtonColor,
118
     backButtonHidden: originalStyleObject.backButtonHidden,
119
     backButtonHidden: originalStyleObject.backButtonHidden,
119
     topTabsHidden: originalStyleObject.topTabsHidden,
120
     topTabsHidden: originalStyleObject.topTabsHidden,
120
 
121