Browse Source

V2 nested (#2194)

* readme

* WIP

* ios, tests

* refactoring

* test fix

* probabl test fix
Roman Kozlov 6 years ago
parent
commit
af85704c02

+ 2
- 2
README.md View File

66
 | showModal              |  ✅        |	✅|
66
 | showModal              |  ✅        |	✅|
67
 | dismissModal           |     ✅       |	✅|
67
 | dismissModal           |     ✅       |	✅|
68
 | showOverlay             |  [Contribute](/docs/docs/CONTRIBUTING.md)         |	WIP @cool04ek |
68
 | showOverlay             |  [Contribute](/docs/docs/CONTRIBUTING.md)         |	WIP @cool04ek |
69
-| dismissOverlay             |  [Contribute](/docs/docs/CONTRIBUTING.md)         |	[Contribute](/docs/docs/CONTRIBUTING.md) |
69
+| dismissOverlay             |  [Contribute](/docs/docs/CONTRIBUTING.md)         |	WIP @cool04ek |
70
 | customTransition            |   ✅        |	[Contribute](/docs/docs/CONTRIBUTING.md) |
70
 | customTransition            |   ✅        |	[Contribute](/docs/docs/CONTRIBUTING.md) |
71
 | Screen Visibility        | ✅     |✅|
71
 | Screen Visibility        | ✅     |✅|
72
-| async commands (await push)     |  [Contribute](/docs/docs/CONTRIBUTING.md)        |[Contribute](/docs/docs/CONTRIBUTING.md)   |
72
+| async commands (await push)     |  [Contribute](/docs/docs/CONTRIBUTING.md)        | WIP @cool04ek   |
73
 
73
 
74
 ### Navigation Options
74
 ### Navigation Options
75
 
75
 

+ 1
- 1
e2e/ScreenStyle.test.js View File

48
   it('set Tab Bar badge on a current Tab', async () => {
48
   it('set Tab Bar badge on a current Tab', async () => {
49
     await elementByLabel('Switch to tab based app').tap();
49
     await elementByLabel('Switch to tab based app').tap();
50
     await elementByLabel('Set Tab Badge').tap();
50
     await elementByLabel('Set Tab Badge').tap();
51
-    await expect(element(by.text('EnCyClOpEdIa'))).toBeVisible();
51
+    await expect(element(by.text('TeSt'))).toBeVisible();
52
   });
52
   });
53
 
53
 
54
   it('set right buttons', async () => {
54
   it('set right buttons', async () => {

+ 11
- 0
lib/android/app/src/main/java/com/reactnativenavigation/parse/DEFAULT_VALUES.java View File

1
+package com.reactnativenavigation.parse;
2
+
3
+
4
+import android.graphics.Color;
5
+
6
+interface DEFAULT_VALUES {
7
+	String NO_VALUE = "";
8
+	int NO_INT_VALUE = Integer.MIN_VALUE;
9
+	float NO_FLOAT_VALUE = Float.MIN_VALUE;
10
+	int NO_COLOR_VALUE = Color.TRANSPARENT;
11
+}

+ 4
- 37
lib/android/app/src/main/java/com/reactnativenavigation/parse/NavigationOptions.java View File

6
 
6
 
7
 import org.json.JSONObject;
7
 import org.json.JSONObject;
8
 
8
 
9
-public class NavigationOptions {
10
-
11
-	private static final String NO_VALUE = "";
12
-	private static final int NO_INT_VALUE = Integer.MIN_VALUE;
13
-	private static final float NO_FLOAT_VALUE = Float.MIN_VALUE;
14
-	private static final int NO_COLOR_VALUE = Color.TRANSPARENT;
9
+public class NavigationOptions implements DEFAULT_VALUES {
15
 
10
 
16
 	public enum BooleanOptions {
11
 	public enum BooleanOptions {
17
 		True,
12
 		True,
31
 		NavigationOptions result = new NavigationOptions();
26
 		NavigationOptions result = new NavigationOptions();
32
 		if (json == null) return result;
27
 		if (json == null) return result;
33
 
28
 
34
-		result.title = json.optString("title", NO_VALUE);
35
-		result.topBarBackgroundColor = json.optInt("topBarBackgroundColor", NO_COLOR_VALUE);
36
-		result.topBarTextColor = json.optInt("topBarTextColor", NO_INT_VALUE);
37
-		result.topBarTextFontSize = (float) json.optDouble("topBarTextFontSize", NO_FLOAT_VALUE);
38
-		result.topBarTextFontFamily = json.optString("topBarTextFontFamily", NO_VALUE);
39
-		result.topBarHidden = BooleanOptions.parse(json.optString("topBarHidden"));
40
-		result.animateTopBarHide = BooleanOptions.parse(json.optString("animateTopBarHide"));
29
+		result.topBarOptions = TopBarOptions.parse(json.optJSONObject("topBar"));
41
 
30
 
42
 		return result;
31
 		return result;
43
 	}
32
 	}
44
 
33
 
45
-	public String title = "";
46
-	@ColorInt
47
-	public int topBarBackgroundColor;
48
-	@ColorInt
49
-	public int topBarTextColor;
50
-	public float topBarTextFontSize;
51
-	public String topBarTextFontFamily;
52
-	public BooleanOptions topBarHidden = BooleanOptions.False;
53
-	public BooleanOptions animateTopBarHide = BooleanOptions.False;
34
+	public TopBarOptions topBarOptions = new TopBarOptions();
54
 
35
 
55
 	public void mergeWith(final NavigationOptions other) {
36
 	public void mergeWith(final NavigationOptions other) {
56
-		if (!NO_VALUE.equals(other.title)) title = other.title;
57
-		if (other.topBarBackgroundColor != NO_COLOR_VALUE)
58
-			topBarBackgroundColor = other.topBarBackgroundColor;
59
-		if (other.topBarTextColor != NO_INT_VALUE)
60
-			topBarTextColor = other.topBarTextColor;
61
-		if (other.topBarTextFontSize != NO_FLOAT_VALUE)
62
-			topBarTextFontSize = other.topBarTextFontSize;
63
-		if (!NO_VALUE.equals(other.topBarTextFontFamily))
64
-			topBarTextFontFamily = other.topBarTextFontFamily;
65
-		if (other.topBarHidden != BooleanOptions.NoValue) {
66
-			topBarHidden = other.topBarHidden;
67
-		}
68
-		if (other.animateTopBarHide != BooleanOptions.NoValue) {
69
-			animateTopBarHide = other.animateTopBarHide;
70
-		}
37
+		topBarOptions.mergeWith(other.topBarOptions);
71
 	}
38
 	}
72
 }
39
 }

+ 52
- 0
lib/android/app/src/main/java/com/reactnativenavigation/parse/TopBarOptions.java View File

1
+package com.reactnativenavigation.parse;
2
+
3
+
4
+import android.support.annotation.ColorInt;
5
+
6
+import org.json.JSONObject;
7
+
8
+public class TopBarOptions implements DEFAULT_VALUES {
9
+
10
+	public static TopBarOptions parse(JSONObject json) {
11
+		TopBarOptions options = new TopBarOptions();
12
+		if (json == null) return options;
13
+
14
+		options.title = json.optString("title", NO_VALUE);
15
+		options.backgroundColor = json.optInt("backgroundColor", NO_COLOR_VALUE);
16
+		options.textColor = json.optInt("textColor", NO_INT_VALUE);
17
+		options.textFontSize = (float) json.optDouble("textFontSize", NO_FLOAT_VALUE);
18
+		options.textFontFamily = json.optString("textFontFamily", NO_VALUE);
19
+		options.hidden = NavigationOptions.BooleanOptions.parse(json.optString("hidden"));
20
+		options.animateHide = NavigationOptions.BooleanOptions.parse(json.optString("animateHide"));
21
+
22
+		return options;
23
+	}
24
+
25
+	public String title = "";
26
+	@ColorInt
27
+	public int backgroundColor;
28
+	@ColorInt
29
+	public int textColor;
30
+	public float textFontSize;
31
+	public String textFontFamily;
32
+	public NavigationOptions.BooleanOptions hidden = NavigationOptions.BooleanOptions.False;
33
+	public NavigationOptions.BooleanOptions animateHide = NavigationOptions.BooleanOptions.False;
34
+
35
+	void mergeWith(final TopBarOptions other) {
36
+		if (!NO_VALUE.equals(other.title)) title = other.title;
37
+		if (other.backgroundColor != NO_COLOR_VALUE)
38
+			backgroundColor = other.backgroundColor;
39
+		if (other.textColor != NO_INT_VALUE)
40
+			textColor = other.textColor;
41
+		if (other.textFontSize != NO_FLOAT_VALUE)
42
+			textFontSize = other.textFontSize;
43
+		if (!NO_VALUE.equals(other.textFontFamily))
44
+			textFontFamily = other.textFontFamily;
45
+		if (other.hidden != NavigationOptions.BooleanOptions.NoValue) {
46
+			hidden = other.hidden;
47
+		}
48
+		if (other.animateHide != NavigationOptions.BooleanOptions.NoValue) {
49
+			animateHide = other.animateHide;
50
+		}
51
+	}
52
+}

+ 9
- 10
lib/android/app/src/main/java/com/reactnativenavigation/presentation/OptionsPresenter.java View File

1
 package com.reactnativenavigation.presentation;
1
 package com.reactnativenavigation.presentation;
2
 
2
 
3
-import android.util.Log;
4
 import android.view.View;
3
 import android.view.View;
5
 
4
 
6
 import com.reactnativenavigation.anim.StackAnimator;
5
 import com.reactnativenavigation.anim.StackAnimator;
21
 
20
 
22
 	public void applyOptions(NavigationOptions options) {
21
 	public void applyOptions(NavigationOptions options) {
23
 		if (controller != null && controller.getTopBar() != null) {
22
 		if (controller != null && controller.getTopBar() != null) {
24
-			controller.getTopBar().setTitle(options.title);
25
-			controller.getTopBar().setBackgroundColor(options.topBarBackgroundColor);
26
-			controller.getTopBar().setTitleTextColor(options.topBarTextColor);
27
-			controller.getTopBar().setTitleFontSize(options.topBarTextFontSize);
23
+			controller.getTopBar().setTitle(options.topBarOptions.title);
24
+			controller.getTopBar().setBackgroundColor(options.topBarOptions.backgroundColor);
25
+			controller.getTopBar().setTitleTextColor(options.topBarOptions.textColor);
26
+			controller.getTopBar().setTitleFontSize(options.topBarOptions.textFontSize);
28
 			TypefaceLoader typefaceLoader = new TypefaceLoader();
27
 			TypefaceLoader typefaceLoader = new TypefaceLoader();
29
-			controller.getTopBar().setTitleTypeface(typefaceLoader.getTypeFace(controller.getActivity(), options.topBarTextFontFamily));
28
+			controller.getTopBar().setTitleTypeface(typefaceLoader.getTypeFace(controller.getActivity(), options.topBarOptions.textFontFamily));
30
 			applyTopbarHiddenOptions(options);
29
 			applyTopbarHiddenOptions(options);
31
 		}
30
 		}
32
 	}
31
 	}
33
 
32
 
34
 	private void applyTopbarHiddenOptions(NavigationOptions options) {
33
 	private void applyTopbarHiddenOptions(NavigationOptions options) {
35
-		if (options.topBarHidden == NavigationOptions.BooleanOptions.True) {
36
-			hideTopbar(options.animateTopBarHide);
34
+		if (options.topBarOptions.hidden == NavigationOptions.BooleanOptions.True) {
35
+			hideTopbar(options.topBarOptions.animateHide);
37
 		}
36
 		}
38
-		if (options.topBarHidden == NavigationOptions.BooleanOptions.False) {
39
-			showTopbar(options.animateTopBarHide);
37
+		if (options.topBarOptions.hidden == NavigationOptions.BooleanOptions.False) {
38
+			showTopbar(options.topBarOptions.animateHide);
40
 		}
39
 		}
41
 	}
40
 	}
42
 
41
 

+ 17
- 13
lib/android/app/src/test/java/com/reactnativenavigation/parse/NavigationOptionsTest.java View File

18
 	@Test
18
 	@Test
19
 	public void parsesJson() throws Exception {
19
 	public void parsesJson() throws Exception {
20
 		JSONObject json = new JSONObject();
20
 		JSONObject json = new JSONObject();
21
-		json.put("title", "the title");
22
-		json.put("topBarBackgroundColor", 0xff123456);
23
-		json.put("topBarTextColor", 0xff123456);
24
-		json.put("topBarTextFontSize", 18);
25
-		json.put("topBarTextFontFamily", "HelveticaNeue-CondensedBold");
26
-		json.put("topBarHidden", true);
21
+		JSONObject topBarJson = new JSONObject();
22
+
23
+		topBarJson.put("title", "the title");
24
+		topBarJson.put("backgroundColor", 0xff123456);
25
+		topBarJson.put("textColor", 0xff123456);
26
+		topBarJson.put("textFontSize", 18);
27
+		topBarJson.put("textFontFamily", "HelveticaNeue-CondensedBold");
28
+		topBarJson.put("hidden", true);
29
+
30
+		json.put("topBar", topBarJson);
27
 
31
 
28
 		NavigationOptions result = NavigationOptions.parse(json);
32
 		NavigationOptions result = NavigationOptions.parse(json);
29
-		assertThat(result.title).isEqualTo("the title");
30
-		assertThat(result.topBarBackgroundColor).isEqualTo(0xff123456);
31
-		assertThat(result.topBarTextColor).isEqualTo(0xff123456);
32
-		assertThat(result.topBarTextFontSize).isEqualTo(18);
33
-		assertThat(result.topBarTextFontFamily).isEqualTo("HelveticaNeue-CondensedBold");
34
-		assertThat(result.topBarHidden).isEqualTo(True);
33
+		assertThat(result.topBarOptions.title).isEqualTo("the title");
34
+		assertThat(result.topBarOptions.backgroundColor).isEqualTo(0xff123456);
35
+		assertThat(result.topBarOptions.textColor).isEqualTo(0xff123456);
36
+		assertThat(result.topBarOptions.textFontSize).isEqualTo(18);
37
+		assertThat(result.topBarOptions.textFontFamily).isEqualTo("HelveticaNeue-CondensedBold");
38
+		assertThat(result.topBarOptions.hidden).isEqualTo(True);
35
 	}
39
 	}
36
 
40
 
37
 	@Test
41
 	@Test
38
 	public void defaultEmptyOptions() throws Exception {
42
 	public void defaultEmptyOptions() throws Exception {
39
 		NavigationOptions uut = new NavigationOptions();
43
 		NavigationOptions uut = new NavigationOptions();
40
-		assertThat(uut.title).isEmpty();
44
+		assertThat(uut.topBarOptions.title).isEmpty();
41
 	}
45
 	}
42
 }
46
 }

+ 3
- 3
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/NavigatorTest.java View File

193
 	public void setOptions_CallsApplyNavigationOptions() {
193
 	public void setOptions_CallsApplyNavigationOptions() {
194
 		ContainerViewController containerVc = new SimpleContainerViewController(activity, "theId");
194
 		ContainerViewController containerVc = new SimpleContainerViewController(activity, "theId");
195
 		uut.setRoot(containerVc);
195
 		uut.setRoot(containerVc);
196
-		assertThat(containerVc.getNavigationOptions().title).isEmpty();
196
+		assertThat(containerVc.getNavigationOptions().topBarOptions.title).isEmpty();
197
 
197
 
198
 		NavigationOptions options = new NavigationOptions();
198
 		NavigationOptions options = new NavigationOptions();
199
-		options.title = "new title";
199
+		options.topBarOptions.title = "new title";
200
 
200
 
201
 		uut.setOptions("theId", options);
201
 		uut.setOptions("theId", options);
202
-		assertThat(containerVc.getNavigationOptions().title).isEqualTo("new title");
202
+		assertThat(containerVc.getNavigationOptions().topBarOptions.title).isEqualTo("new title");
203
 	}
203
 	}
204
 
204
 
205
 	@Test
205
 	@Test

+ 14
- 14
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsApplyingTest.java View File

50
 	@Test
50
 	@Test
51
 	public void initialOptionsAppliedOnAppear() throws Exception {
51
 	public void initialOptionsAppliedOnAppear() throws Exception {
52
 		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
52
 		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
53
-		initialNavigationOptions.title = "the title";
53
+		initialNavigationOptions.topBarOptions.title = "the title";
54
 		StackController stackController = new StackController(activity, "stackId");
54
 		StackController stackController = new StackController(activity, "stackId");
55
 		stackController.push(uut);
55
 		stackController.push(uut);
56
 		assertThat(uut.getTopBar().getTitle()).isEmpty();
56
 		assertThat(uut.getTopBar().getTitle()).isEmpty();
61
 
61
 
62
 	@Test
62
 	@Test
63
 	public void mergeNavigationOptionsUpdatesCurrentOptions() throws Exception {
63
 	public void mergeNavigationOptionsUpdatesCurrentOptions() throws Exception {
64
-		assertThat(uut.getNavigationOptions().title).isEmpty();
64
+		assertThat(uut.getNavigationOptions().topBarOptions.title).isEmpty();
65
 		NavigationOptions options = new NavigationOptions();
65
 		NavigationOptions options = new NavigationOptions();
66
-		options.title = "new title";
66
+		options.topBarOptions.title = "new title";
67
 		uut.mergeNavigationOptions(options);
67
 		uut.mergeNavigationOptions(options);
68
-		assertThat(uut.getNavigationOptions().title).isEqualTo("new title");
68
+		assertThat(uut.getNavigationOptions().topBarOptions.title).isEqualTo("new title");
69
 		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
69
 		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
70
 	}
70
 	}
71
 
71
 
75
 		assertThat(uut.getTopBar().getTitle()).isEmpty();
75
 		assertThat(uut.getTopBar().getTitle()).isEmpty();
76
 
76
 
77
 		NavigationOptions opts = new NavigationOptions();
77
 		NavigationOptions opts = new NavigationOptions();
78
-		opts.title = "the new title";
78
+		opts.topBarOptions.title = "the new title";
79
 		uut.mergeNavigationOptions(opts);
79
 		uut.mergeNavigationOptions(opts);
80
 
80
 
81
 		assertThat(uut.getTopBar().getTitle()).isEqualTo("the new title");
81
 		assertThat(uut.getTopBar().getTitle()).isEqualTo("the new title");
88
 		assertThat(((ColorDrawable) uut.getTopBar().getTitleBar().getBackground()).getColor()).isNotEqualTo(Color.RED);
88
 		assertThat(((ColorDrawable) uut.getTopBar().getTitleBar().getBackground()).getColor()).isNotEqualTo(Color.RED);
89
 
89
 
90
 		NavigationOptions opts = new NavigationOptions();
90
 		NavigationOptions opts = new NavigationOptions();
91
-		opts.topBarBackgroundColor = Color.RED;
91
+		opts.topBarOptions.backgroundColor = Color.RED;
92
 		uut.mergeNavigationOptions(opts);
92
 		uut.mergeNavigationOptions(opts);
93
 
93
 
94
 		assertThat(((ColorDrawable) uut.getTopBar().getTitleBar().getBackground()).getColor()).isEqualTo(Color.RED);
94
 		assertThat(((ColorDrawable) uut.getTopBar().getTitleBar().getBackground()).getColor()).isEqualTo(Color.RED);
97
 	@Test
97
 	@Test
98
 	public void appliesTopBarTextColor() throws Exception {
98
 	public void appliesTopBarTextColor() throws Exception {
99
 		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
99
 		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
100
-		initialNavigationOptions.title = "the title";
100
+		initialNavigationOptions.topBarOptions.title = "the title";
101
 		uut.onViewAppeared();
101
 		uut.onViewAppeared();
102
 		assertThat(uut.getTopBar().getTitleTextView().getCurrentTextColor()).isNotEqualTo(Color.RED);
102
 		assertThat(uut.getTopBar().getTitleTextView().getCurrentTextColor()).isNotEqualTo(Color.RED);
103
 
103
 
104
 		NavigationOptions opts = new NavigationOptions();
104
 		NavigationOptions opts = new NavigationOptions();
105
-		opts.title = "the title";
106
-		opts.topBarTextColor = Color.RED;
105
+		opts.topBarOptions.title = "the title";
106
+		opts.topBarOptions.textColor = Color.RED;
107
 		uut.mergeNavigationOptions(opts);
107
 		uut.mergeNavigationOptions(opts);
108
 
108
 
109
 		assertThat(uut.getTopBar().getTitleTextView()).isNotEqualTo(null);
109
 		assertThat(uut.getTopBar().getTitleTextView()).isNotEqualTo(null);
113
 	@Test
113
 	@Test
114
 	public void appliesTopBarTextSize() throws Exception {
114
 	public void appliesTopBarTextSize() throws Exception {
115
 		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
115
 		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
116
-		initialNavigationOptions.title = "the title";
116
+		initialNavigationOptions.topBarOptions.title = "the title";
117
 		uut.onViewAppeared();
117
 		uut.onViewAppeared();
118
 		assertThat(uut.getTopBar().getTitleTextView().getTextSize()).isNotEqualTo(18);
118
 		assertThat(uut.getTopBar().getTitleTextView().getTextSize()).isNotEqualTo(18);
119
 
119
 
120
 		NavigationOptions opts = new NavigationOptions();
120
 		NavigationOptions opts = new NavigationOptions();
121
-		opts.title = "the title";
122
-		opts.topBarTextFontSize = 18;
121
+		opts.topBarOptions.title = "the title";
122
+		opts.topBarOptions.textFontSize = 18;
123
 		uut.mergeNavigationOptions(opts);
123
 		uut.mergeNavigationOptions(opts);
124
 
124
 
125
 		assertThat(uut.getTopBar().getTitleTextView()).isNotEqualTo(null);
125
 		assertThat(uut.getTopBar().getTitleTextView()).isNotEqualTo(null);
129
 	@Test
129
 	@Test
130
 	public void appliesTopBarHidden() throws Exception {
130
 	public void appliesTopBarHidden() throws Exception {
131
 		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
131
 		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
132
-		initialNavigationOptions.title = "the title";
132
+		initialNavigationOptions.topBarOptions.title = "the title";
133
 		uut.onViewAppeared();
133
 		uut.onViewAppeared();
134
 		assertThat(uut.getTopBar().getVisibility()).isNotEqualTo(View.GONE);
134
 		assertThat(uut.getTopBar().getVisibility()).isNotEqualTo(View.GONE);
135
 
135
 
136
 		NavigationOptions opts = new NavigationOptions();
136
 		NavigationOptions opts = new NavigationOptions();
137
-		opts.topBarHidden = NavigationOptions.BooleanOptions.True;
137
+		opts.topBarOptions.hidden = NavigationOptions.BooleanOptions.True;
138
 		uut.mergeNavigationOptions(opts);
138
 		uut.mergeNavigationOptions(opts);
139
 
139
 
140
 		assertThat(uut.getTopBar().getVisibility()).isEqualTo(View.GONE);
140
 		assertThat(uut.getTopBar().getVisibility()).isEqualTo(View.GONE);

+ 2
- 12
lib/ios/RNNNavigationOptions.h View File

1
 #import <Foundation/Foundation.h>
1
 #import <Foundation/Foundation.h>
2
 #import <UIKit/UIKit.h>
2
 #import <UIKit/UIKit.h>
3
+#import "RNNTopBarOptions.h"
3
 
4
 
4
 extern const NSInteger BLUR_STATUS_TAG;
5
 extern const NSInteger BLUR_STATUS_TAG;
5
 extern const NSInteger BLUR_TOPBAR_TAG;
6
 extern const NSInteger BLUR_TOPBAR_TAG;
6
 
7
 
7
 @interface RNNNavigationOptions : NSObject
8
 @interface RNNNavigationOptions : NSObject
8
 
9
 
9
-@property (nonatomic, strong) NSNumber* topBarBackgroundColor;
10
-@property (nonatomic, strong) NSNumber* topBarTextColor;
11
 @property (nonatomic, strong) NSNumber* statusBarHidden;
10
 @property (nonatomic, strong) NSNumber* statusBarHidden;
12
-@property (nonatomic, strong) NSString* title;
13
 @property (nonatomic, strong) NSNumber* screenBackgroundColor;
11
 @property (nonatomic, strong) NSNumber* screenBackgroundColor;
14
-@property (nonatomic, strong) NSString* topBarTextFontFamily;
15
-@property (nonatomic, strong) NSNumber* topBarHidden;
16
-@property (nonatomic, strong) NSNumber* topBarHideOnScroll;
17
-@property (nonatomic, strong) NSNumber* topBarButtonColor;
18
-@property (nonatomic, strong) NSNumber* topBarTranslucent;
19
 @property (nonatomic, strong) NSString* tabBadge;
12
 @property (nonatomic, strong) NSString* tabBadge;
20
-@property (nonatomic, strong) NSNumber* topBarTextFontSize;
21
 @property (nonatomic, strong) id orientation;
13
 @property (nonatomic, strong) id orientation;
22
 @property (nonatomic, strong) NSArray* leftButtons;
14
 @property (nonatomic, strong) NSArray* leftButtons;
23
 @property (nonatomic, strong) NSArray* rightButtons;
15
 @property (nonatomic, strong) NSArray* rightButtons;
24
-@property (nonatomic, strong) NSNumber* topBarNoBorder;
25
 @property (nonatomic, strong) NSNumber* statusBarBlur;
16
 @property (nonatomic, strong) NSNumber* statusBarBlur;
26
 @property (nonatomic, strong) NSNumber* statusBarHideWithTopBar;
17
 @property (nonatomic, strong) NSNumber* statusBarHideWithTopBar;
27
 @property (nonatomic, strong) NSNumber* tabBarHidden;
18
 @property (nonatomic, strong) NSNumber* tabBarHidden;
28
-@property (nonatomic, strong) NSNumber* topBarBlur;
29
-@property (nonatomic, strong) NSNumber* animateTopBarHide;
19
+@property (nonatomic, strong) RNNTopBarOptions* topBar;
30
 
20
 
31
 
21
 
32
 - (UIInterfaceOrientationMask)supportedOrientations;
22
 - (UIInterfaceOrientationMask)supportedOrientations;

+ 86
- 100
lib/ios/RNNNavigationOptions.m View File

2
 #import <React/RCTConvert.h>
2
 #import <React/RCTConvert.h>
3
 #import "RNNNavigationController.h"
3
 #import "RNNNavigationController.h"
4
 #import "RNNTabBarController.h"
4
 #import "RNNTabBarController.h"
5
+#import "RNNTopBarOptions.h"
5
 
6
 
6
 const NSInteger BLUR_STATUS_TAG = 78264801;
7
 const NSInteger BLUR_STATUS_TAG = 78264801;
7
 const NSInteger BLUR_TOPBAR_TAG = 78264802;
8
 const NSInteger BLUR_TOPBAR_TAG = 78264802;
14
 
15
 
15
 -(instancetype)initWithDict:(NSDictionary *)navigationOptions {
16
 -(instancetype)initWithDict:(NSDictionary *)navigationOptions {
16
 	self = [super init];
17
 	self = [super init];
17
-	self.topBarBackgroundColor = [navigationOptions objectForKey:@"topBarBackgroundColor"];
18
 	self.statusBarHidden = [navigationOptions objectForKey:@"statusBarHidden"];
18
 	self.statusBarHidden = [navigationOptions objectForKey:@"statusBarHidden"];
19
-	self.title = [navigationOptions objectForKey:@"title"];
20
-	self.topBarTextColor = [navigationOptions objectForKey:@"topBarTextColor"];
21
 	self.screenBackgroundColor = [navigationOptions objectForKey:@"screenBackgroundColor"];
19
 	self.screenBackgroundColor = [navigationOptions objectForKey:@"screenBackgroundColor"];
22
-	self.topBarTextFontFamily = [navigationOptions objectForKey:@"topBarTextFontFamily"];
23
-	self.topBarHidden = [navigationOptions objectForKey:@"topBarHidden"];
24
-	self.topBarHideOnScroll = [navigationOptions objectForKey:@"topBarHideOnScroll"];
25
-	self.topBarButtonColor = [navigationOptions objectForKey:@"topBarButtonColor"];
26
-	self.topBarTranslucent = [navigationOptions objectForKey:@"topBarTranslucent"];
27
 	self.tabBadge = [navigationOptions objectForKey:@"tabBadge"];
20
 	self.tabBadge = [navigationOptions objectForKey:@"tabBadge"];
28
-	self.topBarTextFontSize = [navigationOptions objectForKey:@"topBarTextFontSize"];
29
 	self.orientation = [navigationOptions objectForKey:@"orientation"];
21
 	self.orientation = [navigationOptions objectForKey:@"orientation"];
30
 	self.leftButtons = [navigationOptions objectForKey:@"leftButtons"];
22
 	self.leftButtons = [navigationOptions objectForKey:@"leftButtons"];
31
 	self.rightButtons = [navigationOptions objectForKey:@"rightButtons"];
23
 	self.rightButtons = [navigationOptions objectForKey:@"rightButtons"];
32
-	self.topBarNoBorder = [navigationOptions objectForKey:@"topBarNoBorder"];
33
 	self.tabBarHidden = [navigationOptions objectForKey:@"tabBarHidden"];
24
 	self.tabBarHidden = [navigationOptions objectForKey:@"tabBarHidden"];
34
-	self.topBarBlur = [navigationOptions objectForKey:@"topBarBlur"];
35
-	self.animateTopBarHide = [navigationOptions objectForKey:@"animateTopBarHide"];
36
-
25
+	self.topBar = [[RNNTopBarOptions alloc] initWithDict:[navigationOptions objectForKey:@"topBar"]];
26
+	
37
 	return self;
27
 	return self;
38
 }
28
 }
39
 
29
 
40
 -(void)mergeWith:(NSDictionary *)otherOptions {
30
 -(void)mergeWith:(NSDictionary *)otherOptions {
41
 	for (id key in otherOptions) {
31
 	for (id key in otherOptions) {
42
-		[self setValue:[otherOptions objectForKey:key] forKey:key];
32
+		if ([key isEqualToString:@"topBar"]) {
33
+			[self.topBar mergeWith:[otherOptions objectForKey:@"topBar"]];
34
+		} else {
35
+			[self setValue:[otherOptions objectForKey:key] forKey:key];
36
+		}
43
 	}
37
 	}
44
 }
38
 }
45
 
39
 
46
 -(void)applyOn:(UIViewController*)viewController {
40
 -(void)applyOn:(UIViewController*)viewController {
47
-	if (self.topBarBackgroundColor) {
48
-		UIColor* backgroundColor = [RCTConvert UIColor:self.topBarBackgroundColor];
49
-		viewController.navigationController.navigationBar.barTintColor = backgroundColor;
50
-	} else {
51
-		viewController.navigationController.navigationBar.barTintColor = nil;
52
-	}
41
+	if (self.topBar) {
42
+		if(self.topBar.backgroundColor) {
43
+			UIColor* backgroundColor = [RCTConvert UIColor:self.topBar.backgroundColor];
44
+			viewController.navigationController.navigationBar.barTintColor = backgroundColor;
45
+		} else {
46
+			viewController.navigationController.navigationBar.barTintColor = nil;
47
+		}
48
+		
49
+		if (self.topBar.title) {
50
+			viewController.navigationItem.title = self.topBar.title;
51
+		}
52
+		
53
+		if (self.topBar.textFontFamily || self.topBar.textFontSize || self.topBar.textColor) {
54
+			NSMutableDictionary* navigationBarTitleTextAttributes = [NSMutableDictionary new];
55
+			if (self.topBar.textColor) {
56
+				navigationBarTitleTextAttributes[NSForegroundColorAttributeName] = [RCTConvert UIColor:[self.topBar valueForKey:@"textColor"]];
57
+			}
58
+			if (self.topBar.textFontFamily){
59
+				if(self.topBar.textFontSize) {
60
+					navigationBarTitleTextAttributes[NSFontAttributeName] = [UIFont fontWithName:self.topBar.textFontFamily size:[self.topBar.textFontSize floatValue]];
61
+				} else {
62
+					navigationBarTitleTextAttributes[NSFontAttributeName] = [UIFont fontWithName:self.topBar.textFontFamily size:20];
63
+				}
64
+			} else if (self.topBar.textFontSize) {
65
+				navigationBarTitleTextAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:[self.topBar.textFontSize floatValue]];
66
+			}
67
+			viewController.navigationController.navigationBar.titleTextAttributes = navigationBarTitleTextAttributes;
68
+		}
53
 
69
 
54
-	if (self.title) {
55
-		viewController.navigationItem.title = self.title;
56
-	}
57
 
70
 
58
-	if (self.topBarTextFontFamily || self.topBarTextColor || self.topBarTextFontSize){
59
-		NSMutableDictionary* navigationBarTitleTextAttributes = [NSMutableDictionary new];
60
-		if (self.topBarTextColor) {
61
-			navigationBarTitleTextAttributes[NSForegroundColorAttributeName] = [RCTConvert UIColor:self.topBarTextColor];
71
+		if (self.topBar.hidden){
72
+			[viewController.navigationController setNavigationBarHidden:[self.topBar.hidden boolValue] animated:[self.topBar.animateHide boolValue]];
73
+		}
74
+
75
+		if (self.topBar.hideOnScroll) {
76
+			viewController.navigationController.hidesBarsOnSwipe = [self.topBar.hideOnScroll boolValue];
77
+		}
78
+
79
+		if (self.topBar.buttonColor) {
80
+			UIColor* buttonColor = [RCTConvert UIColor:self.topBar.buttonColor];
81
+			viewController.navigationController.navigationBar.tintColor = buttonColor;
82
+		} else {
83
+			viewController.navigationController.navigationBar.tintColor = nil;
62
 		}
84
 		}
63
-		if (self.topBarTextFontFamily){
64
-			if(self.topBarTextFontSize) {
65
-				navigationBarTitleTextAttributes[NSFontAttributeName] = [UIFont fontWithName:self.topBarTextFontFamily size:[self.topBarTextFontSize floatValue]];
85
+		
86
+		if ([self.topBar.blur boolValue]) {
87
+			if (![viewController.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]) {
88
+				
89
+				[viewController.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
90
+				viewController.navigationController.navigationBar.shadowImage = [UIImage new];
91
+				UIVisualEffectView *blur = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
92
+				CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
93
+				blur.frame = CGRectMake(0, -1 * statusBarFrame.size.height, viewController.navigationController.navigationBar.frame.size.width, viewController.navigationController.navigationBar.frame.size.height + statusBarFrame.size.height);
94
+				blur.userInteractionEnabled = NO;
95
+				blur.tag = BLUR_TOPBAR_TAG;
96
+				[viewController.navigationController.navigationBar insertSubview:blur atIndex:0];
97
+				[viewController.navigationController.navigationBar sendSubviewToBack:blur];
98
+			}
99
+		} else {
100
+			UIView *blur = [viewController.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG];
101
+			if (blur) {
102
+				[viewController.navigationController.navigationBar setBackgroundImage: nil forBarMetrics:UIBarMetricsDefault];
103
+				viewController.navigationController.navigationBar.shadowImage = nil;
104
+				[blur removeFromSuperview];
105
+			}
106
+		}
107
+		
108
+		if (self.topBar.translucent) {
109
+			viewController.navigationController.navigationBar.translucent = [self.topBar.translucent boolValue];
110
+		}
111
+		
112
+		if (self.topBar.noBorder) {
113
+			if ([self.topBar.noBorder boolValue]) {
114
+				viewController.navigationController.navigationBar
115
+				.shadowImage = [[UIImage alloc] init];
66
 			} else {
116
 			} else {
67
-				navigationBarTitleTextAttributes[NSFontAttributeName] = [UIFont fontWithName:self.topBarTextFontFamily size:20];
117
+				viewController.navigationController.navigationBar
118
+				.shadowImage = nil;
68
 			}
119
 			}
69
-		} else if (self.topBarTextFontSize) {
70
-			navigationBarTitleTextAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:[self.topBarTextFontSize floatValue]];
71
 		}
120
 		}
72
-		viewController.navigationController.navigationBar.titleTextAttributes = navigationBarTitleTextAttributes;
73
 	}
121
 	}
74
-
122
+	
75
 	if (self.screenBackgroundColor) {
123
 	if (self.screenBackgroundColor) {
76
 		UIColor* screenColor = [RCTConvert UIColor:self.screenBackgroundColor];
124
 		UIColor* screenColor = [RCTConvert UIColor:self.screenBackgroundColor];
77
 		viewController.view.backgroundColor = screenColor;
125
 		viewController.view.backgroundColor = screenColor;
78
 	}
126
 	}
79
-
80
-	if (self.topBarHidden){
81
-		[viewController.navigationController setNavigationBarHidden:[self.topBarHidden boolValue] animated:[self.animateTopBarHide boolValue]];
82
-	}
83
-
84
-	if (self.topBarHideOnScroll) {
85
-		BOOL topBarHideOnScrollBool = [self.topBarHideOnScroll boolValue];
86
-		if (topBarHideOnScrollBool) {
87
-			viewController.navigationController.hidesBarsOnSwipe = YES;
88
-		} else {
89
-			viewController.navigationController.hidesBarsOnSwipe = NO;
90
-		}
91
-	}
92
-
93
-	if (self.topBarButtonColor) {
94
-		UIColor* buttonColor = [RCTConvert UIColor:self.topBarButtonColor];
95
-		viewController.navigationController.navigationBar.tintColor = buttonColor;
96
-	} else {
97
-		viewController.navigationController.navigationBar.tintColor = nil;
98
-	}
99
-
127
+	
100
 	if (self.tabBadge) {
128
 	if (self.tabBadge) {
101
 		NSString *badge = [RCTConvert NSString:self.tabBadge];
129
 		NSString *badge = [RCTConvert NSString:self.tabBadge];
102
 		if (viewController.navigationController) {
130
 		if (viewController.navigationController) {
105
 			viewController.tabBarItem.badgeValue = badge;
133
 			viewController.tabBarItem.badgeValue = badge;
106
 		}
134
 		}
107
 	}
135
 	}
108
-
109
-	if (self.topBarTranslucent) {
110
-		if ([self.topBarTranslucent boolValue]) {
111
-			viewController.navigationController.navigationBar.translucent = YES;
112
-		} else {
113
-			viewController.navigationController.navigationBar.translucent = NO;
114
-		}
115
-	}
116
-
117
-	if (self.topBarNoBorder) {
118
-		if ([self.topBarNoBorder boolValue]) {
119
-			viewController.navigationController.navigationBar
120
-			.shadowImage = [[UIImage alloc] init];
121
-		} else {
122
-			viewController.navigationController.navigationBar
123
-			.shadowImage = nil;
124
-		}
125
-	}
126
-
136
+	
127
 	if (self.statusBarBlur) {
137
 	if (self.statusBarBlur) {
128
 		UIView* curBlurView = [viewController.view viewWithTag:BLUR_STATUS_TAG];
138
 		UIView* curBlurView = [viewController.view viewWithTag:BLUR_STATUS_TAG];
129
 		if ([self.statusBarBlur boolValue]) {
139
 		if ([self.statusBarBlur boolValue]) {
139
 			}
149
 			}
140
 		}
150
 		}
141
 	}
151
 	}
142
-
143
-	if (self.topBarBlur && [self.topBarBlur boolValue]) {
144
-
145
-		if (![viewController.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]) {
146
-
147
-			[viewController.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
148
-			viewController.navigationController.navigationBar.shadowImage = [UIImage new];
149
-			UIVisualEffectView *blur = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
150
-			CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
151
-			blur.frame = CGRectMake(0, -1 * statusBarFrame.size.height, viewController.navigationController.navigationBar.frame.size.width, viewController.navigationController.navigationBar.frame.size.height + statusBarFrame.size.height);
152
-			blur.userInteractionEnabled = NO;
153
-			blur.tag = BLUR_TOPBAR_TAG;
154
-			[viewController.navigationController.navigationBar insertSubview:blur atIndex:0];
155
-			[viewController.navigationController.navigationBar sendSubviewToBack:blur];
156
-		}
157
-
158
-	} else {
159
-		UIView *blur = [viewController.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG];
160
-		if (blur) {
161
-			[viewController.navigationController.navigationBar setBackgroundImage: nil forBarMetrics:UIBarMetricsDefault];
162
-			viewController.navigationController.navigationBar.shadowImage = nil;
163
-			[blur removeFromSuperview];
164
-		}
165
-	}
166
 }
152
 }
167
 
153
 
168
 - (UIInterfaceOrientationMask)supportedOrientations {
154
 - (UIInterfaceOrientationMask)supportedOrientations {
187
 			}
173
 			}
188
 		}
174
 		}
189
 	}
175
 	}
190
-
176
+	
191
 	return supportedOrientationsMask;
177
 	return supportedOrientationsMask;
192
 }
178
 }
193
 
179
 

+ 25
- 0
lib/ios/RNNTopBarOptions.h View File

1
+#import <Foundation/Foundation.h>
2
+
3
+extern const NSInteger BLUR_STATUS_TAG;
4
+extern const NSInteger BLUR_TOPBAR_TAG;
5
+
6
+@interface RNNTopBarOptions : NSObject
7
+
8
+@property (nonatomic, strong) NSNumber* backgroundColor;
9
+@property (nonatomic, strong) NSNumber* textColor;
10
+@property (nonatomic, strong) NSString* title;
11
+@property (nonatomic, strong) NSString* textFontFamily;
12
+@property (nonatomic, strong) NSNumber* hidden;
13
+@property (nonatomic, strong) NSNumber* hideOnScroll;
14
+@property (nonatomic, strong) NSNumber* buttonColor;
15
+@property (nonatomic, strong) NSNumber* translucent;
16
+@property (nonatomic, strong) NSNumber* textFontSize;
17
+@property (nonatomic, strong) NSNumber* noBorder;
18
+@property (nonatomic, strong) NSNumber* blur;
19
+@property (nonatomic, strong) NSNumber* animateHide;
20
+
21
+-(instancetype)init;
22
+-(instancetype)initWithDict:(NSDictionary *)topBarOptions;
23
+-(void)mergeWith:(NSDictionary*)otherOptions;
24
+
25
+@end

+ 35
- 0
lib/ios/RNNTopBarOptions.m View File

1
+#import "RNNTopBarOptions.h"
2
+
3
+@implementation RNNTopBarOptions
4
+
5
+-(instancetype)init {
6
+	return [self initWithDict:@{}];
7
+}
8
+
9
+-(instancetype)initWithDict:(NSDictionary *)topBarOptions {
10
+	self = [super init];
11
+	
12
+	self.title = [topBarOptions valueForKey:@"title"];
13
+	self.backgroundColor = [topBarOptions valueForKey:@"backgroundColor"];
14
+	self.textColor = [topBarOptions valueForKey:@"textColor"];
15
+	self.textFontFamily = [topBarOptions valueForKey:@"textFontFamily"];
16
+	self.textFontSize = [topBarOptions valueForKey:@"textFontSize"];
17
+	self.hidden = [topBarOptions valueForKey:@"hidden"];
18
+	self.hideOnScroll = [topBarOptions valueForKey:@"hideOnScroll"];
19
+	self.buttonColor = [topBarOptions valueForKey:@"buttonColor"];
20
+	self.blur = [topBarOptions valueForKey:@"blur"];
21
+	self.translucent = [topBarOptions valueForKey:@"translucent"];
22
+	self.noBorder = [topBarOptions valueForKey:@"noBorder"];
23
+	self.animateHide =[topBarOptions valueForKey:@"animateHide"];
24
+	
25
+	return self;
26
+}
27
+
28
+-(void)mergeWith:(NSDictionary *)otherOptions {
29
+	for (id key in otherOptions) {
30
+		[self setValue:[otherOptions objectForKey:key] forKey:key];
31
+	}
32
+}
33
+@end
34
+
35
+

+ 6
- 0
lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj View File

97
 		7BEF0D191E437684003E96B0 /* RNNRootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BEF0D171E437684003E96B0 /* RNNRootViewController.m */; };
97
 		7BEF0D191E437684003E96B0 /* RNNRootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BEF0D171E437684003E96B0 /* RNNRootViewController.m */; };
98
 		7BEF0D1C1E43771B003E96B0 /* RNNLayoutNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BEF0D1A1E43771B003E96B0 /* RNNLayoutNode.h */; };
98
 		7BEF0D1C1E43771B003E96B0 /* RNNLayoutNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BEF0D1A1E43771B003E96B0 /* RNNLayoutNode.h */; };
99
 		7BEF0D1D1E43771B003E96B0 /* RNNLayoutNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BEF0D1B1E43771B003E96B0 /* RNNLayoutNode.m */; };
99
 		7BEF0D1D1E43771B003E96B0 /* RNNLayoutNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BEF0D1B1E43771B003E96B0 /* RNNLayoutNode.m */; };
100
+		A7626BFD1FC2FB2C00492FB8 /* RNNTopBarOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = A7626BFC1FC2FB2C00492FB8 /* RNNTopBarOptions.m */; };
100
 		E83BAD681F2734B500A9F3DD /* RNNNavigationOptionsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E83BAD671F2734B500A9F3DD /* RNNNavigationOptionsTest.m */; };
101
 		E83BAD681F2734B500A9F3DD /* RNNNavigationOptionsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E83BAD671F2734B500A9F3DD /* RNNNavigationOptionsTest.m */; };
101
 		E83BAD6B1F27363A00A9F3DD /* RNNNavigationOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = E83BAD6A1F27363A00A9F3DD /* RNNNavigationOptions.m */; };
102
 		E83BAD6B1F27363A00A9F3DD /* RNNNavigationOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = E83BAD6A1F27363A00A9F3DD /* RNNNavigationOptions.m */; };
