File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
android/src/main/java/com/tksp/navbarstyle Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -27,11 +27,20 @@ public String getName() {
27
27
28
28
@ ReactMethod
29
29
public void setNavbarColor (String color , Promise promise ) {
30
- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .LOLLIPOP ) {
31
- getCurrentActivity ().getWindow ().setNavigationBarColor (Color .parseColor (color ));
32
- promise .resolve (true );
33
- } else {
34
- promise .reject (new Exception ("Current android version(" + Build .VERSION .SDK_INT + ") does not support changing the navbar color." ));
30
+ try {
31
+ UiThreadUtil .runOnUiThread (new Runnable () {
32
+ @ Override
33
+ public void run () {
34
+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .LOLLIPOP ) {
35
+ getCurrentActivity ().getWindow ().setNavigationBarColor (Color .parseColor (color ));
36
+ promise .resolve (true );
37
+ } else {
38
+ promise .reject (new Exception ("Current android version(" + Build .VERSION .SDK_INT + ") does not support changing the navbar color." ));
39
+ }
40
+ }
41
+ });
42
+ } catch (Exception e ) {
43
+ promise .reject (e );
35
44
}
36
45
}
37
46
You can’t perform that action at this time.
0 commit comments