1.0.2 • Published 4 years ago

@burstware/react-native-portal v1.0.2

Weekly downloads
780
License
MIT
Repository
github
Last release
4 years ago

React Native Portal Build Status Coverage

NPM

React Native Portal

Render a component anywhere. Anything inside a <Portal> component will be rendered on an ancestor <Portal.Host> component.

Installation

npm i --save @burstware/react-native-portal

Usage

import React from 'react'
import { View, Text, StyleSheet } from 'react-native'
import Portal from '@burstware/react-native-portal'

function Test (props) {
  return (
    <View style={[StyleSheet.absoluteFill, { alignItems: 'center', backgroundColor: 'blue' }]}>
      <Portal.Host>
        <View style={{ width: '75%', height: '100%' }}>
          <Portal>
            <View style={{ width: '100%', height: '100%', backgroundColor: 'white' }}>
              <Text>This should be on top</Text>
            </View>
          </Portal>
        </View>
      </Portal.Host>
    </View>
  )
}

Documentation

npm start