102
 		E83BAD791F27416B00A9F3DD /* RNNRootViewControllerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E83BAD781F27416B00A9F3DD /* RNNRootViewControllerTest.m */; };
103
 		E83BAD791F27416B00A9F3DD /* RNNRootViewControllerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E83BAD781F27416B00A9F3DD /* RNNRootViewControllerTest.m */; };
220
 		7BEF0D171E437684003E96B0 /* RNNRootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNRootViewController.m; sourceTree = "<group>"; };
221
 		7BEF0D171E437684003E96B0 /* RNNRootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNRootViewController.m; sourceTree = "<group>"; };
221
 		7BEF0D1A1E43771B003E96B0 /* RNNLayoutNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNLayoutNode.h; sourceTree = "<group>"; };
222
 		7BEF0D1A1E43771B003E96B0 /* RNNLayoutNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNLayoutNode.h; sourceTree = "<group>"; };
222
 		7BEF0D1B1E43771B003E96B0 /* RNNLayoutNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNLayoutNode.m; sourceTree = "<group>"; };
223
 		7BEF0D1B1E43771B003E96B0 /* RNNLayoutNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNLayoutNode.m; sourceTree = "<group>"; };
224
+		A7626BFC1FC2FB2C00492FB8 /* RNNTopBarOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNTopBarOptions.m; sourceTree = "<group>"; };
225
+		A7626BFE1FC2FB6700492FB8 /* RNNTopBarOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNTopBarOptions.h; sourceTree = "<group>"; };
223
 		D8AFADBD1BEE6F3F00A4592D /* libReactNativeNavigation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReactNativeNavigation.a; sourceTree = BUILT_PRODUCTS_DIR; };
226
 		D8AFADBD1BEE6F3F00A4592D /* libReactNativeNavigation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReactNativeNavigation.a; sourceTree = BUILT_PRODUCTS_DIR; };
224
 		E83BAD671F2734B500A9F3DD /* RNNNavigationOptionsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNNavigationOptionsTest.m; sourceTree = "<group>"; };
227
 		E83BAD671F2734B500A9F3DD /* RNNNavigationOptionsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNNavigationOptionsTest.m; sourceTree = "<group>"; };
225
 		E83BAD691F27362500A9F3DD /* RNNNavigationOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNNavigationOptions.h; sourceTree = "<group>"; };
228
 		E83BAD691F27362500A9F3DD /* RNNNavigationOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNNavigationOptions.h; sourceTree = "<group>"; };
368
 				21B85E5C1F44480200B314B5 /* RNNNavigationButtons.m */,
371
 				21B85E5C1F44480200B314B5 /* RNNNavigationButtons.m */,
369
 				214545261F4DC164006E8DA1 /* RNNUIBarButtonItem.h */,
372
 				214545261F4DC164006E8DA1 /* RNNUIBarButtonItem.h */,
370
 				214545241F4DC125006E8DA1 /* RNNUIBarButtonItem.m */,
373
 				214545241F4DC125006E8DA1 /* RNNUIBarButtonItem.m */,
374
+				A7626BFC1FC2FB2C00492FB8 /* RNNTopBarOptions.m */,
375
+				A7626BFE1FC2FB6700492FB8 /* RNNTopBarOptions.h */,
371
 			);
376
 			);
372
 			name = Controllers;
377
 			name = Controllers;
373
 			sourceTree = "<group>";
378
 			sourceTree = "<group>";
610
 				261F0E6B1E6F028A00989DE2 /* RNNNavigationStackManager.m in Sources */,
615
 				261F0E6B1E6F028A00989DE2 /* RNNNavigationStackManager.m in Sources */,
611
 				263905BF1E4C6F440023D7D3 /* RCCTheSideBarManagerViewController.m in Sources */,
616
 				263905BF1E4C6F440023D7D3 /* RCCTheSideBarManagerViewController.m in Sources */,
