Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix android status bar color #15471

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.os.Bundle;
import android.content.pm.ActivityInfo;
import android.view.Window;
import android.view.WindowManager;
import com.expensify.chat.bootsplash.BootSplash;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
Expand Down Expand Up @@ -52,6 +54,11 @@ protected boolean isConcurrentRootEnabled() {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null);

// Make the app take up the full screen (painted behind transparent status bar)
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
Comment on lines +58 to +60
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to do this programmatically, it's less obvious and hard to find IMO. Instead, let's use the style attribute (suggested below).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I take this back. Seems like it is necessary because React Native doesn't use Android layouts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A problem with React native not letting us modify the Android layout is that adding padding to our outermost layout (to solve the overlapping issue) is problematic. I think we'll need to do this:


if (getResources().getBoolean(R.bool.portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
Expand Down
11 changes: 5 additions & 6 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<resources xmlns:tools="http://schemas.android.com/tools">

<!-- App Theme for Android versions 7.1 and below -->
<style name="AppTheme" parent="BaseAppTheme"/>

<!-- Base application theme. Applied to all Android versions -->
<style name="BaseAppTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:colorEdgeEffect">@color/gray4</item>
<item name="android:statusBarColor">#061B09</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="colorAccent">@color/accent</item>
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
</style>

<!-- App Theme for Android versions 7.1 and below -->
<style name="AppTheme" parent="BaseAppTheme"/>

<!-- Themes unique to the boot splash page -->
<style name="BootTheme" parent="AppTheme">
<item name="android:background">@drawable/bootsplash</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:fitsSystemWindows">true</item>
</style>

</resources>
18 changes: 0 additions & 18 deletions src/components/CustomStatusBar/index.android.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/pages/SetPasswordPage.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, {Component} from 'react';
import {
SafeAreaView,
View,
} from 'react-native';
import {SafeAreaView} from 'react-native-safe-area-context';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/signin/SignInPage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {Component} from 'react';
import {
SafeAreaView,
} from 'react-native';
} from 'react-native-safe-area-context';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import ONYXKEYS from '../../ONYXKEYS';
Expand Down