Skip to content

fix: 🐛 status bar manager issue with new rn fabric #3329

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

Closed
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
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
23 changes: 5 additions & 18 deletions src/commons/Constants.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
Platform,
Dimensions,
NativeModules,
I18nManager,
AccessibilityInfo,
AccessibilityChangeEvent
} from 'react-native';
import {Platform, Dimensions, I18nManager, AccessibilityInfo, AccessibilityChangeEvent, StatusBar} from 'react-native';

export enum orientations {
PORTRAIT = 'portrait',
Expand Down Expand Up @@ -34,17 +27,11 @@ let breakpoints: Breakpoint[];
let defaultMargin = 0;

const isSubWindow = windowWidth < screenWidth;
//@ts-ignore
isTablet = Platform.isPad || (getAspectRatio() < 1.6 && Math.max(screenWidth, screenHeight) >= 900);
isTablet =
(Platform.OS === 'ios' && Platform.isPad) || (getAspectRatio() < 1.6 && Math.max(screenWidth, screenHeight) >= 900);

function setStatusBarHeight() {
const {StatusBarManager} = NativeModules;
statusBarHeight = StatusBarManager?.HEIGHT || 0; // So there will be a value for any case

if (isIOS) {
// override guesstimate height with the actual height from StatusBarManager
StatusBarManager.getHeight((data:{height:number}) => (statusBarHeight = data.height));
}
statusBarHeight = StatusBar.currentHeight || 0; // So there will be a value for any case
}

function getAspectRatio() {
Expand Down Expand Up @@ -125,7 +112,7 @@ const constants = {
return screenHeight <= 600;
},
get isWideScreen() {
return isTablet && !isSubWindow || this.isLandscape;
return (isTablet && !isSubWindow) || this.isLandscape;
},
get screenAspectRatio() {
return getAspectRatio();
Expand Down
2 changes: 1 addition & 1 deletion src/incubator/Calendar/__tests__/DateUtils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ describe('Calendar/DateUtils', () => {
});

it('should return true for same dates using timestamps', () => {
expect(DateUtils.isSameDay(1673442316000, 1673463916000)).toBe(true);
expect(DateUtils.isSameDay(1673442316000, 1673442316000)).toBe(true);
});

it('should return false for different dates using Date objects', () => {
Expand Down