Browse Source

Topbar (#2382)

* readme

* doc

* topbar fix

* rm doc

* options presenter fix

* rm userless stuff
Roman Kozlov 6 years ago
parent
commit
3bb5574ccc

+ 3
- 2
lib/android/app/src/main/java/com/reactnativenavigation/anim/StackAnimator.java View File

@@ -12,6 +12,7 @@ import android.view.ViewGroup;
12 12
 import android.view.WindowManager;
13 13
 import android.view.animation.AccelerateInterpolator;
14 14
 import android.view.animation.DecelerateInterpolator;
15
+import android.widget.LinearLayout;
15 16
 
16 17
 import com.reactnativenavigation.views.TopBar;
17 18
 
@@ -118,7 +119,7 @@ public class StackAnimator {
118 119
 		containerHeightAnim.setDuration(DURATION_TOPBAR);
119 120
 		containerHeightAnim.addUpdateListener(valueAnimator -> {
120 121
             int val = (Integer) valueAnimator.getAnimatedValue();
121
-            ViewGroup.LayoutParams layoutParams = container.getLayoutParams();
122
+			ViewGroup.LayoutParams layoutParams = container.getLayoutParams();
122 123
             layoutParams.height = val;
123 124
             container.setLayoutParams(layoutParams);
124 125
         });
@@ -164,7 +165,7 @@ public class StackAnimator {
164 165
 		containerHeightAnim.setDuration(DURATION_TOPBAR);
165 166
 		containerHeightAnim.addUpdateListener(valueAnimator -> {
166 167
             int val = (Integer) valueAnimator.getAnimatedValue();
167
-            ViewGroup.LayoutParams layoutParams = container.getLayoutParams();
168
+			ViewGroup.LayoutParams layoutParams = container.getLayoutParams();
168 169
             layoutParams.height = val;
169 170
             container.setLayoutParams(layoutParams);
170 171
         });

+ 4
- 8
lib/android/app/src/main/java/com/reactnativenavigation/react/ReactView.java View File

@@ -26,14 +26,10 @@ public class ReactView extends ReactRootView implements ContainerViewController.
26 26
 	}
27 27
 
28 28
 	private void start() {
29
-		setEventListener(new ReactRootView.ReactRootViewEventListener() {
30
-
31
-			@Override
32
-			public void onAttachedToReactInstance(final ReactRootView reactRootView) {
33
-				reactRootView.setEventListener(null);
34
-				isAttachedToReactInstance = true;
35
-			}
36
-		});
29
+		setEventListener(reactRootView -> {
30
+            reactRootView.setEventListener(null);
31
+            isAttachedToReactInstance = true;
32
+        });
37 33
 		final Bundle opts = new Bundle();
38 34
 		opts.putString("containerId", containerId);
39 35
 		startReactApplication(reactInstanceManager, containerName, opts);

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ContainerViewController.java View File

@@ -89,7 +89,7 @@ public class ContainerViewController extends ViewController implements Navigatio
89 89
 	@Override
90 90
 	public void mergeNavigationOptions(NavigationOptions options) {
91 91
 		navigationOptions.mergeWith(options);
92
-        container.applyOptions(options);
92
+        container.applyOptions(navigationOptions);
93 93
 	}
94 94
 
95 95
 	NavigationOptions getNavigationOptions() {

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/views/ContainerLayout.java View File

@@ -21,7 +21,7 @@ public class ContainerLayout extends LinearLayout implements ReactContainer {
21 21
 		super(context);
22 22
 		this.topBar = new TopBar(context);
23 23
 		this.reactView = reactView;
24
-        optionsPresenter = new OptionsPresenter(topBar, this);
24
+        optionsPresenter = new OptionsPresenter(topBar, reactView.asView());
25 25
         initViews();
26 26
 	}
27 27
 
@@ -61,7 +61,7 @@ public class ContainerLayout extends LinearLayout implements ReactContainer {
61 61
         optionsPresenter.applyOptions(options);
62 62
     }
63 63
 
64
-    @Override
64
+	@Override
65 65
     @RestrictTo(RestrictTo.Scope.TESTS)
66 66
     public TopBar getTopBar() {
67 67
         return topBar;

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/views/TopTabsLayout.java View File

@@ -27,7 +27,7 @@ public class TopTabsLayout extends LinearLayout implements Container {
27 27
         topBar = new TopBar(context);
28 28
         this.tabs = tabs;
29 29
         viewPager = new TopTabsViewPager(context, tabs);
30
-        optionsPresenter = new OptionsPresenter(topBar, this);
30
+        optionsPresenter = new OptionsPresenter(topBar, viewPager);
31 31
         initViews();
32 32
     }
33 33
 

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestContainerLayout.java View File

@@ -16,7 +16,7 @@ public class TestContainerLayout extends View implements ReactContainer {
16 16
     public TestContainerLayout(final Context context) {
17 17
 		super(context);
18 18
         topBar = new TopBar(context);
19
-        optionsPresenter = new OptionsPresenter(topBar, this);
19
+        optionsPresenter = new OptionsPresenter(topBar, new View(context));
20 20
     }
21 21
 
22 22
     public TopBar getTopBar() {