Browse Source

merged from master

Daniel Zlotin 7 years ago
parent
commit
fa1d870fc0

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

@@ -47,7 +47,7 @@ public class SingleScreenLayout extends RelativeLayout implements Layout {
47 47
     }
48 48
 
49 49
     private void createLayout() {
50
-        if (leftSideMenuParams == null) {
50
+        if (leftSideMenuParams == null && rightSideMenuParams == null) {
51 51
             createStack(getScreenStackParent());
52 52
         } else {
53 53
             sideMenu = createSideMenu();

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

@@ -7,6 +7,7 @@ import java.util.List;
7 7
 public class BaseScreenParams {
8 8
     public String screenId;
9 9
     public String title;
10
+    public String subtitle;
10 11
     public NavigationParams navigationParams;
11 12
     public List<TitleBarButtonParams> rightButtons;
12 13
     public TitleBarLeftButtonParams leftButton;

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

@@ -41,6 +41,7 @@ public class StyleParams {
41 41
     public Color topBarColor;
42 42
     public CollapsingTopBarParams collapsingTopBarParams;
43 43
     public boolean topBarHidden;
44
+    public boolean topBarElevationShadowEnabled;
44 45
     public boolean topTabsHidden;
45 46
     public boolean drawScreenBelowTopBar;
46 47
 

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

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

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

@@ -17,6 +17,7 @@ public class StyleParamsParser {
17 17
         StyleParams result = new StyleParams();
18 18
         if (params == null) {
19 19
             result.titleBarDisabledButtonColor = getTitleBarDisabledButtonColor();
20
+            result.topBarElevationShadowEnabled = true;
20 21
             return result;
21 22
         }
22 23
 
@@ -29,6 +30,7 @@ public class StyleParamsParser {
29 30
         result.collapsingTopBarParams = new CollapsingTopBarParamsParser(params).parse();
30 31
         result.titleBarHidden = getBoolean("titleBarHidden", getDefaultTopBarHidden());
31 32
         result.topBarTransparent = getBoolean("topBarTransparent", getDefaultTopBarHidden());
33
+        result.topBarElevationShadowEnabled = getBoolean("topBarElevationShadowEnabled", getDefaultTopBarElevationShadowEnabled());
32 34
         result.titleBarTitleColor = getColor("titleBarTitleColor", getDefaultTitleBarColor());
33 35
         result.topBarTranslucent = getBoolean("topBarTranslucent", getDefaultTopBarTranslucent());
34 36
         result.titleBarHideOnScroll = getBoolean("titleBarHideOnScroll", getDefaultTitleBarHideOnScroll());
@@ -173,6 +175,10 @@ public class StyleParamsParser {
173 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 182
     private boolean getDefaultTopBarTranslucent() {
177 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,6 +87,7 @@ public abstract class Screen extends RelativeLayout implements Subscriber {
87 87
     private void createTitleBar() {
88 88
         addTitleBarButtons();
89 89
         topBar.setTitle(screenParams.title);
90
+        topBar.setSubtitle(screenParams.subtitle);
90 91
     }
91 92
 
92 93
     private void addTitleBarButtons() {

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

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

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

@@ -1,4 +1,3 @@
1 1
 const cp = require('child_process');
2 2
 cp.execSync(`rm -rf node_modules/react-native-navigation/node_modules`);
3 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,7 +60,8 @@ export default class PushedScreen extends Component {
60 60
   onResetToPress() {
61 61
     this.props.navigator.resetTo({
62 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,6 +120,7 @@ function convertStyleParams(originalStyleObject) {
120 120
     topBarColor: processColor(originalStyleObject.navBarBackgroundColor),
121 121
     topBarTransparent: originalStyleObject.navBarTransparent,
122 122
     topBarTranslucent: originalStyleObject.navBarTranslucent,
123
+    topBarElevationShadowEnabled: originalStyleObject.topBarElevationShadowEnabled,
123 124
     collapsingToolBarImage: originalStyleObject.collapsingToolBarImage,
124 125
     collapsingToolBarCollapsedColor: processColor(originalStyleObject.collapsingToolBarCollapsedColor),
125 126
     titleBarHidden: originalStyleObject.navBarHidden,

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

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