Skip to content

Commit 499b61b

Browse files
Merge pull request #53686 from nkdengineer/fix/53444
fix: Navigation bar shows purple color in offline mode
2 parents a05ae82 + 8286cc3 commit 499b61b

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/components/ScreenWrapper.tsx

+12-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {PickerAvoidingView} from 'react-native-picker-select';
77
import type {EdgeInsets} from 'react-native-safe-area-context';
88
import useEnvironment from '@hooks/useEnvironment';
99
import useInitialDimensions from '@hooks/useInitialWindowDimensions';
10-
import useNetwork from '@hooks/useNetwork';
1110
import useResponsiveLayout from '@hooks/useResponsiveLayout';
1211
import useStyledSafeAreaInsets from '@hooks/useStyledSafeAreaInsets';
1312
import useTackInputFocus from '@hooks/useTackInputFocus';
@@ -158,7 +157,6 @@ function ScreenWrapper(
158157
const {initialHeight} = useInitialDimensions();
159158
const styles = useThemeStyles();
160159
const {isDevelopment} = useEnvironment();
161-
const {isOffline} = useNetwork();
162160
const [didScreenTransitionEnd, setDidScreenTransitionEnd] = useState(false);
163161
const maxHeight = shouldEnableMaxHeight ? windowHeight : undefined;
164162
const minHeight = shouldEnableMinHeight && !Browser.isSafari() ? initialHeight : undefined;
@@ -244,18 +242,17 @@ function ScreenWrapper(
244242
}
245243

246244
// We always need the safe area padding bottom if we're showing the offline indicator since it is bottom-docked.
247-
const isSafeAreaBottomPaddingApplied = includeSafeAreaPaddingBottom || (isOffline && shouldShowOfflineIndicator);
248-
if (isSafeAreaBottomPaddingApplied) {
245+
if (includeSafeAreaPaddingBottom) {
249246
paddingStyle.paddingBottom = paddingBottom;
250247
}
251-
if (isSafeAreaBottomPaddingApplied && ignoreInsetsConsumption) {
248+
if (includeSafeAreaPaddingBottom && ignoreInsetsConsumption) {
252249
paddingStyle.paddingBottom = unmodifiedPaddings.bottom;
253250
}
254251

255252
const isAvoidingViewportScroll = useTackInputFocus(isFocused && shouldEnableMaxHeight && shouldAvoidScrollOnVirtualViewport && Browser.isMobileWebKit());
256253
const contextValue = useMemo(
257-
() => ({didScreenTransitionEnd, isSafeAreaTopPaddingApplied, isSafeAreaBottomPaddingApplied}),
258-
[didScreenTransitionEnd, isSafeAreaBottomPaddingApplied, isSafeAreaTopPaddingApplied],
254+
() => ({didScreenTransitionEnd, isSafeAreaTopPaddingApplied, isSafeAreaBottomPaddingApplied: includeSafeAreaPaddingBottom}),
255+
[didScreenTransitionEnd, includeSafeAreaPaddingBottom, isSafeAreaTopPaddingApplied],
259256
);
260257

261258
return (
@@ -297,7 +294,14 @@ function ScreenWrapper(
297294
}
298295
{isSmallScreenWidth && shouldShowOfflineIndicator && (
299296
<>
300-
<OfflineIndicator style={offlineIndicatorStyle} />
297+
<OfflineIndicator
298+
style={[offlineIndicatorStyle]}
299+
containerStyles={
300+
includeSafeAreaPaddingBottom
301+
? [styles.offlineIndicatorMobile]
302+
: [styles.offlineIndicatorMobile, {paddingBottom: paddingBottom + styles.offlineIndicatorMobile.paddingBottom}]
303+
}
304+
/>
301305
{/* Since import state is tightly coupled to the offline state, it is safe to display it when showing offline indicator */}
302306
<ImportedStateIndicator />
303307
</>

0 commit comments

Comments
 (0)