Browse Source

merged from master

Daniel Zlotin 8 years ago
parent
commit
fa1d870fc0

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/layouts/SingleScreenLayout.java View File

47
     }
47
     }
48
 
48
 
49
     private void createLayout() {
49
     private void createLayout() {
50
-        if (leftSideMenuParams == null) {
50
+        if (leftSideMenuParams == null && rightSideMenuParams == null) {
51
             createStack(getScreenStackParent());
51
             createStack(getScreenStackParent());
52
         } else {
52
         } else {
53
             sideMenu = createSideMenu();
53
             sideMenu = createSideMenu();

+ 1
- 0
android/app/src/main/java/com/reactnativenavigation/params/BaseScreenParams.java View File

7
 public class BaseScreenParams {
7
 public class BaseScreenParams {
8
     public String screenId;
8
     public String screenId;
9
     public String title;
9
     public String title;
10
+    public String subtitle;
10
     public NavigationParams navigationParams;
11
     public NavigationParams navigationParams;
11
     public List<TitleBarButtonParams> rightButtons;
12
     public List<TitleBarButtonParams> rightButtons;
12
     public TitleBarLeftButtonParams leftButton;
13
     public TitleBarLeftButtonParams leftButton;

+ 1
- 0
android/app/src/main/java/com/reactnativenavigation/params/StyleParams.java View File

41
     public Color topBarColor;
41
     public Color topBarColor;
42
     public CollapsingTopBarParams collapsingTopBarParams;
42
     public CollapsingTopBarParams collapsingTopBarParams;
43
     public boolean topBarHidden;
43
     public boolean topBarHidden;
44
+    public boolean topBarElevationShadowEnabled;
44
     public boolean topTabsHidden;
45
     public boolean topTabsHidden;
45
     public boolean drawScreenBelowTopBar;
46
     public boolean drawScreenBelowTopBar;
46
 
47
 

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

12
 
12
 
13
 public class ScreenParamsParser extends Parser {
13
 public class ScreenParamsParser extends Parser {
14
     private static final String KEY_TITLE = "title";
14
     private static final String KEY_TITLE = "title";
15
+    private static final String KEY_SUBTITLE = "subtitle";
15
     private static final String KEY_SCREEN_ID = "screenId";
16
     private static final String KEY_SCREEN_ID = "screenId";
16
     private static final String KEY_NAVIGATION_PARAMS = "navigationParams";
17
     private static final String KEY_NAVIGATION_PARAMS = "navigationParams";
17
     private static final String STYLE_PARAMS = "styleParams";
18
     private static final String STYLE_PARAMS = "styleParams";
30
         result.styleParams = new StyleParamsParser(params.getBundle(STYLE_PARAMS)).parse();
31
         result.styleParams = new StyleParamsParser(params.getBundle(STYLE_PARAMS)).parse();
31
 
32
 
32
         result.title = params.getString(KEY_TITLE);
33
         result.title = params.getString(KEY_TITLE);
34
+        result.subtitle = params.getString(KEY_SUBTITLE);
33
         result.rightButtons = ButtonParser.parseRightButton(params);
35
         result.rightButtons = ButtonParser.parseRightButton(params);
34
         result.overrideBackPressInJs = params.getBoolean(OVERRIDE_BACK_PRESS, false);
36
         result.overrideBackPressInJs = params.getBoolean(OVERRIDE_BACK_PRESS, false);
35
         result.leftButton = ButtonParser.parseLeftButton(params);
37
         result.leftButton = ButtonParser.parseLeftButton(params);

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

17
         StyleParams result = new StyleParams();
17
         StyleParams result = new StyleParams();
18
         if (params == null) {
18
         if (params == null) {
19
             result.titleBarDisabledButtonColor = getTitleBarDisabledButtonColor();
19
             result.titleBarDisabledButtonColor = getTitleBarDisabledButtonColor();
20
+            result.topBarElevationShadowEnabled = true;
20
             return result;
21
             return result;
21
         }
22
         }
22
 
23
 
29
         result.collapsingTopBarParams = new CollapsingTopBarParamsParser(params).parse();
30
         result.collapsingTopBarParams = new CollapsingTopBarParamsParser(params).parse();
30
         result.titleBarHidden = getBoolean("titleBarHidden", getDefaultTopBarHidden());
31
         result.titleBarHidden = getBoolean("titleBarHidden", getDefaultTopBarHidden());
31
         result.topBarTransparent = getBoolean("topBarTransparent", getDefaultTopBarHidden());
32
         result.topBarTransparent = getBoolean("topBarTransparent", getDefaultTopBarHidden());
33
+        result.topBarElevationShadowEnabled = getBoolean("topBarElevationShadowEnabled", getDefaultTopBarElevationShadowEnabled());
32
         result.titleBarTitleColor = getColor("titleBarTitleColor", getDefaultTitleBarColor());
34
         result.titleBarTitleColor = getColor("titleBarTitleColor", getDefaultTitleBarColor());
33
         result.topBarTranslucent = getBoolean("topBarTranslucent", getDefaultTopBarTranslucent());
35
         result.topBarTranslucent = getBoolean("topBarTranslucent", getDefaultTopBarTranslucent());
34
         result.titleBarHideOnScroll = getBoolean("titleBarHideOnScroll", getDefaultTitleBarHideOnScroll());
36
         result.titleBarHideOnScroll = getBoolean("titleBarHideOnScroll", getDefaultTitleBarHideOnScroll());
173
         return AppStyle.appStyle != null && AppStyle.appStyle.topBarTransparent;
175
         return AppStyle.appStyle != null && AppStyle.appStyle.topBarTransparent;
174
     }
176
     }
175
 
177
 
178
+    private boolean getDefaultTopBarElevationShadowEnabled() {
179
+        return AppStyle.appStyle == null || AppStyle.appStyle.topBarElevationShadowEnabled;
180
+    }
181
+
176
     private boolean getDefaultTopBarTranslucent() {
182
     private boolean getDefaultTopBarTranslucent() {
177
         return AppStyle.appStyle != null && AppStyle.appStyle.topBarTranslucent;
183
         return AppStyle.appStyle != null && AppStyle.appStyle.topBarTranslucent;
178
     }
184
     }

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

87
     private void createTitleBar() {
87
     private void createTitleBar() {
88
         addTitleBarButtons();
88
         addTitleBarButtons();
89
         topBar.setTitle(screenParams.title);
89
         topBar.setTitle(screenParams.title);
90
+        topBar.setSubtitle(screenParams.subtitle);
90
     }
91
     }
91
 
92
 
92
     private void addTitleBarButtons() {
93
     private void addTitleBarButtons() {

+ 7
- 0
android/app/src/main/java/com/reactnativenavigation/views/TopBar.java View File

73
         setVisibility(styleParams.topBarHidden ? GONE : VISIBLE);
73
         setVisibility(styleParams.topBarHidden ? GONE : VISIBLE);
74
         titleBar.setStyle(styleParams);
74
         titleBar.setStyle(styleParams);
75
         setTopTabsStyle(styleParams);
75
         setTopTabsStyle(styleParams);
76
+        if (!styleParams.topBarElevationShadowEnabled) {
77
+            disableElevationShadow();
78
+        }
76
     }
79
     }
77
 
80
 
78
     private void setTransparent() {
81
     private void setTransparent() {
79
         setBackgroundColor(Color.TRANSPARENT);
82
         setBackgroundColor(Color.TRANSPARENT);
83
+        disableElevationShadow();
84
+    }
85
+
86
+    private void disableElevationShadow() {
80
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
87
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
81
             setOutlineProvider(null);
88
             setOutlineProvider(null);
82
         }
89
         }

+ 0
- 1
example/scripts/postinstall.js View File

1
 const cp = require('child_process');
1
 const cp = require('child_process');
2
 cp.execSync(`rm -rf node_modules/react-native-navigation/node_modules`);
2
 cp.execSync(`rm -rf node_modules/react-native-navigation/node_modules`);
3
 cp.execSync(`rm -rf node_modules/react-native-navigation/example `);
3
 cp.execSync(`rm -rf node_modules/react-native-navigation/example `);
4
-cp.execSync(`rm -rf yarn.lock`);

+ 2
- 1
example/src/screens/PushedScreen.js View File

60
   onResetToPress() {
60
   onResetToPress() {
61
     this.props.navigator.resetTo({
61
     this.props.navigator.resetTo({
62
       title: "New Root",
62
       title: "New Root",
63
-      screen: "example.ThirdTabScreen"
63
+      screen: "example.StyledScreen",
64
+      animated: true
64
     });
65
     });
65
   }
66
   }
66
 }
67
 }

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

120
     topBarColor: processColor(originalStyleObject.navBarBackgroundColor),
120
     topBarColor: processColor(originalStyleObject.navBarBackgroundColor),
121
     topBarTransparent: originalStyleObject.navBarTransparent,
121
     topBarTransparent: originalStyleObject.navBarTransparent,
122
     topBarTranslucent: originalStyleObject.navBarTranslucent,
122
     topBarTranslucent: originalStyleObject.navBarTranslucent,
123
+    topBarElevationShadowEnabled: originalStyleObject.topBarElevationShadowEnabled,
123
     collapsingToolBarImage: originalStyleObject.collapsingToolBarImage,
124
     collapsingToolBarImage: originalStyleObject.collapsingToolBarImage,
124
     collapsingToolBarCollapsedColor: processColor(originalStyleObject.collapsingToolBarCollapsedColor),
125
     collapsingToolBarCollapsedColor: processColor(originalStyleObject.collapsingToolBarCollapsedColor),
125
     titleBarHidden: originalStyleObject.navBarHidden,
126
     titleBarHidden: originalStyleObject.navBarHidden,

+ 2
- 0
src/deprecated/platformSpecificDeprecated.ios.js View File

55
                                disableOpenGesture={params.drawer.disableOpenGesture}
55
                                disableOpenGesture={params.drawer.disableOpenGesture}
56
                                type={params.drawer.type ? params.drawer.type : 'MMDrawer'}
56
                                type={params.drawer.type ? params.drawer.type : 'MMDrawer'}
57
                                animationType={params.drawer.animationType ? params.drawer.animationType : 'slide'}
57
                                animationType={params.drawer.animationType ? params.drawer.animationType : 'slide'}
58
+                               style={params.drawer.style}
58
           >
59
           >
59
             {this.renderBody()}
60
             {this.renderBody()}
60
           </DrawerControllerIOS>
61
           </DrawerControllerIOS>
141
                                disableOpenGesture={params.drawer.disableOpenGesture}
142
                                disableOpenGesture={params.drawer.disableOpenGesture}
142
                                type={params.drawer.type ? params.drawer.type : 'MMDrawer'}
143
                                type={params.drawer.type ? params.drawer.type : 'MMDrawer'}
143
                                animationType={params.drawer.animationType ? params.drawer.animationType : 'slide'}
144
                                animationType={params.drawer.animationType ? params.drawer.animationType : 'slide'}
145
+                               style={params.drawer.style}
144
           >
146
           >
145
             {this.renderBody()}
147
             {this.renderBody()}
146
           </DrawerControllerIOS>
148
           </DrawerControllerIOS>