Skip to content

Commit

Permalink
chore: fixed issues with status notice (#91)
Browse files Browse the repository at this point in the history
- Fixed empty team tab issue;
- Fixed UI issues when the status notice is rendered
  • Loading branch information
ice-hades authored Jun 28, 2023
1 parent e008d2e commit 83867d2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/hooks/useSafeAreaFrame.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: ice License 1.0

import {useNavigation} from '@react-navigation/native';
import {statusNoticeHeightSelector} from '@store/modules/StatusNotice/selectors';
// eslint-disable-next-line no-restricted-imports
import {useSafeAreaFrame as useSafeAreaFrameOriginal} from 'react-native-safe-area-context';
Expand All @@ -8,8 +9,12 @@ import {useSelector} from 'react-redux';
export function useSafeAreaFrame(enforce?: boolean) {
const statusNoticeHeight = useSelector(statusNoticeHeightSelector);
const frame = useSafeAreaFrameOriginal();
const navigation = useNavigation();
const isRootLevelScreen = !navigation.getParent();

const noticeHeight = isRootLevelScreen ? 0 : statusNoticeHeight;
return {
...frame,
height: enforce ? frame.height : frame.height - statusNoticeHeight,
height: enforce ? frame.height : frame.height - noticeHeight,
};
}
7 changes: 5 additions & 2 deletions src/navigation/hooks/useFocusStatusBar.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: ice License 1.0

import {useFocusEffect} from '@react-navigation/native';
import {useFocusEffect, useNavigation} from '@react-navigation/native';
import {statusNoticeHeightSelector} from '@store/modules/StatusNotice/selectors';
import {useCallback} from 'react';
import {Keyboard, StatusBar, StatusBarStyle} from 'react-native';
Expand All @@ -13,7 +13,10 @@ type Props = {
};

export const useFocusStatusBar = ({style, animated}: Props) => {
const isStatusNoticeRendered = useSelector(statusNoticeHeightSelector);
const statusNoticeHeight = useSelector(statusNoticeHeightSelector);
const navigation = useNavigation();
const isRootLevelScreen = !navigation.getParent();
const isStatusNoticeRendered = !!statusNoticeHeight && !isRootLevelScreen;
useFocusEffect(
useCallback(() => {
StatusBar.setBarStyle(
Expand Down
1 change: 0 additions & 1 deletion src/screens/Team/components/DynamicHeight/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export const DynamicHeight = ({
enableOverDrag={true}
animatedIndex={animatedIndex}
overDragResistanceFactor={10}
containerHeight={frame.height}
backgroundStyle={commonStyles.baseSubScreen}
/**
* This is required to let child PagerView handle horizontal swipes
Expand Down

0 comments on commit 83867d2

Please sign in to comment.