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

chore: [IOAPPX-476] Change StatusBar style according to the current color scheme #6680

Merged
merged 47 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
2ce4801
Adapt `StatusBar` style according to the current color scheme
dmnplb Feb 3, 2025
2ffa0c5
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 3, 2025
d00306b
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 4, 2025
725cf14
Update `io-app-design-system` to `4.5.2`
dmnplb Feb 4, 2025
6503bc7
Change logic of the header in the `CgnMerchantsListByCategory`
dmnplb Feb 4, 2025
0dde159
Fix TS errors
dmnplb Feb 4, 2025
3f81c43
Update `jest` snapshots
dmnplb Feb 4, 2025
d5654cc
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
LeleDallas Feb 4, 2025
29a604b
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 5, 2025
378a035
Fix `backgroundColor` on Android devices
dmnplb Feb 5, 2025
4e7b0df
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 5, 2025
d885e9e
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
LeleDallas Feb 6, 2025
9e92847
Update `io-app-design-system` to `4.5.3`
dmnplb Feb 6, 2025
47c244c
Fix `CGN` main detail screen
dmnplb Feb 6, 2025
034b51f
Update `io-app-design-system` to `4.5.4`
dmnplb Feb 6, 2025
be32710
style: cards header color based on type and theme
LeleDallas Feb 6, 2025
a9561a5
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 6, 2025
c7bf872
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 6, 2025
e5e78b9
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 7, 2025
3f6c115
Remove hardcoded `StatusBar` from legacy components
dmnplb Feb 7, 2025
f8a4062
Remove other `StatusBar` references
dmnplb Feb 7, 2025
3451825
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 11, 2025
65ffb86
Update `io-app-design-system` to `4.5.5`
dmnplb Feb 11, 2025
b4454f5
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 12, 2025
23ef002
Update `jest` snapshots
dmnplb Feb 12, 2025
a1d0a07
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 13, 2025
0c974f2
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
LeleDallas Feb 13, 2025
c1ac518
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 17, 2025
69457d5
Replace `StatusBar` with `FocusAwareStatusBar`
dmnplb Feb 17, 2025
6b30b6f
Add theme key to the icon in the `CgnMerchantCategory` list item
dmnplb Feb 17, 2025
76beca2
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 18, 2025
8daeecd
Fix visual appearance of some CGN screens when dark mode is enabled
dmnplb Feb 18, 2025
4ff855b
Add support for custom `StatusBar` to `ItwCredential…` screen
dmnplb Feb 18, 2025
0149023
Revert "Add support for custom `StatusBar` to `ItwCredential…` screen"
dmnplb Feb 18, 2025
7012332
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 18, 2025
131520a
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 19, 2025
593c6ba
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 19, 2025
816cb3e
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 20, 2025
a654eda
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 21, 2025
076d08f
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 24, 2025
7313fe9
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 24, 2025
9b42901
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 25, 2025
f206b81
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 26, 2025
fbe1dac
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 26, 2025
78df87a
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 27, 2025
5ff6d80
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 28, 2025
feedd02
Merge branch 'master' into IOAPPX-476-adapt-status-bar-according-to-c…
dmnplb Feb 28, 2025
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
13 changes: 3 additions & 10 deletions ts/RootContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,27 @@ import {
AppState,
AppStateStatus,
EmitterSubscription,
NativeEventSubscription,
StatusBar
NativeEventSubscription
} from "react-native";
import SplashScreen from "react-native-splash-screen";
import { connect } from "react-redux";
import configurePushNotifications from "./features/pushNotifications/utils/configurePushNotification";
import DebugInfoOverlay from "./components/DebugInfoOverlay";
import PagoPATestIndicatorOverlay from "./components/PagoPATestIndicatorOverlay";
import { LightModalRoot } from "./components/ui/LightModal";
import configurePushNotifications from "./features/pushNotifications/utils/configurePushNotification";
import { setLocale } from "./i18n";
import { IONavigationContainer } from "./navigation/AppStackNavigator";
import RootModal from "./screens/modal/RootModal";
import { applicationChangeState } from "./store/actions/application";
import { setDebugCurrentRouteName } from "./store/actions/debug";
import { navigateBack } from "./store/actions/navigation";
import { setScreenReaderEnabled } from "./store/actions/preferences";
import { isDebugModeEnabledSelector } from "./store/reducers/debug";
import {
isPagoPATestEnabledSelector,
preferredLanguageSelector
} from "./store/reducers/persistedPreferences";
import { GlobalState } from "./store/reducers/types";
import customVariables from "./theme/variables";
import { setScreenReaderEnabled } from "./store/actions/preferences";

type Props = ReturnType<typeof mapStateToProps> & typeof mapDispatchToProps;

Expand Down Expand Up @@ -109,11 +107,6 @@ class RootContainer extends PureComponent<Props> {

return (
<>
<StatusBar
barStyle={"dark-content"}
backgroundColor={customVariables.androidStatusBarColor}
/>

<IONavigationContainer />

{/* When debug mode is enabled, the following information
Expand Down
43 changes: 34 additions & 9 deletions ts/components/BonusCard/BonusCardScreenComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { HeaderActionProps } from "@pagopa/io-app-design-system";
import {
HeaderActionProps,
IOColors,
useIOThemeContext
} from "@pagopa/io-app-design-system";
import { ReactNode } from "react";
import { Dimensions } from "react-native";
import Animated, { useAnimatedRef } from "react-native-reanimated";
import { useHeaderSecondLevel } from "../../hooks/useHeaderSecondLevel";
import { SupportRequestParams } from "../../hooks/useStartSupportRequest";
import { isAndroid } from "../../utils/platform";
import FocusAwareStatusBar from "../ui/FocusAwareStatusBar";
import { IOScrollView, IOScrollViewActions } from "../ui/IOScrollView";
import { BonusCard } from "./BonusCard";

Expand Down Expand Up @@ -41,10 +47,24 @@ const BonusCardScreenComponent = ({
const screenHeight = Dimensions.get("window").height;
const shouldHideLogo = screenHeight < MIN_HEIGHT_TO_SHOW_FULL_RENDER;

const { themeType } = useIOThemeContext();

const isDark = themeType === "dark";
// We need to check if the card is a CGN type to set the background color
const isCGNType = !cardProps.isLoading && cardProps.cardBackground;
// Custom background color for CGN based on the platform
const cgnBackgroundColor = isAndroid ? IOColors.white : IOColors["grey-50"];
// If the card is not a CGN type, we set the default header background color as card color
const backgroundColor = isCGNType
? cgnBackgroundColor
: IOColors["blueIO-50"];

useHeaderSecondLevel({
title: title || "",
transparent: true,
supportRequest: true,
variant: "neutral",
backgroundColor,
faqCategories,
contextualHelpMarkdown,
contextualHelp,
Expand All @@ -54,14 +74,19 @@ const BonusCardScreenComponent = ({
});

return (
<IOScrollView
animatedRef={animatedScrollViewRef}
actions={actions}
includeContentMargins={false}
>
<BonusCard hideLogo={shouldHideLogo} {...cardProps} />
{children}
</IOScrollView>
<>
<FocusAwareStatusBar
barStyle={isAndroid && isDark ? "light-content" : "dark-content"}
/>
<IOScrollView
animatedRef={animatedScrollViewRef}
actions={actions}
includeContentMargins={false}
>
<BonusCard hideLogo={shouldHideLogo} {...cardProps} />
{children}
</IOScrollView>
</>
);
};

Expand Down
7 changes: 1 addition & 6 deletions ts/components/ui/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

import { IOStyles, IOVisualCostants } from "@pagopa/io-app-design-system";
import { PropsWithChildren } from "react";
import { ColorValue, StatusBar, View, ViewProps } from "react-native";
import { ColorValue, View, ViewProps } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import variables from "../../theme/variables";

type Props = ViewProps & {
backgroundColor?: ColorValue;
Expand All @@ -23,10 +22,6 @@ const AppHeader = (props: PropsWithChildren<Props>) => {
backgroundColor: props.backgroundColor
}}
>
<StatusBar
barStyle={"dark-content"}
backgroundColor={variables.androidStatusBarColor}
/>
<View
style={{
...IOStyles.row,
Expand Down
3 changes: 2 additions & 1 deletion ts/components/ui/FocusAwareStatusBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { StatusBar, StatusBarProps } from "react-native";

const FocusAwareStatusBar = (props: StatusBarProps) => {
const isFocused = useIsFocused();
return <>{isFocused && <StatusBar {...props} />}</>;

return isFocused && <StatusBar {...props} />;
};

export default FocusAwareStatusBar;
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const CategoryTag = ({ category }: CategoryTagProps) => {
return O.isSome(categorySpecs) ? (
<Tag
text={I18n.t(categorySpecs.value.nameKey)}
forceLightMode
variant="custom"
icon={{
name: categorySpecs.value.icon,
Expand Down Expand Up @@ -108,7 +109,7 @@ export const ModuleCgnDiscount = ({ onPress, discount }: ModuleCgnDiscount) => {
</HStack>
)}

<H6>{discount.name}</H6>
<H6 color={"grey-850"}>{discount.name}</H6>
<HStack space={4} style={{ flexWrap: "wrap" }}>
{discount.productCategories.map(categoryKey => (
<CategoryTag key={categoryKey} category={categoryKey} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
IOStyles,
VSpacer
} from "@pagopa/io-app-design-system";
import { useHeaderHeight } from "@react-navigation/elements";
import { StyleSheet, View } from "react-native";
import { Discount } from "../../../../../../../definitions/cgn/merchants/Discount";
import I18n from "../../../../../../i18n";
Expand All @@ -26,8 +25,6 @@ export const CgnDiscountHeader = ({
? styles.backgroundNewItem
: styles.backgroundDefault;

const headerHeight = useHeaderHeight();

const { isNew, discount, name, productCategories } = discountDetails;

return (
Expand All @@ -36,7 +33,6 @@ export const CgnDiscountHeader = ({
style={[
IOStyles.horizontalContentPadding,
{
paddingTop: headerHeight,
backgroundColor: discountColor.backgroundColor,
paddingBottom: 24
}
Expand All @@ -63,7 +59,7 @@ export const CgnDiscountHeader = ({
<VSpacer size={12} />
</>
)}
<H3>{name}</H3>
<H3 color="grey-850">{name}</H3>
<VSpacer size={12} />
<HStack space={4} style={{ flexWrap: "wrap" }}>
{productCategories.map(categoryKey => (
Expand Down
1 change: 1 addition & 0 deletions ts/features/bonus/cgn/screens/CgnDetailScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ const CgnDetailScreen = (props: Props): ReactElement => {
}
cardFooter={
<H4
color="black"
style={{
textAlign: "center",
marginHorizontal: 16,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
} from "../../store/reducers/merchants";
import { cgnOtpDataSelector } from "../../store/reducers/otp";
import { getCgnUserAgeRange } from "../../utils/dates";
import FocusAwareStatusBar from "../../../../../components/ui/FocusAwareStatusBar";

const gradientSafeAreaHeight: IOSpacingScale = 96;

Expand Down Expand Up @@ -203,7 +204,8 @@ const CgnDiscountDetailScreen = () => {
},
backgroundColor,
canGoBack: true,
supportRequest: true
supportRequest: true,
variant: "neutral"
});

useEffect(() => {
Expand Down Expand Up @@ -256,6 +258,10 @@ const CgnDiscountDetailScreen = () => {
if (discountDetails && merchantDetails) {
return (
<>
<FocusAwareStatusBar
backgroundColor={backgroundColor}
barStyle={"dark-content"}
/>
<Animated.ScrollView
style={{ flexGrow: 1 }}
onScroll={scrollHandler}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
H6,
IOToast,
ListItemAction,
ListItemNav
ListItemNav,
useIOTheme
} from "@pagopa/io-app-design-system";
import * as pot from "@pagopa/ts-commons/lib/pot";
import { useNavigation } from "@react-navigation/native";
Expand All @@ -27,6 +28,7 @@ import { cgnCategoriesListSelector } from "../../store/reducers/categories";
import { getCategorySpecs } from "../../utils/filters";

export const CgnMerchantCategoriesListScreen = () => {
const theme = useIOTheme();
const insets = useSafeAreaInsets();
const dispatch = useIODispatch();
const [isPullRefresh, setIsPullRefresh] = useState(false);
Expand Down Expand Up @@ -110,7 +112,7 @@ export const CgnMerchantCategoriesListScreen = () => {
}
);
}}
iconColor="grey-300"
iconColor={theme["icon-decorative"]}
icon={s.icon}
/>
)
Expand Down
Loading
Loading