react-native-1app
Version:
62 lines (53 loc) • 1.14 kB
JavaScript
import React from 'react';
import { StyleSheet,View} from "react-native";
import Modal from 'react-native-modalbox';
import Nav from './Nav';
let _ref=null;
export default class ModalNav extends React.Component {
constructor(props) {
super(props);
_ref=this;
this.state = {
prop:{},
Component:View,
propsModal:{}
};
}
openModal=(Component=View,prop={},propsModal={})=>{
this.setState({propsModal,Component,prop},()=>this.refs.modal1.open())
}
closeModal=()=>{
this.refs.modal1.close()
}
render() {
const{propsModal,Component,prop}=this.state;
return (
<Modal
style={styles.tela}
ref={"modal1"}
{...propsModal}
>
<Nav InitComponent={Component} propsInit={prop} screenProps={this.props.screenProps}/>
</Modal>
);
}
}
var styles = StyleSheet.create(
{
"tela": {
"flex": 1,
"alignSelf": "stretch",
},
}
);
export function openModal(...args) {
if (_ref) {
_ref.openModal(...args);
}
}
export function closeModal(...args) {
if (_ref) {
_ref.closeModal(...args);
}
}
;