1.0.6 • Published 4 years ago

react-navigation-modal v1.0.6

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

react-navigation-modal

This is a modal component to be used together with react-navigation

npm.io

how to use

Create a component for your modal

import React from 'react';
import { Text } from 'react-native';
import Modal from 'react-navigation-modal'

export const DefaultModal = () => {
  return (
    <Modal>
      <Text>Hello</Text>
    </Modal>
  );
};

Add your modals to your navigation just like any other screen

  <Stack.Navigator headerMode="screen" mode="modal">
        <Stack.Screen name="Home" component={HomeScreen} />
        <Stack.Screen name="Default" component={DefaultModal} />
        <Stack.Screen name="Form" component={FormModal} />
        <Stack.Screen name="Custom" component={CustomModal} />
    </Stack.Navigator>

To avoid bugs it is recommended to configure the headerMode and mode like the example

For open your modal just:

navigation.navigate('Default')

More examples in https://github.com/airtonazevedo/react-navigation-modal/tree/master/example

Props

PropsTypeDefault valueDescription
cancelablebooleantrueif the modal is canceled by pressing out
opacitynumber (min 0 - max 1)0.7opacity of the background
styleviewStyle{top: '15%', padding: 20, borderRadius: 10, backgroundColor: '#FFFFFF'}modal content style

All view props

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago