Skip to content

Conversation

@khushal87
Copy link
Member

No description provided.

@Stream-SDK-Bot
Copy link
Contributor

Stream-SDK-Bot commented Oct 6, 2025

SDK Size

title develop branch diff status
js_bundle_size 289 KB 289 KB 0 B 🟢

import { getReactNativeVersion } from '../../../utils/getReactNativeVersion';
import type { Photo } from '../ImageGallery';

const SafeAreaView = getReactNativeVersion().minor >= 81 ? SafeAreaViewOriginal : RNSafeAreaView;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't check the version. Ideally, we should have this:

Suggested change
const SafeAreaView = getReactNativeVersion().minor >= 81 ? SafeAreaViewOriginal : RNSafeAreaView;
const SafeAreaView = RNSafeAreaView ?? SafeAreaViewOriginal;

Copy link
Member Author

@khushal87 khushal87 Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is that on 0.81 its just deprecated and you get a warning that it will be removed in future versions. The integrators who are above or on 0.81 should not get the warning imo from the SDK atleast(we don't know which version will really remove the API) and the SafeAreaView in that case would still be the default RN's one. Imo we should utilize rn-safe-area-context regardless of the default API availability starting 0.81 so that integrators don't get a warning. Happy to change if you disagree.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then, shall we flip the condition? Use the external one by default, fall back to the native one if missing?
Would that yield a warning too?

Copy link
Member Author

@khushal87 khushal87 Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For <0.81 it won't be a problem(the native one will be used). For >=0.81, we are having external one as the default and the native one if external dep is missing. I think the change in the PR should cover all the cases unless I am missing something.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it covers all cases, but what I don't think we should check against the actual RN version. Instead, let's make our code always use the external one, and fall back to RN.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: if this is causing the deprecation warning to always trigger @khushal87 (for trying to import it from RN) you can always add it as an optional dependency for both Expo and RN CLI as packages. That way, this should not crash when we import it, regardless of us having a fallback.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make our code always use the external one, and fall back to RN.

I have added the following change.

@khushal87 khushal87 merged commit 08bf7f4 into develop Oct 13, 2025
5 of 7 checks passed
@khushal87 khushal87 deleted the fix/react-native-safe-area-view-workaround branch October 13, 2025 09:09
@github-actions github-actions bot mentioned this pull request Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants