react-native-popper icon indicating copy to clipboard operation
react-native-popper copied to clipboard

Add customizable `Modal` component from react-native-screens

Open nandorojo opened this issue 2 years ago • 2 comments

Now that react-native-screens has an overlay view that allows multiple overlays on iOS (and in the future Android), it would be great if this lib exposed a way to pass a custom Modal component. I envision something roughly like this:

const CustomModal = (props) => {
  if (Platform.OS !== 'ios') {
    return <Modal {...props} />
  }

  const { visible, children } = props

  return <OverlayView style={StyleSheet.absoluteFill}>{visible && children}</OverlayView>
}

return <Popover Modal={CustomModal} />

Even better, what if this library had a plugin, like react-native-popper/window, such that all you had to do is this:

import { WindowOverlay } from 'react-native-popper/window'

<Popover Modal={WindowOverlay} />

This way, only users of react-native-popper/window need to install react-native-screens.

nandorojo avatar Sep 14 '21 21:09 nandorojo

Perhaps even better, would be that if you're using react-native-popper/window, then on iOS, it automatically enables that view from react-native-screens (dev dependency) for you!

Everything else would be the same, just re-exports the same things with the custom overlay under the hood.

nandorojo avatar Nov 03 '21 17:11 nandorojo

Love the idea of having a plugin like react-native-popper/window!

axeldelafosse avatar Nov 03 '21 17:11 axeldelafosse