SteffeyDev / react-native-popover-view

A well-tested, adaptable, lightweight <Popover> component for react-native
MIT License
613 stars 92 forks source link

Remove dependency on `react-native-safe-area-view`, replace with instructions on how to use `react-native-safe-area-context` with `displayArea` prop instead #93

Closed hughman77 closed 3 years ago

hughman77 commented 3 years ago

The react-native-safe-area-view is deprecated (https://github.com/react-navigation/react-native-safe-area-view) and the usage produces deprecation warnings in Expo projects: The global "__expo" and "Expo" objects will be removed in SDK 41. Learn more about how to fix this warning: https://expo.fyi/deprecated-globals.

SteffeyDev commented 3 years ago

I agree, I've been needing to do this for a while. It's on my radar. Unfortunately it is not as simple as it sounds, I remember attempting the migration before and running into unexpected difficulties. However, I'm sure things have changed since then, so it is worth another go.

SteffeyDev commented 3 years ago

Right, so biggest issue is that react-native-safe-area-context requires native modules, and this is a JS only library that does not have any native dependencies.

I'll probably just ditch the dependency, and add a displayAreaInsets prop that can take the insets from useSafeAreaInsets, so that users can opt-in to having the popover respect the safe insets.

SteffeyDev commented 3 years ago

Actually, it looks like react-native-safe-area-context already has a useSafeAreaFrame, which can probably be passed directly into the displayArea prop. That's perfect.

This will require a new major version, as it is technically a breaking change, but should be well worth it, making this library have 0 dependencies and less calculation work.

SteffeyDev commented 3 years ago

Completed with v4.0.0