612
 				7B1126A01E2D263F00F9B03B /* RNNEventEmitter.m in Sources */,
617
 				7B1126A01E2D263F00F9B03B /* RNNEventEmitter.m in Sources */,
618
+				A7626BFD1FC2FB2C00492FB8 /* RNNTopBarOptions.m in Sources */,
613
 				263905CB1E4C6F440023D7D3 /* SidebarLuvocracyAnimation.m in Sources */,
619
 				263905CB1E4C6F440023D7D3 /* SidebarLuvocracyAnimation.m in Sources */,
614
 				263905E71E4CAC950023D7D3 /* RNNSideMenuChildVC.m in Sources */,
620
 				263905E71E4CAC950023D7D3 /* RNNSideMenuChildVC.m in Sources */,
615
 				7BA500751E2544B9001B9E1B /* ReactNativeNavigation.m in Sources */,
621
 				7BA500751E2544B9001B9E1B /* ReactNativeNavigation.m in Sources */,

+ 2
- 2
lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m View File

61
 
61
 
62
 -(void)testDynamicStylesMergeWithStaticStyles {
62
 -(void)testDynamicStylesMergeWithStaticStyles {
63
 	RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] init];
63
 	RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] init];
64
-	[initialOptions setTitle:@"the title"];
64
+	[initialOptions.topBar setTitle:@"the title"];
65
 	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithName:@"name"
65
 	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithName:@"name"
66
 																withOptions:initialOptions
66
 																withOptions:initialOptions
67
 															withContainerId:@"containerId"
67
 															withContainerId:@"containerId"
74
 	[self.store setReadyToReceiveCommands:true];
74
 	[self.store setReadyToReceiveCommands:true];
75
 	[self.store setContainer:vc containerId:@"containerId"];
75
 	[self.store setContainer:vc containerId:@"containerId"];
76
 	
76
 	
77
-	NSDictionary* dictFromJs = @{@"topBarBackgroundColor" :@(0xFFFF0000)};
77
+	NSDictionary* dictFromJs = @{@"topBar": @{@"backgroundColor" :@(0xFFFF0000)}};
78
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
78
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
79
 	
79
 	
80
 	[self.uut setOptions:@"containerId" options:dictFromJs];
80
 	[self.uut setOptions:@"containerId" options:dictFromJs];

+ 10
- 10
lib/ios/ReactNativeNavigationTests/RNNNavigationOptionsTest.m View File

16
 	XCTAssertTrue([options isKindOfClass:[RNNNavigationOptions class]]);
16
 	XCTAssertTrue([options isKindOfClass:[RNNNavigationOptions class]]);
17
 }
17
 }
18
 -(void)testAddsStyleFromDictionaryWithInit{
18
 -(void)testAddsStyleFromDictionaryWithInit{
19
-	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBarBackgroundColor" : @(0xff0000ff)}];
20
-	XCTAssertTrue(options.topBarBackgroundColor);
19
+	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBar": @{@"backgroundColor" : @(0xff0000ff)}}];
20
+	XCTAssertTrue(options.topBar.backgroundColor);
21
 }
21
 }
22
 -(void)testReturnsNilWhenStyleDoesNotExist{
22
 -(void)testReturnsNilWhenStyleDoesNotExist{
23
-	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBarBackgroundColor" : @(0xff0000ff)}];
24
-	XCTAssertNil(options.topBarTextColor);
23
+	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBar": @{@"someColor" : @(0xff0000ff)}}];
24
+	XCTAssertNil(options.topBar.backgroundColor);
25
 }
25
 }
26
 
26
 
