1 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2 |
|
3 | import * as React from 'react';
|
4 | import { Platform, StyleSheet, View } from 'react-native';
|
5 | import { Screen, screensEnabled
|
6 | , shouldUseActivityState } from 'react-native-screens';
|
7 | const FAR_FAR_AWAY = 30000;
|
8 |
|
9 | export default class ResourceSavingScene extends React.Component {
|
10 | render() {
|
11 |
|
12 | if ((screensEnabled === null || screensEnabled === void 0 ? void 0 : screensEnabled()) && this.props.enabled && Platform.OS !== 'web') {
|
13 | const {
|
14 | isVisible,
|
15 | ...rest
|
16 | } = this.props;
|
17 |
|
18 | if (shouldUseActivityState) {
|
19 | return (
|
20 |
|
21 |
|
22 | React.createElement(Screen, _extends({
|
23 | activityState: isVisible ? 2 : 0
|
24 | }, rest))
|
25 | );
|
26 | } else {
|
27 | return (
|
28 |
|
29 |
|
30 | React.createElement(Screen, _extends({
|
31 | active: isVisible ? 1 : 0
|
32 | }, rest))
|
33 | );
|
34 | }
|
35 | }
|
36 |
|
37 | const {
|
38 | isVisible,
|
39 | children,
|
40 | style,
|
41 | ...rest
|
42 | } = this.props;
|
43 | return React.createElement(View, _extends({
|
44 | style: [styles.container, Platform.OS === 'web' ? {
|
45 | display: isVisible ? 'flex' : 'none'
|
46 | } : null, style],
|
47 | collapsable: false,
|
48 | removeClippedSubviews:
|
49 |
|
50 | Platform.OS === 'ios' ? !isVisible : true,
|
51 | pointerEvents: isVisible ? 'auto' : 'none'
|
52 | }, rest), React.createElement(View, {
|
53 | style: isVisible ? styles.attached : styles.detached
|
54 | }, children));
|
55 | }
|
56 |
|
57 | }
|
58 | const styles = StyleSheet.create({
|
59 | container: {
|
60 | flex: 1,
|
61 | overflow: 'hidden'
|
62 | },
|
63 | attached: {
|
64 | flex: 1
|
65 | },
|
66 | detached: {
|
67 | flex: 1,
|
68 | top: FAR_FAR_AWAY
|
69 | }
|
70 | });
|
71 |
|
\ | No newline at end of file |