-
Notifications
You must be signed in to change notification settings - Fork 1
/
FullScreenPortal.tsx
36 lines (34 loc) · 1.16 KB
/
FullScreenPortal.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React, { Component as ReactComponent, Fragment } from 'react';
import { View, StyleSheet } from 'react-native';
import { Observer } from 'mobx-react';
import { fromStream } from 'mobx-utils';
import { Navigation } from './Navigation';
export class FullScreenPortal extends ReactComponent {
fullScreenStack = fromStream(Navigation.instance.fullScreenDelegate.fullSceenStack$);
render() {
return (
<View style={StyleSheet.absoluteFill}>
<Fragment>{this.props.children}</Fragment>
<Observer>
{() => {
if (this.fullScreenStack.current) {
return (
<Fragment>
{this.fullScreenStack.current &&
this.fullScreenStack.current.map(({ Component, name, isAuthorized }) => (
<Component isAuthorized={isAuthorized} key={name} />
))}
</Fragment>
);
}
/**
* @todo Improve typing of <Observer /> to accept null JSXElement.
* Expected: `return null;`
*/
return <Fragment />;
}}
</Observer>
</View>
);
}
}