27
 -(void)testChangeRNNNavigationOptionsDynamically{
27
 -(void)testChangeRNNNavigationOptionsDynamically{
28
-	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBarBackgroundColor" : @(0xff0000ff)}];
29
-	NSDictionary* dynamicOptions = @{@"topBarTextColor" : @(0xffff00ff), @"title" : @"hello"};
30
-    [options mergeWith:dynamicOptions];
31
-	XCTAssertTrue([options.title isEqual:@"hello"]);	
28
+	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBar": @{@"backgroundColor" : @(0xff0000ff)}}];
29
+	NSDictionary* dynamicOptions = @{@"topBar": @{@"textColor" : @(0xffff00ff), @"title" : @"hello"}};
30
+	[options mergeWith:dynamicOptions];
31
+	XCTAssertTrue([options.topBar.title isEqual:@"hello"]);
32
 }
32
 }
33
 
33
 
34
 -(void)testChangeRNNNavigationOptionsWithInvalidProperties{
34
 -(void)testChangeRNNNavigationOptionsWithInvalidProperties{
35
-	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBarBackgroundColor" : @(0xff0000ff)}];
36
-	NSDictionary* dynamicOptions = @{@"titleeeee" : @"hello"};
35
+	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBar": @{@"backgroundColor" : @(0xff0000ff)}}];
36
+	NSDictionary* dynamicOptions = @{@"topBar": @{@"titleeeee" : @"hello"}};
37
 	XCTAssertThrows([options mergeWith:dynamicOptions]);
37
 	XCTAssertThrows([options mergeWith:dynamicOptions]);
38
 }
38
 }
39
 @end
39
 @end

+ 23
- 23
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m View File

32
 
32
 
33
 -(void)testTopBarBackgroundColor_validColor{
33
 -(void)testTopBarBackgroundColor_validColor{
34
 	NSNumber* inputColor = @(0xFFFF0000);
34
 	NSNumber* inputColor = @(0xFFFF0000);
35
-	self.options.topBarBackgroundColor = inputColor;
35
+	self.options.topBar.backgroundColor = inputColor;
36
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
36
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
37
 	[self.uut viewWillAppear:false];
37
 	[self.uut viewWillAppear:false];
38
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
38
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
42
 
42
 
43
 -(void)testTopBarBackgroundColorWithoutNavigationController{
43
 -(void)testTopBarBackgroundColorWithoutNavigationController{
44
 	NSNumber* inputColor = @(0xFFFF0000);
44
 	NSNumber* inputColor = @(0xFFFF0000);
45
-	self.options.topBarBackgroundColor = inputColor;
45
+	self.options.topBar.backgroundColor = inputColor;
46
 	
46
 	
47
 	XCTAssertNoThrow([self.uut viewWillAppear:false]);
47
 	XCTAssertNoThrow([self.uut viewWillAppear:false]);
48
 }
48
 }
64
 
64
 
65
 - (void)testStatusBarHideWithTopBar_false {
65
 - (void)testStatusBarHideWithTopBar_false {
66
 	self.options.statusBarHideWithTopBar = @(0);
66
 	self.options.statusBarHideWithTopBar = @(0);
67
-	self.options.topBarHidden = @(1);
67
+	self.options.topBar.hidden = @(1);
68
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
68
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
69
 	[self.uut viewWillAppear:false];
69
 	[self.uut viewWillAppear:false];
70
 	
70
 	
73
 
73
 
74
 - (void)testStatusBarHideWithTopBar_true {
74
 - (void)testStatusBarHideWithTopBar_true {
75
 	self.options.statusBarHideWithTopBar = @(1);
75
 	self.options.statusBarHideWithTopBar = @(1);
76
-	self.options.topBarHidden = @(1);
76
+	self.options.topBar.hidden = @(1);
77
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
77
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
78
 	[self.uut viewWillAppear:false];
78
 	[self.uut viewWillAppear:false];
79
 
79
 
91
 
91
 
92
 -(void)testTitle_string{
92
 -(void)testTitle_string{
93
 	NSString* title =@"some title";
93
 	NSString* title =@"some title";
94
-	self.options.title= title;
94
+	self.options.topBar.title = title;
95
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
95
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
96
 	
96
 	
97
 	[self.uut viewWillAppear:false];
97
 	[self.uut viewWillAppear:false];
107
 
107
 
108
 -(void)testTopBarTextColor_validColor{
108
 -(void)testTopBarTextColor_validColor{
109
 	NSNumber* inputColor = @(0xFFFF0000);
109
 	NSNumber* inputColor = @(0xFFFF0000);
110
-	self.options.topBarTextColor = inputColor;
110
+	self.options.topBar.textColor = inputColor;
111
 	__unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
111
 	__unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
112
 	[self.uut viewWillAppear:false];
112
 	[self.uut viewWillAppear:false];
113
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
113
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
125
 -(void)testTopBarTextFontFamily_validFont{
125
 -(void)testTopBarTextFontFamily_validFont{
126
 	NSString* inputFont = @"HelveticaNeue";
126
 	NSString* inputFont = @"HelveticaNeue";
127
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
127
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
128
-	self.options.topBarTextFontFamily = inputFont;
128
+	self.options.topBar.textFontFamily = inputFont;
129
 	[self.uut viewWillAppear:false];
129
 	[self.uut viewWillAppear:false];
130
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:20];
130
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:20];
131
 	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
131
 	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
134
 -(void)testTopBarHideOnScroll_true {
134
 -(void)testTopBarHideOnScroll_true {
135
 	NSNumber* hideOnScrollInput = @(1);
135
 	NSNumber* hideOnScrollInput = @(1);
136
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
136
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
137
-	self.options.topBarHideOnScroll = hideOnScrollInput;
137
+	self.options.topBar.hideOnScroll = hideOnScrollInput;
138
 	[self.uut viewWillAppear:false];
138
 	[self.uut viewWillAppear:false];
139
 	XCTAssertTrue(self.uut.navigationController.hidesBarsOnSwipe);
139
 	XCTAssertTrue(self.uut.navigationController.hidesBarsOnSwipe);
140
 }
140
 }
142
 -(void)testTopBarButtonColor {
142
 -(void)testTopBarButtonColor {
143
 	NSNumber* inputColor = @(0xFFFF0000);
143
 	NSNumber* inputColor = @(0xFFFF0000);
144
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
144
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
145
-	self.options.topBarButtonColor = inputColor;
145
+	self.options.topBar.buttonColor = inputColor;
146
 	[self.uut viewWillAppear:false];
146
 	[self.uut viewWillAppear:false];
147
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
147
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
148
 	XCTAssertTrue([self.uut.navigationController.navigationBar.tintColor isEqual:expectedColor]);
148
 	XCTAssertTrue([self.uut.navigationController.navigationBar.tintColor isEqual:expectedColor]);
150
 
150
 
151
 -(void)testTopBarTranslucent {
151
 -(void)testTopBarTranslucent {
152
 	NSNumber* topBarTranslucentInput = @(0);
152
 	NSNumber* topBarTranslucentInput = @(0);
153
-	self.options.topBarTranslucent = topBarTranslucentInput;
153
+	self.options.topBar.translucent = topBarTranslucentInput;
154
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
154
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
155
 	[self.uut viewWillAppear:false];
155
 	[self.uut viewWillAppear:false];
156
 	XCTAssertFalse(self.uut.navigationController.navigationBar.translucent);
156
 	XCTAssertFalse(self.uut.navigationController.navigationBar.translucent);
173
 
173
 
174
 -(void)testTopBarTextFontSize_withoutTextFontFamily_withoutTextColor {
174
 -(void)testTopBarTextFontSize_withoutTextFontFamily_withoutTextColor {
175
 	NSNumber* topBarTextFontSizeInput = @(15);
175
 	NSNumber* topBarTextFontSizeInput = @(15);
176
-	self.options.topBarTextFontSize = topBarTextFontSizeInput;
176
+	self.options.topBar.textFontSize = topBarTextFontSizeInput;
177
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
177
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
178
 	[self.uut viewWillAppear:false];
178
 	[self.uut viewWillAppear:false];
179
 	UIFont* expectedFont = [UIFont systemFontOfSize:15];
179
 	UIFont* expectedFont = [UIFont systemFontOfSize:15];
183
 -(void)testTopBarTextFontSize_withoutTextFontFamily_withTextColor {
183
 -(void)testTopBarTextFontSize_withoutTextFontFamily_withTextColor {
184
 	NSNumber* topBarTextFontSizeInput = @(15);
184
 	NSNumber* topBarTextFontSizeInput = @(15);
185
 	NSNumber* inputColor = @(0xFFFF0000);
185
 	NSNumber* inputColor = @(0xFFFF0000);
186
-	self.options.topBarTextFontSize = topBarTextFontSizeInput;
187
-	self.options.topBarTextColor = inputColor;
186
+	self.options.topBar.textFontSize = topBarTextFontSizeInput;
187
+	self.options.topBar.textColor = inputColor;
188
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
188
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
189
 	[self.uut viewWillAppear:false];
189
 	[self.uut viewWillAppear:false];
190
 	UIFont* expectedFont = [UIFont systemFontOfSize:15];
190
 	UIFont* expectedFont = [UIFont systemFontOfSize:15];
197
 	NSNumber* topBarTextFontSizeInput = @(15);
197
 	NSNumber* topBarTextFontSizeInput = @(15);
198
 	NSNumber* inputColor = @(0xFFFF0000);
198
 	NSNumber* inputColor = @(0xFFFF0000);
199
 	NSString* inputFont = @"HelveticaNeue";
199
 	NSString* inputFont = @"HelveticaNeue";
200
-	self.options.topBarTextFontSize = topBarTextFontSizeInput;
201
-	self.options.topBarTextColor = inputColor;
202
-	self.options.topBarTextFontFamily = inputFont;
200
+	self.options.topBar.textFontSize = topBarTextFontSizeInput;
201
+	self.options.topBar.textColor = inputColor;
202
+	self.options.topBar.textFontFamily = inputFont;
203
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
203
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
204
 	[self.uut viewWillAppear:false];
204
 	[self.uut viewWillAppear:false];
205
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
205
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
211
 -(void)testTopBarTextFontSize_withTextFontFamily_withoutTextColor {
211
 -(void)testTopBarTextFontSize_withTextFontFamily_withoutTextColor {
212
 	NSNumber* topBarTextFontSizeInput = @(15);
212
 	NSNumber* topBarTextFontSizeInput = @(15);
213
 	NSString* inputFont = @"HelveticaNeue";
213
 	NSString* inputFont = @"HelveticaNeue";
214
-	self.options.topBarTextFontSize = topBarTextFontSizeInput;
215
-	self.options.topBarTextFontFamily = inputFont;
214
+	self.options.topBar.textFontSize = topBarTextFontSizeInput;
215
+	self.options.topBar.textFontFamily = inputFont;
216
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
216
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
217
 	[self.uut viewWillAppear:false];
217
 	[self.uut viewWillAppear:false];
218
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
218
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
223
 -(void)testTopBarTextFontFamily_invalidFont{
223
 -(void)testTopBarTextFontFamily_invalidFont{
224
 	NSString* inputFont = @"HelveticaNeueeeee";
224
 	NSString* inputFont = @"HelveticaNeueeeee";
225
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
225
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
226
-	self.options.topBarTextFontFamily = inputFont;
226
+	self.options.topBar.textFontFamily = inputFont;
227
 	//	XCTAssertThrows([self.uut viewWillAppear:false]);
227
 	//	XCTAssertThrows([self.uut viewWillAppear:false]);
228
 }
228
 }
229
 
229
 
378
 
378
 
379
 -(void)testTopBarNoBorderOn {
379
 -(void)testTopBarNoBorderOn {
380
 	NSNumber* topBarNoBorderInput = @(1);
380
 	NSNumber* topBarNoBorderInput = @(1);
381
-	self.options.topBarNoBorder = topBarNoBorderInput;
381
+	self.options.topBar.noBorder = topBarNoBorderInput;
382
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
382
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
383
 	[self.uut viewWillAppear:false];
383
 	[self.uut viewWillAppear:false];
384
 	XCTAssertNotNil(self.uut.navigationController.navigationBar.shadowImage);
384
 	XCTAssertNotNil(self.uut.navigationController.navigationBar.shadowImage);
386
 
386
 
387
 -(void)testTopBarNoBorderOff {
387
 -(void)testTopBarNoBorderOff {
388
 	NSNumber* topBarNoBorderInput = @(0);
388
 	NSNumber* topBarNoBorderInput = @(0);
389
-	self.options.topBarNoBorder = topBarNoBorderInput;
389
+	self.options.topBar.noBorder = topBarNoBorderInput;
390
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
390
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
391
 	[self.uut viewWillAppear:false];
391
 	[self.uut viewWillAppear:false];
392
 	XCTAssertNil(self.uut.navigationController.navigationBar.shadowImage);
392
 	XCTAssertNil(self.uut.navigationController.navigationBar.shadowImage);
441
 
441
 
442
 -(void)testTopBarBlur_false {
442
 -(void)testTopBarBlur_false {
443
 	NSNumber* topBarBlurInput = @(0);
443
 	NSNumber* topBarBlurInput = @(0);
444
-	self.options.topBarBlur = topBarBlurInput;
444
+	self.options.topBar.blur = topBarBlurInput;
445
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
445
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
446
 	[self.uut viewWillAppear:false];
446
 	[self.uut viewWillAppear:false];
447
 	XCTAssertNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
447
 	XCTAssertNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
449
 
449
 
450
 -(void)testTopBarBlur_true {
450
 -(void)testTopBarBlur_true {
451
 	NSNumber* topBarBlurInput = @(1);
451
 	NSNumber* topBarBlurInput = @(1);
452
-	self.options.topBarBlur = topBarBlurInput;
452
+	self.options.topBar.blur = topBarBlurInput;
453
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
453
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
454
 	[self.uut viewWillAppear:false];
454
 	[self.uut viewWillAppear:false];
455
 	XCTAssertNotNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
455
 	XCTAssertNotNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);

+ 21
- 13
playground/src/containers/OptionsScreen.js View File

13
 
13
 
14
   static get navigationOptions() {
14
   static get navigationOptions() {
15
     return {
15
     return {
16
-      title: 'Static Title',
17
-      topBarTextColor: 'black',
18
-      topBarTextFontSize: 16,
19
-      topBarTextFontFamily: 'HelveticaNeue-Italic',
16
+      topBar: {
17
+        title: 'Static Title',
18
+        textColor: 'black',
19
+        textFontSize: 16,
20
+        textFontFamily: 'HelveticaNeue-Italic'
21
+      },
20
       rightButtons: [{
22
       rightButtons: [{
21
         id: BUTTON_ONE,
23
         id: BUTTON_ONE,
22
         testID: BUTTON_ONE,
24
         testID: BUTTON_ONE,
85
 
87
 
86
   onClickDynamicOptions() {
88
   onClickDynamicOptions() {
87
     Navigation.setOptions(this.props.containerId, {
89
     Navigation.setOptions(this.props.containerId, {
88
-      title: 'Dynamic Title',
89
-      topBarTextColor: '#00FFFF',
90
-      topBarButtonColor: 'red',
91
-      topBarTextFontSize: 20,
92
-      topBarTextFontFamily: 'HelveticaNeue-CondensedBold'
90
+      topBar: {
91
+        title: 'Dynamic Title',
92
+        textColor: '#00FFFF',
93
+        buttonColor: 'red',
94
+        textFontSize: 20,
95
+        textFontFamily: 'HelveticaNeue-CondensedBold'
96
+      }
93
     });
97
     });
94
   }
98
   }
95
 
99
 
101
 
105
 
102
   onClickShowTopBar() {
106
   onClickShowTopBar() {
103
     Navigation.setOptions(this.props.containerId, {
107
     Navigation.setOptions(this.props.containerId, {
104
-      topBarHidden: false,
105
-      animateTopBarHide: true
108
+      topBar: {
109
+        hidden: false,
110
+        animateHide: true
111
+      }
106
     });
112
     });
107
   }
113
   }
108
 
114
 
109
   onClickHideTopBar() {
115
   onClickHideTopBar() {
110
     Navigation.setOptions(this.props.containerId, {
116
     Navigation.setOptions(this.props.containerId, {
111
-      topBarHidden: true,
112
-      animateTopBarHide: true
117
+      topBar: {
118
+        hidden: true,
119
+        animateHide: true
120
+      }
113
     });
121
     });
114
   }
122
   }
115
 
123
 

+ 6
- 2
playground/src/containers/ScrollViewScreen.js View File

8
 class ScrollViewScreen extends Component {
8
 class ScrollViewScreen extends Component {
9
   static get navigationOptions() {
9
   static get navigationOptions() {
10
     return {
10
     return {
11
-      topBarTranslucent: false
11
+      topBar: {
12
+        translucent: false
13
+      }
12
     };
14
     };
13
   }
15
   }
14
 
16
 
32
 
34
 
33
   onClickToggleTopBarHideOnScroll() {
35
   onClickToggleTopBarHideOnScroll() {
34
     Navigation.setOptions(this.props.containerId, {
36
     Navigation.setOptions(this.props.containerId, {
35
-      topBarHideOnScroll: !this.state.topBarHideOnScroll
37
+      topBar: {
38
+        hideOnScroll: !this.state.topBarHideOnScroll
39
+      }
36
     });
40
     });
37
   }
41
   }
38
 }
42
 }

+ 1
- 1
playground/src/containers/TextScreen.js View File

30
 
30
 
31
   onButtonPress() {
31
   onButtonPress() {
32
     Navigation.setOptions(this.props.containerId, {
32
     Navigation.setOptions(this.props.containerId, {
33
-      tabBadge: `EnCyClOpEdIa`
33
+      tabBadge: `TeSt`
34
     });
34
     });
35
   }
35
   }
36
 
36