Przeglądaj źródła

Animate Toolbar toggle

Guy Carmeli 8 lat temu
rodzic
commit
c1d121608c

+ 4
- 2
android/app/src/main/java/com/reactnativenavigation/views/RnnToolBar.java Wyświetl plik

@@ -118,7 +118,8 @@ public class RnnToolBar extends Toolbar {
118 118
         ActionBar actionBar = ((AppCompatActivity) getContext()).getSupportActionBar();
119 119
         if (actionBar != null) {
120 120
             actionBar.setShowHideAnimationEnabled(animated);
121
-            actionBar.show();
121
+            // We hide the ToolBar's parent (AppBarLayout) since this animates the shadow added by AppBar as well
122
+            ((View) getParent()).setVisibility(VISIBLE);
122 123
         }
123 124
     }
124 125
 
@@ -126,7 +127,8 @@ public class RnnToolBar extends Toolbar {
126 127
         ActionBar actionBar = ((AppCompatActivity) getContext()).getSupportActionBar();
127 128
         if (actionBar != null) {
128 129
             actionBar.setShowHideAnimationEnabled(animated);
129
-            actionBar.hide();
130
+            // We hide the ToolBar's parent (AppBarLayout) since this animates the shadow added by AppBar as well
131
+            ((View) getParent()).setVisibility(GONE);
130 132
         }
131 133
     }
132 134
 

+ 2
- 1
android/app/src/main/res/layout/bottom_tab_activity.xml Wyświetl plik

@@ -5,7 +5,8 @@
5 5
     android:orientation="vertical"
6 6
     android:layout_width="match_parent"
7 7
     android:layout_height="match_parent"
8
-    tools:context=".activities.TabActivity">
8
+    tools:context=".activities.TabActivity"
9
+    android:animateLayoutChanges="true">
9 10
 
10 11
     <android.support.design.widget.AppBarLayout
11 12
         android:id="@+id/appbar"