Browse Source

changed centering logic of title on android (#1164)

Kelt 7 years ago
parent
commit
1d73739dc5

+ 2
- 4
android/app/src/main/java/com/reactnativenavigation/views/TitleBar.java View File

91
             @Override
91
             @Override
92
             public void run() {
92
             public void run() {
93
                 if (params.titleBarTitleTextCentered) {
93
                 if (params.titleBarTitleTextCentered) {
94
-                    int[] location = new int[2];
95
-                    titleView.getLocationOnScreen(location);
96
-                    titleView.setTranslationX(titleView.getTranslationX() + (-location[0] + ViewUtils.getScreenWidth() / 2 - titleView.getWidth() / 2));
94
+                    titleView.setX(ViewUtils.getScreenWidth() / 2 - titleView.getWidth() / 2);
97
                 }
95
                 }
98
-
96
+                
99
             }
97
             }
100
         });
98
         });
101
     }
99
     }