https://github.com/opium-pro/opium-portals
Portals for Rect Native
https://github.com/opium-pro/opium-portals
Last synced: 3 months ago
JSON representation
Portals for Rect Native
- Host: GitHub
- URL: https://github.com/opium-pro/opium-portals
- Owner: opium-pro
- Created: 2022-08-16T18:40:07.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-16T19:58:26.000Z (almost 3 years ago)
- Last Synced: 2025-02-27T16:35:36.498Z (4 months ago)
- Language: TypeScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# opium-portals
Portals for Rect Native and React Dom## 1. Install the package
```
npm i opium-portals
```## 2. Wrap your app
```jsx
import { PortalsProvider } from 'opium-portals'const App = () =>
Place your app here.
All portals will be placed right after your app.```
## 3. Optionally add a wrapper
```jsx
import { PortalsProvider } from 'opium-portals'// This component will wrap every portal
const Wrapper = ({children}) => childrenconst App = () =>
Place your app here.
All portals will be placed right after your app.```
## 4. Use portal component
```jsx
import { Portal } from 'opium-portals'const MyComponent = () =>
Your code here```
## 5. Or use HOC
```jsx
import { withPortal } from 'opium-portals'const MyComponent = withPortal(() => 'Your code here')
```to call your component inside the portal, use `inPortal` prop
```jsx
```