Skip to content

Commit dcac990

Browse files
committed
fix: avoid check using version
1 parent fad96eb commit dcac990

File tree

6 files changed

+5
-16
lines changed

6 files changed

+5
-16
lines changed

package/src/components/ImageGallery/components/ImageGalleryFooter.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ import {
3030
} from '../../../native';
3131

3232
import { FileTypes } from '../../../types/types';
33-
import { getReactNativeVersion } from '../../../utils/getReactNativeVersion';
3433
import type { Photo } from '../ImageGallery';
3534

36-
const SafeAreaView = getReactNativeVersion().minor >= 81 ? SafeAreaViewOriginal : RNSafeAreaView;
35+
const SafeAreaView = SafeAreaViewOriginal ?? RNSafeAreaView;
3736

3837
const ReanimatedSafeAreaView = Animated.createAnimatedComponent
3938
? Animated.createAnimatedComponent(SafeAreaView)

package/src/components/ImageGallery/components/ImageGalleryHeader.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ import { useTheme } from '../../../contexts/themeContext/ThemeContext';
2323
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
2424
import { Close } from '../../../icons';
2525

26-
import { getReactNativeVersion } from '../../../utils/getReactNativeVersion';
2726
import { getDateString } from '../../../utils/i18n/getDateString';
2827
import type { Photo } from '../ImageGallery';
2928

3029
// This is a workaround to support SafeAreaView on React Native 0.81.0+
31-
const SafeAreaView = getReactNativeVersion().minor >= 81 ? SafeAreaViewOriginal : RNSafeAreaView;
30+
const SafeAreaView = SafeAreaViewOriginal ?? RNSafeAreaView;
3231

3332
const ReanimatedSafeAreaView = Animated.createAnimatedComponent
3433
? Animated.createAnimatedComponent(SafeAreaView)

package/src/components/MessageInput/MessageInput.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,12 @@ import {
6767
isImageMediaLibraryAvailable,
6868
NativeHandlers,
6969
} from '../../native';
70-
import { getReactNativeVersion } from '../../utils/getReactNativeVersion';
7170
import { AIStates, useAIState } from '../AITypingIndicatorView';
7271
import { AutoCompleteInput } from '../AutoCompleteInput/AutoCompleteInput';
7372
import { CreatePoll } from '../Poll/CreatePollContent';
7473

7574
// This is a workaround to support SafeAreaView on React Native 0.81.0+
76-
const SafeAreaView = getReactNativeVersion().minor >= 81 ? SafeAreaViewOriginal : RNSafeAreaView;
75+
const SafeAreaView = SafeAreaViewOriginal ?? RNSafeAreaView;
7776

7877
const styles = StyleSheet.create({
7978
attachmentSeparator: {

package/src/components/Poll/components/PollButtons.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ import { PollAllOptions } from './PollOption';
1313
import { PollResults } from './PollResults';
1414

1515
import { useChatContext, usePollContext, useTheme, useTranslationContext } from '../../../contexts';
16-
import { getReactNativeVersion } from '../../../utils/getReactNativeVersion';
1716
import { usePollState } from '../hooks/usePollState';
1817

1918
// This is a workaround to support SafeAreaView on React Native 0.81.0+
2019
const SafeAreaViewWrapper = ({ children, style }: PropsWithChildren<{ style: ViewStyle }>) => {
21-
if (getReactNativeVersion().minor >= 81) {
20+
if (SafeAreaViewOriginal) {
2221
return (
2322
<SafeAreaProvider>
2423
<SafeAreaViewOriginal edges={['bottom', 'top']} style={style}>

package/src/components/Poll/components/PollResults/PollResultItem.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@ import {
2525
useTranslationContext,
2626
} from '../../../../contexts';
2727

28-
import { getReactNativeVersion } from '../../../../utils/getReactNativeVersion';
2928
import { usePollState } from '../../hooks/usePollState';
3029
import { GenericPollButton } from '../Button';
3130
import { PollModalHeader } from '../PollModalHeader';
3231

3332
// This is a workaround to support SafeAreaView on React Native 0.81.0+
3433
const SafeAreaViewWrapper = ({ children, style }: PropsWithChildren<{ style: ViewStyle }>) => {
35-
if (getReactNativeVersion().minor >= 81) {
34+
if (SafeAreaViewOriginal) {
3635
return (
3736
<SafeAreaProvider>
3837
<SafeAreaViewOriginal edges={['bottom', 'top']} style={style}>

package/src/utils/getReactNativeVersion.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)