Skip to content

Commit 13a5da8

Browse files
authored
Fix error with Platform.constants doesn't exists on react-native-web (#2639)
* Added check for react native version before usage * Added optional chanining to check
1 parent e12d18b commit 13a5da8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/commons/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const isIOS = Platform.OS === 'ios';
88
const screenAspectRatio = screenWidth < screenHeight ? screenHeight / screenWidth : screenWidth / screenHeight;
99
const isTablet = (Platform as PlatformIOSStatic).isPad || (screenAspectRatio < 1.6 && Math.max(screenWidth, screenHeight) >= 900);
1010
const isAndroidRTL = isAndroid && isRTL;
11-
const isRN73 = () => Platform.constants.reactNativeVersion?.minor >= 73;
11+
const isRN73 = () => !!Platform?.constants?.reactNativeVersion && Platform.constants.reactNativeVersion?.minor >= 73;
1212

1313
export default {
1414
screenWidth,

0 commit comments

Comments
 (0)