1.0.5 • Published 2 years ago

@alexzunik/rn-native-portals-reborn v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

:fire::fire::fire:This project is reborn of the this project:fire::fire::fire:

React Native implementation of ReactDOM portals using a declarative API.

This library makes possible the teleportation of views from a place to another one.


Content

Installation

$ yarn add @alexzunik/rn-native-portals-reborn

for ios

$ npx pod-install

In your code

Somewhere high in your component tree, add a PortalDestination (a portal destination):

import {  PortalDestination } from "@alexzunik/rn-native-portals-reborn";

render() {
	return (
		<PortalDestination name="targetOfTeleportation" />
	);
}

Somewhere else in the tree, add a PortalOrigin (a portal origin):

import { PortalOrigin } from '@alexzunik/rn-native-portals-reborn';

render() {
	return (
		<PortalOrigin destination={ this.state.shouldMove ? 'targetOfTeleportation' : null }>
			<View>
				<Text>Hello world</Text>
			</View>
		</PortalOrigin>
	);
}

When the shouldMove state will change to something truthy, the View and the Text components will be moved inside the PortalDestination component set previously.

If the value of the destination prop is set to null, the View and Text are restituted to their original place.

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago