Skip to content
Merged
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
4 changes: 3 additions & 1 deletion src/components/NavigationBar/index.android.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {useMemo} from 'react';
import {View} from 'react-native';
import useNetwork from '@hooks/useNetwork';
import useSafeAreaPaddings from '@hooks/useSafeAreaPaddings';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
Expand All @@ -10,11 +11,12 @@ function NavigationBar() {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const {insets, paddingBottom} = useSafeAreaPaddings();
const {isOffline} = useNetwork();

const navigationBarType = useMemo(() => StyleUtils.getNavigationBarType(insets), [StyleUtils, insets]);
const isSoftKeyNavigation = navigationBarType === CONST.NAVIGATION_BAR_TYPE.SOFT_KEYS;

return isSoftKeyNavigation ? <View style={[styles.navigationBarBG, styles.stickToBottom, {height: paddingBottom}]} /> : null;
return isSoftKeyNavigation ? <View style={[isOffline ? styles.appBG : styles.translucentNavigationBarBG, styles.stickToBottom, {height: paddingBottom}]} /> : null;
}
NavigationBar.displayName = 'NavigationBar';

Expand Down
7 changes: 2 additions & 5 deletions src/components/OfflineIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ type OfflineIndicatorProps = {

/** Whether to add bottom safe area padding to the view. */
addBottomSafeAreaPadding?: boolean;

/** Whether to make the indicator translucent. */
isTranslucent?: boolean;
};

