All Projects → gorhom → React Native Portal

gorhom / React Native Portal

Licence: mit
A simplified portal implementation for ⭕️ React Native & Web ⭕️.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to React Native Portal

Portal Vue
A feature-rich Portal Plugin for Vue 2, for rendering DOM outside of a component, anywhere in your app or the entire document.
Stars: ✭ 3,490 (+3016.07%)
Mutual labels:  portal
Piral
Framework for next generation web apps using microfrontends. 🚀
Stars: ✭ 711 (+534.82%)
Mutual labels:  portal
Vue A11y Dialog
Vue.js component for a11y-dialog
Stars: ✭ 65 (-41.96%)
Mutual labels:  portal
Wedatasphere
WeDataSphere is a financial level one-stop open-source suitcase for big data platforms. Currently the source code of Scriptis and Linkis has already been released to the open-source community. WeDataSphere, Big Data Made Easy!
Stars: ✭ 372 (+232.14%)
Mutual labels:  portal
React Cool Portal
😎 🍒 React hook for Portals, which renders modals, dropdowns, tooltips etc. to <body> or else.
Stars: ✭ 458 (+308.93%)
Mutual labels:  portal
Comcast.github.io
The main Open Source portal for Comcast
Stars: ✭ 36 (-67.86%)
Mutual labels:  portal
Kupiki Hotspot Script
Create automatically a full Wifi Hotspot on Raspberry Pi including a Captive Portal
Stars: ✭ 265 (+136.61%)
Mutual labels:  portal
Nukeviet
NukeViet CMS is multi Content Management System. NukeViet CMS is the 1st open source content management system in Vietnam. NukeViet was awarded the Vietnam Talent 2011, the Ministry of Education and Training Vietnam officially encouraged to use.
Stars: ✭ 113 (+0.89%)
Mutual labels:  portal
React Useportal
🌀 React hook for Portals
Stars: ✭ 698 (+523.21%)
Mutual labels:  portal
Cloud Portal
Self service web portal for different Cloud platforms like Azure, AWS and VMWare vSphere.
Stars: ✭ 60 (-46.43%)
Mutual labels:  portal
Toughradius
Beautiful open source RadiusServer
Stars: ✭ 376 (+235.71%)
Mutual labels:  portal
React Reparenting
The reparenting tools for React
Stars: ✭ 390 (+248.21%)
Mutual labels:  portal
Gisportal
A web-based GIS tool for visualisation and analysis of geospatial data
Stars: ✭ 48 (-57.14%)
Mutual labels:  portal
Ngx Planet
🚀🌍🚀A powerful, reliable, fully-featured and production ready Micro Frontend library for Angular.
Stars: ✭ 361 (+222.32%)
Mutual labels:  portal
Shaders Portal
A showcase of shader effects to replicate portals in different games.
Stars: ✭ 65 (-41.96%)
Mutual labels:  portal
Opensource Portal
Microsoft's monolithic GitHub Management Portal enabling enterprise scale self-service powered by the GitHub API 🏔🧑‍💻🧰
Stars: ✭ 273 (+143.75%)
Mutual labels:  portal
Subnode.org
SubNode: Social Media App
Stars: ✭ 25 (-77.68%)
Mutual labels:  portal
React Relative Portal
React component for place dropdowns outside overflow: hidden; elements
Stars: ✭ 114 (+1.79%)
Mutual labels:  portal
React Native Loading Spinner Overlay
💈 React Native loading spinner overlay
Stars: ✭ 1,369 (+1122.32%)
Mutual labels:  portal
Componette Site
➿ Addons, plugins, components and extensions (@componette ❤️ @nette)
Stars: ✭ 56 (-50%)
Mutual labels:  portal

React Native Portal

Base UI npm npm runs with expo

A simplified portal implementation for ⭕️ React Native ⭕️.

React Native Bottom Sheet


Features

  • Multi portals handling.
  • Multi portal hosts handling.
  • Allow override functionality.
  • Compatible with React Native Web.
  • Compatible with Expo, check out the project Expo Snack.
  • Written in TypeScript.

Installation

yarn add @gorhom/portal

Usage

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Portal, PortalProvider, PortalHost } from '@gorhom/portal';

const BasicScreen = () => {
  return (
    <View style={styles.container}>
      <View style={styles.box}>
        <Text style={styles.text}>
          Text won't be teleported!
          <Portal>
            <Text style={styles.text}>
              Text to be teleported to the root host
            </Text>
          </Portal>
          <Portal hostName="custom_host">
            <Text style={styles.text}>
              Text to be teleported to the custom host
            </Text>
          </Portal>
        </Text>
      </View>

      {/* Custom host */}
      <PortalHost name="custom_host" />
    </View>
  );
};

const styles = StyleSheet.create({
  container: { flex: 1 },
  box: {
    padding: 24,
    backgroundColor: '#333',
  },
  text: {
    alignSelf: 'center',
    textAlign: 'center',
    margin: 24,
    backgroundColor: '#eee',
  },
});

export default () => (
  <PortalProvider>
    <BasicScreen />
    {/* Text will be teleported to here */}
  </PortalProvider>
);

Props

Portal Props

name

Portal's key or name to be used as an identifer.

required: NO | type: string | default: auto generated unique key

hostName

Host's key or name to teleport the portal content to.

required: NO | type: string | default: 'root'

handleOnMount

Override internal mounting functionality, this is useful if you want to trigger any action before mounting the portal content.

type handleOnMount = (mount?: () => void) => void;

required: NO | type: function | default: undefined

handleOnUnmount

Override internal un-mounting functionality, this is useful if you want to trigger any action before un-mounting the portal content.

type handleOnUnmount = (unmount?: () => void) => void;

required: NO | type: function | default: undefined

children

Portal's content.

required: NO | type: ReactNode | ReactNode[] | default: undefined

PortalHost Props

name

Host's key or name to be used as an identifer.

required: YES | type: string

Hooks

usePortal

To access internal functionalities of all portals.

/**
 * @param hostName host name or key.
 */
type usePortal = (hostName: string = 'root') => {
  /**
   * Register a new host.
   */
  registerHost: () => void,
  /**
   * Deregister a host.
   */
  deregisterHost: () => void,
  /**
   * Add portal to the host container.
   * @param name portal name or key
   * @param node portal content
   */
  addPortal: (name: string, node: ReactNode) => void
  /**
   * Update portal content.
   * @param name portal name or key
   * @param node portal content
   */
  updatePortal: (name: string, node: ReactNode) => void
  /**
   * Remove portal from host container.
   * @param name portal name or key
   */
  removePortal: (name: string) => void
}

Built With ❤️

Author

License

MIT

Liked the library? 😇

Buy Me A Coffee


Mo Gorhom

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].