Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a native looking modal view segue with react-native?

Tags:

react-native

Is there an way to perform a modal segue, animating the view and navbar up from the bottom, covering the existing navbar, view and tabbar, etc. ?

There is a similar example in UIExplorer where the view 'Navigator' uses 'configureScene' to float a view (but not the navbar) from bottom via Navigator.SceneConfigs.FloatFromBottom, etc. Native app modal segues are supposed to animate the new navbar and view up from the bottom. Note: A good example of this is the health app, click on 'medical ID' tab, then tap on 'Edit' button in navbar, and notice how its navbar and view animates and covers the existing navbar, tabbar and view.

I can see a modal segue in the facebook groups app, which is react-native from my understanding. Clicking on the 'Groups' tab, the click on the 'create' navbar button.

Does anyone know how to implement a native modal segues in react-native?

like image 849
McG Avatar asked Mar 31 '15 22:03

McG


People also ask

How do I create a modal view in react native?

In your components folder, create a file called Modal. tsx and add the following code: import React from "react"; import { StyleSheet, View, Text, Button } from "react-native"; import RNModal from "react-native-modal"; type ModalProps = { isVisible: boolean; children: React.

Does react native modal work on Web?

Modal is now supported in react native web.


1 Answers

enter image description here

this.props.navigator.push({
    title: 'Pick Date',
    sceneConfig: Navigator.SceneConfigs.FloatFromBottom,
    component: DatePickerView,
    navigationBar: <NavigationBar
        title="Initial View"/>,
    passProps: {handleSelectedDate: this.handleSelectedDate}
})

Link to source is here: https://github.com/aaronksaunders/React-Modal-Nav-Example

like image 90
Aaron Saunders Avatar answered Oct 11 '22 14:10

Aaron Saunders