function OfflineIndicator({style, containerStyles: containerStylesProp, addBottomSafeAreaPadding = false, isTranslucent = false}: OfflineIndicatorProps) {
function OfflineIndicator({style, containerStyles: containerStylesProp, addBottomSafeAreaPadding = false}: OfflineIndicatorProps) {
const theme = useTheme();
const styles = useThemeStyles();
const {translate} = useLocalize();
Expand All @@ -42,7 +39,7 @@ function OfflineIndicator({style, containerStyles: containerStylesProp, addBotto
}

return (
<View style={[containerStyles, isTranslucent && styles.navigationBarBG, styles.flexRow, styles.alignItemsCenter, style]}>
<View style={[containerStyles, styles.flexRow, styles.alignItemsCenter, style]}>
<Icon
fill={theme.icon}
src={Expensicons.OfflineCloud}
Expand Down
15 changes: 7 additions & 8 deletions src/components/ScreenWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function ScreenWrapper(
enableEdgeToEdgeBottomSafeAreaPadding: enableEdgeToEdgeBottomSafeAreaPaddingProp,
shouldMobileOfflineIndicatorStickToBottom: shouldMobileOfflineIndicatorStickToBottomProp,
shouldKeyboardOffsetBottomSafeAreaPadding: shouldKeyboardOffsetBottomSafeAreaPaddingProp,
isOfflineIndicatorTranslucent: isOfflineIndicatorTranslucentProp,
isOfflineIndicatorTranslucent = false,
}: ScreenWrapperProps,
ref: ForwardedRef<View>,
) {
Expand All @@ -201,7 +201,7 @@ function ScreenWrapper(
const {setRootStatusBarEnabled} = useContext(CustomStatusBarAndBackgroundContext);
const {initialURL} = useContext(InitialURLContext);

const [isSingleNewDotEntry] = useOnyx(ONYXKEYS.IS_SINGLE_NEW_DOT_ENTRY);
const [isSingleNewDotEntry] = useOnyx(ONYXKEYS.IS_SINGLE_NEW_DOT_ENTRY, {canBeMissing: true});

// When the `enableEdgeToEdgeBottomSafeAreaPadding` prop is explicitly set, we enable edge-to-edge mode.
const isUsingEdgeToEdgeMode = enableEdgeToEdgeBottomSafeAreaPaddingProp !== undefined;
Expand All @@ -210,7 +210,6 @@ function ScreenWrapper(
// We enable all of these flags by default, if we are using edge-to-edge mode.
const shouldMobileOfflineIndicatorStickToBottom = shouldMobileOfflineIndicatorStickToBottomProp ?? isUsingEdgeToEdgeMode;
const shouldKeyboardOffsetBottomSafeAreaPadding = shouldKeyboardOffsetBottomSafeAreaPaddingProp ?? isUsingEdgeToEdgeMode;
const isOfflineIndicatorTranslucent = isOfflineIndicatorTranslucentProp ?? isUsingEdgeToEdgeMode;

// We disable legacy bottom safe area padding handling, if we are using edge-to-edge mode.
const includeSafeAreaPaddingBottom = isUsingEdgeToEdgeMode ? false : includeSafeAreaPaddingBottomProp;
Expand Down Expand Up @@ -362,16 +361,16 @@ function ScreenWrapper(
* This style applies the background color of the mobile offline indicator.
* When there is not bottom content, and the device either has soft keys or is offline,
* the background style is applied.
* By default, the background color of the mobile offline indicator is translucent.
* If `isOfflineIndicatorTranslucent` is set to true, an opaque background color is applied.
* By default, the background color of the mobile offline indicator is opaque.
* If `isOfflineIndicatorTranslucent` is set to true, a translucent background color is applied.
*/
const mobileOfflineIndicatorBackgroundStyle = useMemo(() => {
const showOfflineIndicatorBackground = !extraContent && (isSoftKeyNavigation || isOffline);
const showOfflineIndicatorBackground = !extraContent && isOffline;
if (!showOfflineIndicatorBackground) {
return undefined;
}
return isOfflineIndicatorTranslucent ? styles.navigationBarBG : styles.appBG;
}, [extraContent, isOffline, isOfflineIndicatorTranslucent, isSoftKeyNavigation, styles.appBG, styles.navigationBarBG]);
return isOfflineIndicatorTranslucent ? styles.translucentNavigationBarBG : styles.appBG;
}, [extraContent, isOffline, isOfflineIndicatorTranslucent, styles.appBG, styles.translucentNavigationBarBG]);

/** In edge-to-edge mode, we always want to apply the bottom safe area padding to the mobile offline indicator. */
const hasMobileOfflineIndicatorBottomSafeAreaPadding = isUsingEdgeToEdgeMode ? enableEdgeToEdgeBottomSafeAreaPadding : !includeSafeAreaPaddingBottom;
Expand Down
3 changes: 3 additions & 0 deletions src/pages/workspace/WorkspaceNewRoomPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import useActiveWorkspace from '@hooks/useActiveWorkspace';
import useAutoFocusInput from '@hooks/useAutoFocusInput';
import useBottomSafeSafeAreaPaddingStyle from '@hooks/useBottomSafeSafeAreaPaddingStyle';
import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useSafeAreaInsets from '@hooks/useSafeAreaInsets';
import useThemeStyles from '@hooks/useThemeStyles';
import {addErrorMessage} from '@libs/ErrorUtils';
Expand All @@ -43,6 +44,7 @@ function WorkspaceNewRoomPage() {
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: false});
// We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to show offline indicator on small screen only
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {isSmallScreenWidth} = useResponsiveLayout();
const {top} = useSafeAreaInsets();
const [visibility, setVisibility] = useState<ValueOf<typeof CONST.REPORT.VISIBILITY>>(CONST.REPORT.VISIBILITY.RESTRICTED);
const [writeCapability, setWriteCapability] = useState<ValueOf<typeof CONST.REPORT.WRITE_CAPABILITIES>>(CONST.REPORT.WRITE_CAPABILITIES.ALL);
Expand Down Expand Up @@ -234,6 +236,7 @@ function WorkspaceNewRoomPage() {
onSubmit={submit}
enabledWhenOffline
addBottomSafeAreaPadding
addOfflineIndicatorBottomSafeAreaPadding={isSmallScreenWidth}
>
<View style={styles.mb5}>
<InputWrapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import LottieAnimations from '@components/LottieAnimations';
import MenuItem from '@components/MenuItem';
import ScreenWrapper from '@components/ScreenWrapper';
import Text from '@components/Text';
import useBottomSafeSafeAreaPaddingStyle from '@hooks/useBottomSafeSafeAreaPaddingStyle';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import useWorkspaceAccountID from '@hooks/useWorkspaceAccountID';
Expand All @@ -37,14 +38,14 @@ type WorkspaceExpensifyCardBankAccountsProps = PlatformStackScreenProps<Settings
function WorkspaceExpensifyCardBankAccounts({route}: WorkspaceExpensifyCardBankAccountsProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const [bankAccountsList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [bankAccountsList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST, {canBeMissing: false});

const policyID = route?.params?.policyID;

const workspaceAccountID = useWorkspaceAccountID(policyID);

const [cardBankAccountMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_BANK_ACCOUNT_METADATA}${workspaceAccountID}`);
const [cardOnWaitlist] = useOnyx(`${ONYXKEYS.COLLECTION.NVP_EXPENSIFY_ON_CARD_WAITLIST}${policyID}`);
const [cardBankAccountMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.EXPENSIFY_CARD_BANK_ACCOUNT_METADATA}${workspaceAccountID}`, {canBeMissing: true});
const [cardOnWaitlist] = useOnyx(`${ONYXKEYS.COLLECTION.NVP_EXPENSIFY_ON_CARD_WAITLIST}${policyID}`, {canBeMissing: true});

const getVerificationState = () => {
if (cardOnWaitlist) {
Expand Down Expand Up @@ -102,6 +103,8 @@ function WorkspaceExpensifyCardBankAccounts({route}: WorkspaceExpensifyCardBankA
const verificationState = getVerificationState();
const isInVerificationState = !!verificationState;

const bottomSafeAreaPaddingStyle = useBottomSafeSafeAreaPaddingStyle({addBottomSafeAreaPadding: true});

const renderVerificationStateView = () => {
switch (verificationState) {
case CONST.EXPENSIFY_CARD.VERIFICATION_STATE.LOADING:
Expand All @@ -114,6 +117,7 @@ function WorkspaceExpensifyCardBankAccounts({route}: WorkspaceExpensifyCardBankA
animationWebStyle={styles.loadingVBAAnimationWeb}
subtitleStyle={styles.textLabelSupporting}
containerStyle={styles.pb20}
addBottomSafeAreaPadding
/>
);
case CONST.EXPENSIFY_CARD.VERIFICATION_STATE.ON_WAITLIST:
Expand All @@ -131,7 +135,7 @@ function WorkspaceExpensifyCardBankAccounts({route}: WorkspaceExpensifyCardBankA
success
large
text={translate('workspace.expensifyCard.goToConcierge')}
style={[styles.m5]}
style={[styles.m5, bottomSafeAreaPaddingStyle]}
pressOnEnter
onPress={() => Navigation.navigate(ROUTES.CONCIERGE)}
/>
Expand All @@ -152,7 +156,7 @@ function WorkspaceExpensifyCardBankAccounts({route}: WorkspaceExpensifyCardBankA
success
large
text={translate('workspace.expensifyCard.gotIt')}
style={[styles.m5]}
style={[styles.m5, bottomSafeAreaPaddingStyle]}
pressOnEnter
onPress={() => {
Navigation.dismissModal();
Expand Down
4 changes: 2 additions & 2 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5659,8 +5659,8 @@ const styles = (theme: ThemeColors) =>
borderRadius: variables.componentBorderRadiusNormal,
},

navigationBarBG: {
backgroundColor: theme.navigationBarBackgroundColor,
translucentNavigationBarBG: {
backgroundColor: theme.translucentNavigationBarBackgroundColor,
},

stickToBottom: {
Expand Down
2 changes: 1 addition & 1 deletion src/styles/theme/themes/dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const darkTheme = {

statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT,
navigationBarButtonsStyle: CONST.NAVIGATION_BAR_BUTTONS_STYLE.LIGHT,
navigationBarBackgroundColor: `${colors.productDark100}CD`, // CD is 80% opacity (80% of 0xFF)
translucentNavigationBarBackgroundColor: `${colors.productDark100}CD`, // CD is 80% opacity (80% of 0xFF)
colorScheme: CONST.COLOR_SCHEME.DARK,
} satisfies ThemeColors;

Expand Down
2 changes: 1 addition & 1 deletion src/styles/theme/themes/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const lightTheme = {

statusBarStyle: CONST.STATUS_BAR_STYLE.DARK_CONTENT,
navigationBarButtonsStyle: CONST.NAVIGATION_BAR_BUTTONS_STYLE.DARK,
navigationBarBackgroundColor: `${colors.productLight100}CD`, // CD is 80% opacity (80% of 0xFF)
translucentNavigationBarBackgroundColor: `${colors.productLight100}CD`, // CD is 80% opacity (80% of 0xFF)
colorScheme: CONST.COLOR_SCHEME.LIGHT,
} satisfies ThemeColors;

Expand Down
2 changes: 1 addition & 1 deletion src/styles/theme/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ type ThemeColors = {
// e.g. the StatusBar displays either "light-content" or "dark-content" based on the theme
statusBarStyle: StatusBarStyle;
navigationBarButtonsStyle: NavBarButtonStyle;
navigationBarBackgroundColor: Color;
translucentNavigationBarBackgroundColor: Color;
colorScheme: ColorScheme;
};

Expand Down