@vxrn/safe-area 2.0.0-beta.45.1 → 2.0.0-beta.50.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/cjs/InitialWindow.native.cjs +6 -5
- package/dist/cjs/InitialWindow.native.js +6 -5
- package/dist/cjs/InitialWindow.native.js.map +1 -1
- package/dist/cjs/NativeSafeAreaProvider.native.cjs +12 -105
- package/dist/cjs/NativeSafeAreaProvider.native.js +12 -105
- package/dist/cjs/NativeSafeAreaProvider.native.js.map +1 -1
- package/dist/cjs/SafeAreaView.native.cjs +26 -54
- package/dist/cjs/SafeAreaView.native.js +26 -54
- package/dist/cjs/SafeAreaView.native.js.map +1 -1
- package/dist/esm/InitialWindow.native.js +4 -2
- package/dist/esm/InitialWindow.native.js.map +1 -1
- package/dist/esm/NativeSafeAreaProvider.native.js +9 -102
- package/dist/esm/NativeSafeAreaProvider.native.js.map +1 -1
- package/dist/esm/SafeAreaView.native.js +24 -52
- package/dist/esm/SafeAreaView.native.js.map +1 -1
- package/package.json +4 -1
- package/src/InitialWindow.native.ts +9 -0
- package/src/NativeSafeAreaProvider.native.tsx +41 -0
- package/src/SafeAreaView.native.tsx +39 -0
- package/types/InitialWindow.native.d.ts +7 -0
- package/types/InitialWindow.native.d.ts.map +1 -0
- package/types/NativeSafeAreaProvider.native.d.ts +3 -0
- package/types/NativeSafeAreaProvider.native.d.ts.map +1 -0
- package/types/SafeAreaView.native.d.ts +4 -0
- package/types/SafeAreaView.native.d.ts.map +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
$ tamagui-build
|
|
2
|
-
built @vxrn/safe-area in
|
|
2
|
+
built @vxrn/safe-area in 321 ms
|
|
@@ -20,11 +20,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
20
|
return to;
|
|
21
21
|
};
|
|
22
22
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
-
var
|
|
24
|
-
__export(
|
|
23
|
+
var InitialWindow_native_exports = {};
|
|
24
|
+
__export(InitialWindow_native_exports, {
|
|
25
25
|
initialWindowMetrics: () => initialWindowMetrics,
|
|
26
26
|
initialWindowSafeAreaInsets: () => initialWindowSafeAreaInsets
|
|
27
27
|
});
|
|
28
|
-
module.exports = __toCommonJS(
|
|
29
|
-
var
|
|
30
|
-
var
|
|
28
|
+
module.exports = __toCommonJS(InitialWindow_native_exports);
|
|
29
|
+
var import_safe_area = require("@vxrn/native/safe-area");
|
|
30
|
+
var initialWindowMetrics = (0, import_safe_area.getInitialWindowMetrics)();
|
|
31
|
+
var initialWindowSafeAreaInsets = initialWindowMetrics === null || initialWindowMetrics === void 0 ? void 0 : initialWindowMetrics.insets;
|
|
@@ -20,13 +20,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
20
|
return to;
|
|
21
21
|
};
|
|
22
22
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
-
var
|
|
24
|
-
__export(
|
|
23
|
+
var InitialWindow_native_exports = {};
|
|
24
|
+
__export(InitialWindow_native_exports, {
|
|
25
25
|
initialWindowMetrics: () => initialWindowMetrics,
|
|
26
26
|
initialWindowSafeAreaInsets: () => initialWindowSafeAreaInsets
|
|
27
27
|
});
|
|
28
|
-
module.exports = __toCommonJS(
|
|
29
|
-
var
|
|
30
|
-
var
|
|
28
|
+
module.exports = __toCommonJS(InitialWindow_native_exports);
|
|
29
|
+
var import_safe_area = require("@vxrn/native/safe-area");
|
|
30
|
+
var initialWindowMetrics = (0, import_safe_area.getInitialWindowMetrics)();
|
|
31
|
+
var initialWindowSafeAreaInsets = initialWindowMetrics === null || initialWindowMetrics === void 0 ? void 0 : initialWindowMetrics.insets;
|
|
31
32
|
|
|
32
33
|
//# sourceMappingURL=InitialWindow.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitialWindow.native.js","names":[],"sources":["cjs/InitialWindow.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar
|
|
1
|
+
{"version":3,"file":"InitialWindow.native.js","names":[],"sources":["cjs/InitialWindow.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar InitialWindow_native_exports = {};\n__export(InitialWindow_native_exports, {\n initialWindowMetrics: () => initialWindowMetrics,\n initialWindowSafeAreaInsets: () => initialWindowSafeAreaInsets\n});\nmodule.exports = __toCommonJS(InitialWindow_native_exports);\nvar import_safe_area = require(\"@vxrn/native/safe-area\");\nvar initialWindowMetrics = (0, import_safe_area.getInitialWindowMetrics)();\nvar initialWindowSafeAreaInsets = initialWindowMetrics === null || initialWindowMetrics === void 0 ? void 0 : initialWindowMetrics.insets;\n//# sourceMappingURL=InitialWindow.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,+BAA+B,CAAC;AACpC,SAAS,8BAA8B;CACrC,4BAA4B;CAC5B,mCAAmC;AACrC,CAAC;AACD,OAAO,UAAU,aAAa,4BAA4B;AAC1D,IAAI,mBAAmB,QAAQ,wBAAwB;AACvD,IAAI,wBAAwB,GAAG,iBAAiB,wBAAuB,CAAE;AACzE,IAAI,8BAA8B,yBAAyB,QAAQ,yBAAyB,KAAK,IAAI,KAAK,IAAI,qBAAqB"}
|
|
@@ -26,116 +26,23 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
enumerable: true
|
|
27
27
|
}) : target, mod));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
module.exports = __toCommonJS(
|
|
29
|
+
var NativeSafeAreaProvider_native_exports = {};
|
|
30
|
+
__export(NativeSafeAreaProvider_native_exports, { NativeSafeAreaProvider: () => NativeSafeAreaProvider });
|
|
31
|
+
module.exports = __toCommonJS(NativeSafeAreaProvider_native_exports);
|
|
32
32
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
33
|
var React = __toESM(require("react"), 1);
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
Transition: "transitionEnd",
|
|
37
|
-
MozTransition: "transitionend",
|
|
38
|
-
MSTransition: "msTransitionEnd",
|
|
39
|
-
OTransition: "oTransitionEnd"
|
|
40
|
-
};
|
|
34
|
+
var import_react_native = require("react-native");
|
|
35
|
+
var import_safe_area = require("@vxrn/native/safe-area");
|
|
41
36
|
function NativeSafeAreaProvider(param) {
|
|
42
37
|
var { children, style, onInsetsChange } = param;
|
|
43
|
-
React.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
var element = createContextElement();
|
|
48
|
-
document.body.appendChild(element);
|
|
49
|
-
var onEnd = function() {
|
|
50
|
-
var { paddingTop, paddingBottom, paddingLeft, paddingRight } = window.getComputedStyle(element);
|
|
51
|
-
var insets = {
|
|
52
|
-
top: paddingTop ? Number.parseInt(paddingTop, 10) : 0,
|
|
53
|
-
bottom: paddingBottom ? Number.parseInt(paddingBottom, 10) : 0,
|
|
54
|
-
left: paddingLeft ? Number.parseInt(paddingLeft, 10) : 0,
|
|
55
|
-
right: paddingRight ? Number.parseInt(paddingRight, 10) : 0
|
|
56
|
-
};
|
|
57
|
-
var frame = {
|
|
58
|
-
x: 0,
|
|
59
|
-
y: 0,
|
|
60
|
-
width: document.documentElement.offsetWidth,
|
|
61
|
-
height: document.documentElement.offsetHeight
|
|
62
|
-
};
|
|
63
|
-
onInsetsChange({ nativeEvent: {
|
|
64
|
-
insets,
|
|
65
|
-
frame
|
|
66
|
-
} });
|
|
67
|
-
};
|
|
68
|
-
element.addEventListener(getSupportedTransitionEvent(), onEnd);
|
|
69
|
-
onEnd();
|
|
70
|
-
return function() {
|
|
71
|
-
document.body.removeChild(element);
|
|
72
|
-
element.removeEventListener(getSupportedTransitionEvent(), onEnd);
|
|
73
|
-
};
|
|
38
|
+
var handleInsetsChange = React.useCallback(function(param2) {
|
|
39
|
+
var { nativeEvent } = param2;
|
|
40
|
+
onInsetsChange({ nativeEvent: (0, import_safe_area.providerEventToMetrics)(nativeEvent) });
|
|
74
41
|
}, [onInsetsChange]);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var flattenedStyle = styleValues.reduce(function(result, value) {
|
|
79
|
-
return value && typeof value === "object" ? Object.assign(result, value) : result;
|
|
80
|
-
}, {});
|
|
81
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
82
|
-
style: flattenedStyle,
|
|
83
|
-
children
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
87
|
-
style: { display: "contents" },
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_safe_area.NativeSafeAreaProvider, {
|
|
43
|
+
style: [styles.fill, style],
|
|
44
|
+
onNativeInsetsChange: handleInsetsChange,
|
|
88
45
|
children
|
|
89
46
|
});
|
|
90
47
|
}
|
|
91
|
-
var
|
|
92
|
-
function getSupportedTransitionEvent() {
|
|
93
|
-
if (_supportedTransitionEvent != null) {
|
|
94
|
-
return _supportedTransitionEvent;
|
|
95
|
-
}
|
|
96
|
-
var element = document.createElement("invalidtype");
|
|
97
|
-
_supportedTransitionEvent = CSSTransitions.Transition;
|
|
98
|
-
for (var key in CSSTransitions) {
|
|
99
|
-
if (element.style[key] !== void 0) {
|
|
100
|
-
_supportedTransitionEvent = CSSTransitions[key];
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return _supportedTransitionEvent;
|
|
105
|
-
}
|
|
106
|
-
var _supportedEnv = null;
|
|
107
|
-
function getSupportedEnv() {
|
|
108
|
-
if (_supportedEnv !== null) {
|
|
109
|
-
return _supportedEnv;
|
|
110
|
-
}
|
|
111
|
-
var { CSS } = window;
|
|
112
|
-
if (CSS && CSS.supports && CSS.supports("top: constant(safe-area-inset-top)")) {
|
|
113
|
-
_supportedEnv = "constant";
|
|
114
|
-
} else {
|
|
115
|
-
_supportedEnv = "env";
|
|
116
|
-
}
|
|
117
|
-
return _supportedEnv;
|
|
118
|
-
}
|
|
119
|
-
function getInset(side) {
|
|
120
|
-
return `${getSupportedEnv()}(safe-area-inset-${side})`;
|
|
121
|
-
}
|
|
122
|
-
function createContextElement() {
|
|
123
|
-
var element = document.createElement("div");
|
|
124
|
-
var { style } = element;
|
|
125
|
-
style.position = "fixed";
|
|
126
|
-
style.left = "0";
|
|
127
|
-
style.top = "0";
|
|
128
|
-
style.width = "0";
|
|
129
|
-
style.height = "0";
|
|
130
|
-
style.zIndex = "-1";
|
|
131
|
-
style.overflow = "hidden";
|
|
132
|
-
style.visibility = "hidden";
|
|
133
|
-
style.transitionDuration = "0.05s";
|
|
134
|
-
style.transitionProperty = "padding";
|
|
135
|
-
style.transitionDelay = "0s";
|
|
136
|
-
style.paddingTop = getInset("top");
|
|
137
|
-
style.paddingBottom = getInset("bottom");
|
|
138
|
-
style.paddingLeft = getInset("left");
|
|
139
|
-
style.paddingRight = getInset("right");
|
|
140
|
-
return element;
|
|
141
|
-
}
|
|
48
|
+
var styles = import_react_native.StyleSheet.create({ fill: { flex: 1 } });
|
|
@@ -26,118 +26,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
enumerable: true
|
|
27
27
|
}) : target, mod));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
module.exports = __toCommonJS(
|
|
29
|
+
var NativeSafeAreaProvider_native_exports = {};
|
|
30
|
+
__export(NativeSafeAreaProvider_native_exports, { NativeSafeAreaProvider: () => NativeSafeAreaProvider });
|
|
31
|
+
module.exports = __toCommonJS(NativeSafeAreaProvider_native_exports);
|
|
32
32
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
33
|
var React = __toESM(require("react"), 1);
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
Transition: "transitionEnd",
|
|
37
|
-
MozTransition: "transitionend",
|
|
38
|
-
MSTransition: "msTransitionEnd",
|
|
39
|
-
OTransition: "oTransitionEnd"
|
|
40
|
-
};
|
|
34
|
+
var import_react_native = require("react-native");
|
|
35
|
+
var import_safe_area = require("@vxrn/native/safe-area");
|
|
41
36
|
function NativeSafeAreaProvider(param) {
|
|
42
37
|
var { children, style, onInsetsChange } = param;
|
|
43
|
-
React.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
var element = createContextElement();
|
|
48
|
-
document.body.appendChild(element);
|
|
49
|
-
var onEnd = function() {
|
|
50
|
-
var { paddingTop, paddingBottom, paddingLeft, paddingRight } = window.getComputedStyle(element);
|
|
51
|
-
var insets = {
|
|
52
|
-
top: paddingTop ? Number.parseInt(paddingTop, 10) : 0,
|
|
53
|
-
bottom: paddingBottom ? Number.parseInt(paddingBottom, 10) : 0,
|
|
54
|
-
left: paddingLeft ? Number.parseInt(paddingLeft, 10) : 0,
|
|
55
|
-
right: paddingRight ? Number.parseInt(paddingRight, 10) : 0
|
|
56
|
-
};
|
|
57
|
-
var frame = {
|
|
58
|
-
x: 0,
|
|
59
|
-
y: 0,
|
|
60
|
-
width: document.documentElement.offsetWidth,
|
|
61
|
-
height: document.documentElement.offsetHeight
|
|
62
|
-
};
|
|
63
|
-
onInsetsChange({ nativeEvent: {
|
|
64
|
-
insets,
|
|
65
|
-
frame
|
|
66
|
-
} });
|
|
67
|
-
};
|
|
68
|
-
element.addEventListener(getSupportedTransitionEvent(), onEnd);
|
|
69
|
-
onEnd();
|
|
70
|
-
return function() {
|
|
71
|
-
document.body.removeChild(element);
|
|
72
|
-
element.removeEventListener(getSupportedTransitionEvent(), onEnd);
|
|
73
|
-
};
|
|
38
|
+
var handleInsetsChange = React.useCallback(function(param2) {
|
|
39
|
+
var { nativeEvent } = param2;
|
|
40
|
+
onInsetsChange({ nativeEvent: (0, import_safe_area.providerEventToMetrics)(nativeEvent) });
|
|
74
41
|
}, [onInsetsChange]);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var flattenedStyle = styleValues.reduce(function(result, value) {
|
|
79
|
-
return value && typeof value === "object" ? Object.assign(result, value) : result;
|
|
80
|
-
}, {});
|
|
81
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
82
|
-
style: flattenedStyle,
|
|
83
|
-
children
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
87
|
-
style: { display: "contents" },
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_safe_area.NativeSafeAreaProvider, {
|
|
43
|
+
style: [styles.fill, style],
|
|
44
|
+
onNativeInsetsChange: handleInsetsChange,
|
|
88
45
|
children
|
|
89
46
|
});
|
|
90
47
|
}
|
|
91
|
-
var
|
|
92
|
-
function getSupportedTransitionEvent() {
|
|
93
|
-
if (_supportedTransitionEvent != null) {
|
|
94
|
-
return _supportedTransitionEvent;
|
|
95
|
-
}
|
|
96
|
-
var element = document.createElement("invalidtype");
|
|
97
|
-
_supportedTransitionEvent = CSSTransitions.Transition;
|
|
98
|
-
for (var key in CSSTransitions) {
|
|
99
|
-
if (element.style[key] !== void 0) {
|
|
100
|
-
_supportedTransitionEvent = CSSTransitions[key];
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return _supportedTransitionEvent;
|
|
105
|
-
}
|
|
106
|
-
var _supportedEnv = null;
|
|
107
|
-
function getSupportedEnv() {
|
|
108
|
-
if (_supportedEnv !== null) {
|
|
109
|
-
return _supportedEnv;
|
|
110
|
-
}
|
|
111
|
-
var { CSS } = window;
|
|
112
|
-
if (CSS && CSS.supports && CSS.supports("top: constant(safe-area-inset-top)")) {
|
|
113
|
-
_supportedEnv = "constant";
|
|
114
|
-
} else {
|
|
115
|
-
_supportedEnv = "env";
|
|
116
|
-
}
|
|
117
|
-
return _supportedEnv;
|
|
118
|
-
}
|
|
119
|
-
function getInset(side) {
|
|
120
|
-
return `${getSupportedEnv()}(safe-area-inset-${side})`;
|
|
121
|
-
}
|
|
122
|
-
function createContextElement() {
|
|
123
|
-
var element = document.createElement("div");
|
|
124
|
-
var { style } = element;
|
|
125
|
-
style.position = "fixed";
|
|
126
|
-
style.left = "0";
|
|
127
|
-
style.top = "0";
|
|
128
|
-
style.width = "0";
|
|
129
|
-
style.height = "0";
|
|
130
|
-
style.zIndex = "-1";
|
|
131
|
-
style.overflow = "hidden";
|
|
132
|
-
style.visibility = "hidden";
|
|
133
|
-
style.transitionDuration = "0.05s";
|
|
134
|
-
style.transitionProperty = "padding";
|
|
135
|
-
style.transitionDelay = "0s";
|
|
136
|
-
style.paddingTop = getInset("top");
|
|
137
|
-
style.paddingBottom = getInset("bottom");
|
|
138
|
-
style.paddingLeft = getInset("left");
|
|
139
|
-
style.paddingRight = getInset("right");
|
|
140
|
-
return element;
|
|
141
|
-
}
|
|
48
|
+
var styles = import_react_native.StyleSheet.create({ fill: { flex: 1 } });
|
|
142
49
|
|
|
143
50
|
//# sourceMappingURL=NativeSafeAreaProvider.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeSafeAreaProvider.native.js","names":[],"sources":["cjs/NativeSafeAreaProvider.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar
|
|
1
|
+
{"version":3,"file":"NativeSafeAreaProvider.native.js","names":[],"sources":["cjs/NativeSafeAreaProvider.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar NativeSafeAreaProvider_native_exports = {};\n__export(NativeSafeAreaProvider_native_exports, {\n NativeSafeAreaProvider: () => NativeSafeAreaProvider\n});\nmodule.exports = __toCommonJS(NativeSafeAreaProvider_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_react_native = require(\"react-native\");\nvar import_safe_area = require(\"@vxrn/native/safe-area\");\nfunction NativeSafeAreaProvider(param) {\n var { children, style, onInsetsChange } = param;\n var handleInsetsChange = React.useCallback(function(param2) {\n var { nativeEvent } = param2;\n onInsetsChange({\n nativeEvent: (0, import_safe_area.providerEventToMetrics)(nativeEvent)\n });\n }, [\n onInsetsChange\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_safe_area.NativeSafeAreaProvider, {\n style: [\n styles.fill,\n style\n ],\n onNativeInsetsChange: handleInsetsChange,\n children\n });\n}\nvar styles = import_react_native.StyleSheet.create({\n fill: {\n flex: 1\n }\n});\n//# sourceMappingURL=NativeSafeAreaProvider.native.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,wCAAwC,CAAC;AAC7C,SAAS,uCAAuC,EAC9C,8BAA8B,uBAChC,CAAC;AACD,OAAO,UAAU,aAAa,qCAAqC;AACnE,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,QAAQ,QAAQ,QAAQ,OAAO,GAAG,CAAC;AACvC,IAAI,sBAAsB,QAAQ,cAAc;AAChD,IAAI,mBAAmB,QAAQ,wBAAwB;AACvD,SAAS,uBAAuB,OAAO;CACrC,IAAI,EAAE,UAAU,OAAO,mBAAmB;CAC1C,IAAI,qBAAqB,MAAM,YAAY,SAAS,QAAQ;EAC1D,IAAI,EAAE,gBAAgB;EACtB,eAAe,EACb,cAAc,GAAG,iBAAiB,uBAAsB,CAAE,WAAW,EACvE,CAAC;CACH,GAAG,CACD,cACF,CAAC;CACD,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,iBAAiB,wBAAwB;EAC1F,OAAO,CACL,OAAO,MACP,KACF;EACA,sBAAsB;EACtB;CACF,CAAC;AACH;AACA,IAAI,SAAS,oBAAoB,WAAW,OAAO,EACjD,MAAM,EACJ,MAAM,EACR,EACF,CAAC"}
|
|
@@ -26,72 +26,44 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
enumerable: true
|
|
27
27
|
}) : target, mod));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
module.exports = __toCommonJS(
|
|
29
|
+
var SafeAreaView_native_exports = {};
|
|
30
|
+
__export(SafeAreaView_native_exports, { SafeAreaView: () => SafeAreaView });
|
|
31
|
+
module.exports = __toCommonJS(SafeAreaView_native_exports);
|
|
32
32
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
33
|
var React = __toESM(require("react"), 1);
|
|
34
|
+
var import_react_native = require("react-native");
|
|
35
|
+
var import_safe_area = require("@vxrn/native/safe-area");
|
|
36
|
+
var import_InitialWindow = require("./InitialWindow.native.js");
|
|
34
37
|
var import_SafeAreaContext = require("./SafeAreaContext.native.js");
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var edgeBitmaskMap = {
|
|
41
|
-
top: TOP,
|
|
42
|
-
right: RIGHT,
|
|
43
|
-
bottom: BOTTOM,
|
|
44
|
-
left: LEFT
|
|
38
|
+
var ZERO_INSETS = {
|
|
39
|
+
top: 0,
|
|
40
|
+
right: 0,
|
|
41
|
+
bottom: 0,
|
|
42
|
+
left: 0
|
|
45
43
|
};
|
|
46
44
|
var SafeAreaView = /* @__PURE__ */ React.forwardRef(function(param, ref) {
|
|
47
|
-
var { style
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
}, 0) : Object.keys(edges).reduce(function(acc, edge) {
|
|
52
|
-
return acc | edgeBitmaskMap[edge];
|
|
53
|
-
}, 0) : ALL;
|
|
45
|
+
var { style, mode, edges, ...rest } = param;
|
|
46
|
+
var _ref;
|
|
47
|
+
var contextInsets = React.useContext(import_SafeAreaContext.SafeAreaInsetsContext);
|
|
48
|
+
var insets = (_ref = contextInsets !== null && contextInsets !== void 0 ? contextInsets : import_InitialWindow.initialWindowMetrics === null || import_InitialWindow.initialWindowMetrics === void 0 ? void 0 : import_InitialWindow.initialWindowMetrics.insets) !== null && _ref !== void 0 ? _ref : ZERO_INSETS;
|
|
54
49
|
var appliedStyle = React.useMemo(function() {
|
|
55
|
-
var insetTop = edgeBitmask & TOP ? insets.top : 0;
|
|
56
|
-
var insetRight = edgeBitmask & RIGHT ? insets.right : 0;
|
|
57
|
-
var insetBottom = edgeBitmask & BOTTOM ? insets.bottom : 0;
|
|
58
|
-
var insetLeft = edgeBitmask & LEFT ? insets.left : 0;
|
|
59
|
-
var flatStyle = (Array.isArray(style) ? style.flat(Number.POSITIVE_INFINITY) : [style]).reduce(function(result, value) {
|
|
60
|
-
return value ? Object.assign(result, value) : result;
|
|
61
|
-
}, {});
|
|
62
|
-
if (mode === "margin") {
|
|
63
|
-
var { margin = 0, marginVertical = margin, marginHorizontal = margin, marginTop = marginVertical, marginRight = marginHorizontal, marginBottom = marginVertical, marginLeft = marginHorizontal } = flatStyle;
|
|
64
|
-
var marginStyle = {
|
|
65
|
-
marginTop: marginTop + insetTop,
|
|
66
|
-
marginRight: marginRight + insetRight,
|
|
67
|
-
marginBottom: marginBottom + insetBottom,
|
|
68
|
-
marginLeft: marginLeft + insetLeft
|
|
69
|
-
};
|
|
70
|
-
var { marginVertical: _marginVertical, marginHorizontal: _marginHorizontal, ...domStyle } = flatStyle;
|
|
71
|
-
return {
|
|
72
|
-
...domStyle,
|
|
73
|
-
...marginStyle
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
var { padding = 0, paddingVertical = padding, paddingHorizontal = padding, paddingTop = paddingVertical, paddingRight = paddingHorizontal, paddingBottom = paddingVertical, paddingLeft = paddingHorizontal } = flatStyle;
|
|
77
|
-
var paddingStyle = {
|
|
78
|
-
paddingTop: paddingTop + insetTop,
|
|
79
|
-
paddingRight: paddingRight + insetRight,
|
|
80
|
-
paddingBottom: paddingBottom + insetBottom,
|
|
81
|
-
paddingLeft: paddingLeft + insetLeft
|
|
82
|
-
};
|
|
83
|
-
var { paddingVertical: _paddingVertical, paddingHorizontal: _paddingHorizontal, ...domStyle1 } = flatStyle;
|
|
84
50
|
return {
|
|
85
|
-
...
|
|
86
|
-
...
|
|
51
|
+
...import_react_native.StyleSheet.flatten(style),
|
|
52
|
+
...(0, import_safe_area.buildSafeAreaInsetStyle)({
|
|
53
|
+
insets,
|
|
54
|
+
edges,
|
|
55
|
+
mode,
|
|
56
|
+
style,
|
|
57
|
+
resolveStyle: import_react_native.StyleSheet.flatten
|
|
58
|
+
})
|
|
87
59
|
};
|
|
88
60
|
}, [
|
|
89
61
|
style,
|
|
90
62
|
insets,
|
|
91
|
-
|
|
92
|
-
|
|
63
|
+
edges,
|
|
64
|
+
mode
|
|
93
65
|
]);
|
|
94
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {
|
|
95
67
|
...rest,
|
|
96
68
|
style: appliedStyle,
|
|
97
69
|
ref
|
|
@@ -26,72 +26,44 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
enumerable: true
|
|
27
27
|
}) : target, mod));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
module.exports = __toCommonJS(
|
|
29
|
+
var SafeAreaView_native_exports = {};
|
|
30
|
+
__export(SafeAreaView_native_exports, { SafeAreaView: () => SafeAreaView });
|
|
31
|
+
module.exports = __toCommonJS(SafeAreaView_native_exports);
|
|
32
32
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
33
|
var React = __toESM(require("react"), 1);
|
|
34
|
+
var import_react_native = require("react-native");
|
|
35
|
+
var import_safe_area = require("@vxrn/native/safe-area");
|
|
36
|
+
var import_InitialWindow = require("./InitialWindow.native.js");
|
|
34
37
|
var import_SafeAreaContext = require("./SafeAreaContext.native.js");
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var edgeBitmaskMap = {
|
|
41
|
-
top: TOP,
|
|
42
|
-
right: RIGHT,
|
|
43
|
-
bottom: BOTTOM,
|
|
44
|
-
left: LEFT
|
|
38
|
+
var ZERO_INSETS = {
|
|
39
|
+
top: 0,
|
|
40
|
+
right: 0,
|
|
41
|
+
bottom: 0,
|
|
42
|
+
left: 0
|
|
45
43
|
};
|
|
46
44
|
var SafeAreaView = /* @__PURE__ */ React.forwardRef(function(param, ref) {
|
|
47
|
-
var { style
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
}, 0) : Object.keys(edges).reduce(function(acc, edge) {
|
|
52
|
-
return acc | edgeBitmaskMap[edge];
|
|
53
|
-
}, 0) : ALL;
|
|
45
|
+
var { style, mode, edges, ...rest } = param;
|
|
46
|
+
var _ref;
|
|
47
|
+
var contextInsets = React.useContext(import_SafeAreaContext.SafeAreaInsetsContext);
|
|
48
|
+
var insets = (_ref = contextInsets !== null && contextInsets !== void 0 ? contextInsets : import_InitialWindow.initialWindowMetrics === null || import_InitialWindow.initialWindowMetrics === void 0 ? void 0 : import_InitialWindow.initialWindowMetrics.insets) !== null && _ref !== void 0 ? _ref : ZERO_INSETS;
|
|
54
49
|
var appliedStyle = React.useMemo(function() {
|
|
55
|
-
var insetTop = edgeBitmask & TOP ? insets.top : 0;
|
|
56
|
-
var insetRight = edgeBitmask & RIGHT ? insets.right : 0;
|
|
57
|
-
var insetBottom = edgeBitmask & BOTTOM ? insets.bottom : 0;
|
|
58
|
-
var insetLeft = edgeBitmask & LEFT ? insets.left : 0;
|
|
59
|
-
var flatStyle = (Array.isArray(style) ? style.flat(Number.POSITIVE_INFINITY) : [style]).reduce(function(result, value) {
|
|
60
|
-
return value ? Object.assign(result, value) : result;
|
|
61
|
-
}, {});
|
|
62
|
-
if (mode === "margin") {
|
|
63
|
-
var { margin = 0, marginVertical = margin, marginHorizontal = margin, marginTop = marginVertical, marginRight = marginHorizontal, marginBottom = marginVertical, marginLeft = marginHorizontal } = flatStyle;
|
|
64
|
-
var marginStyle = {
|
|
65
|
-
marginTop: marginTop + insetTop,
|
|
66
|
-
marginRight: marginRight + insetRight,
|
|
67
|
-
marginBottom: marginBottom + insetBottom,
|
|
68
|
-
marginLeft: marginLeft + insetLeft
|
|
69
|
-
};
|
|
70
|
-
var { marginVertical: _marginVertical, marginHorizontal: _marginHorizontal, ...domStyle } = flatStyle;
|
|
71
|
-
return {
|
|
72
|
-
...domStyle,
|
|
73
|
-
...marginStyle
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
var { padding = 0, paddingVertical = padding, paddingHorizontal = padding, paddingTop = paddingVertical, paddingRight = paddingHorizontal, paddingBottom = paddingVertical, paddingLeft = paddingHorizontal } = flatStyle;
|
|
77
|
-
var paddingStyle = {
|
|
78
|
-
paddingTop: paddingTop + insetTop,
|
|
79
|
-
paddingRight: paddingRight + insetRight,
|
|
80
|
-
paddingBottom: paddingBottom + insetBottom,
|
|
81
|
-
paddingLeft: paddingLeft + insetLeft
|
|
82
|
-
};
|
|
83
|
-
var { paddingVertical: _paddingVertical, paddingHorizontal: _paddingHorizontal, ...domStyle1 } = flatStyle;
|
|
84
50
|
return {
|
|
85
|
-
...
|
|
86
|
-
...
|
|
51
|
+
...import_react_native.StyleSheet.flatten(style),
|
|
52
|
+
...(0, import_safe_area.buildSafeAreaInsetStyle)({
|
|
53
|
+
insets,
|
|
54
|
+
edges,
|
|
55
|
+
mode,
|
|
56
|
+
style,
|
|
57
|
+
resolveStyle: import_react_native.StyleSheet.flatten
|
|
58
|
+
})
|
|
87
59
|
};
|
|
88
60
|
}, [
|
|
89
61
|
style,
|
|
90
62
|
insets,
|
|
91
|
-
|
|
92
|
-
|
|
63
|
+
edges,
|
|
64
|
+
mode
|
|
93
65
|
]);
|
|
94
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {
|
|
95
67
|
...rest,
|
|
96
68
|
style: appliedStyle,
|
|
97
69
|
ref
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SafeAreaView.native.js","names":[],"sources":["cjs/SafeAreaView.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar
|
|
1
|
+
{"version":3,"file":"SafeAreaView.native.js","names":[],"sources":["cjs/SafeAreaView.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SafeAreaView_native_exports = {};\n__export(SafeAreaView_native_exports, {\n SafeAreaView: () => SafeAreaView\n});\nmodule.exports = __toCommonJS(SafeAreaView_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_react_native = require(\"react-native\");\nvar import_safe_area = require(\"@vxrn/native/safe-area\");\nvar import_InitialWindow = require(\"./InitialWindow\");\nvar import_SafeAreaContext = require(\"./SafeAreaContext\");\nvar ZERO_INSETS = {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n};\nvar SafeAreaView = /* @__PURE__ */ React.forwardRef(function(param, ref) {\n var { style, mode, edges, ...rest } = param;\n var _ref;\n var contextInsets = React.useContext(import_SafeAreaContext.SafeAreaInsetsContext);\n var insets = (_ref = contextInsets !== null && contextInsets !== void 0 ? contextInsets : import_InitialWindow.initialWindowMetrics === null || import_InitialWindow.initialWindowMetrics === void 0 ? void 0 : import_InitialWindow.initialWindowMetrics.insets) !== null && _ref !== void 0 ? _ref : ZERO_INSETS;\n var appliedStyle = React.useMemo(function() {\n return {\n ...import_react_native.StyleSheet.flatten(style),\n ...(0, import_safe_area.buildSafeAreaInsetStyle)({\n insets,\n edges,\n mode,\n style,\n resolveStyle: import_react_native.StyleSheet.flatten\n })\n };\n }, [\n style,\n insets,\n edges,\n mode\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {\n ...rest,\n style: appliedStyle,\n ref\n });\n});\n//# sourceMappingURL=SafeAreaView.native.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,8BAA8B,CAAC;AACnC,SAAS,6BAA6B,EACpC,oBAAoB,aACtB,CAAC;AACD,OAAO,UAAU,aAAa,2BAA2B;AACzD,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,QAAQ,QAAQ,QAAQ,OAAO,GAAG,CAAC;AACvC,IAAI,sBAAsB,QAAQ,cAAc;AAChD,IAAI,mBAAmB,QAAQ,wBAAwB;AACvD,IAAI,uBAAuB,QAAQ,2BAAiB;AACpD,IAAI,yBAAyB,QAAQ,6BAAmB;AACxD,IAAI,cAAc;CAChB,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;AACR;AACA,IAAI,eAA+B,sBAAM,WAAW,SAAS,OAAO,KAAK;CACvE,IAAI,EAAE,OAAO,MAAM,OAAO,GAAG,SAAS;CACtC,IAAI;CACJ,IAAI,gBAAgB,MAAM,WAAW,uBAAuB,qBAAqB;CACjF,IAAI,UAAU,OAAO,kBAAkB,QAAQ,kBAAkB,KAAK,IAAI,gBAAgB,qBAAqB,yBAAyB,QAAQ,qBAAqB,yBAAyB,KAAK,IAAI,KAAK,IAAI,qBAAqB,qBAAqB,YAAY,QAAQ,SAAS,KAAK,IAAI,OAAO;CACvS,IAAI,eAAe,MAAM,QAAQ,WAAW;EAC1C,OAAO;GACL,GAAG,oBAAoB,WAAW,QAAQ,KAAK;GAC/C,IAAI,GAAG,iBAAiB,wBAAuB,CAAE;IAC/C;IACA;IACA;IACA;IACA,cAAc,oBAAoB,WAAW;GAC/C,CAAC;EACH;CACF,GAAG;EACD;EACA;EACA;EACA;CACF,CAAC;CACD,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,oBAAoB,MAAM;EAC3E,GAAG;EACH,OAAO;EACP;CACF,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { getInitialWindowMetrics } from "@vxrn/native/safe-area";
|
|
2
|
+
|
|
3
|
+
var initialWindowMetrics = getInitialWindowMetrics();
|
|
4
|
+
var initialWindowSafeAreaInsets = initialWindowMetrics === null || initialWindowMetrics === void 0 ? void 0 : initialWindowMetrics.insets;
|
|
3
5
|
|
|
4
6
|
export { initialWindowMetrics, initialWindowSafeAreaInsets };
|
|
5
7
|
//# sourceMappingURL=InitialWindow.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitialWindow.native.js","names":[],"sources":["esm/InitialWindow.native.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"InitialWindow.native.js","names":[],"sources":["esm/InitialWindow.native.js"],"sourcesContent":["import { getInitialWindowMetrics } from \"@vxrn/native/safe-area\";\nvar initialWindowMetrics = getInitialWindowMetrics();\nvar initialWindowSafeAreaInsets = initialWindowMetrics === null || initialWindowMetrics === void 0 ? void 0 : initialWindowMetrics.insets;\nexport {\n initialWindowMetrics,\n initialWindowSafeAreaInsets\n};\n//# sourceMappingURL=InitialWindow.native.js.map\n"],"mappings":";;;AACA,IAAI,uBAAuB,wBAAwB;AACnD,IAAI,8BAA8B,yBAAyB,QAAQ,yBAAyB,KAAK,IAAI,KAAK,IAAI,qBAAqB"}
|
|
@@ -1,114 +1,21 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import { NativeSafeAreaProvider as NativeSafeAreaProvider$1, providerEventToMetrics } from "@vxrn/native/safe-area";
|
|
3
5
|
|
|
4
|
-
var CSSTransitions = {
|
|
5
|
-
WebkitTransition: "webkitTransitionEnd",
|
|
6
|
-
Transition: "transitionEnd",
|
|
7
|
-
MozTransition: "transitionend",
|
|
8
|
-
MSTransition: "msTransitionEnd",
|
|
9
|
-
OTransition: "oTransitionEnd"
|
|
10
|
-
};
|
|
11
6
|
function NativeSafeAreaProvider(param) {
|
|
12
7
|
var { children, style, onInsetsChange } = param;
|
|
13
|
-
React.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
var element = createContextElement();
|
|
18
|
-
document.body.appendChild(element);
|
|
19
|
-
var onEnd = function() {
|
|
20
|
-
var { paddingTop, paddingBottom, paddingLeft, paddingRight } = window.getComputedStyle(element);
|
|
21
|
-
var insets = {
|
|
22
|
-
top: paddingTop ? Number.parseInt(paddingTop, 10) : 0,
|
|
23
|
-
bottom: paddingBottom ? Number.parseInt(paddingBottom, 10) : 0,
|
|
24
|
-
left: paddingLeft ? Number.parseInt(paddingLeft, 10) : 0,
|
|
25
|
-
right: paddingRight ? Number.parseInt(paddingRight, 10) : 0
|
|
26
|
-
};
|
|
27
|
-
var frame = {
|
|
28
|
-
x: 0,
|
|
29
|
-
y: 0,
|
|
30
|
-
width: document.documentElement.offsetWidth,
|
|
31
|
-
height: document.documentElement.offsetHeight
|
|
32
|
-
};
|
|
33
|
-
onInsetsChange({ nativeEvent: {
|
|
34
|
-
insets,
|
|
35
|
-
frame
|
|
36
|
-
} });
|
|
37
|
-
};
|
|
38
|
-
element.addEventListener(getSupportedTransitionEvent(), onEnd);
|
|
39
|
-
onEnd();
|
|
40
|
-
return function() {
|
|
41
|
-
document.body.removeChild(element);
|
|
42
|
-
element.removeEventListener(getSupportedTransitionEvent(), onEnd);
|
|
43
|
-
};
|
|
8
|
+
var handleInsetsChange = React.useCallback(function(param2) {
|
|
9
|
+
var { nativeEvent } = param2;
|
|
10
|
+
onInsetsChange({ nativeEvent: providerEventToMetrics(nativeEvent) });
|
|
44
11
|
}, [onInsetsChange]);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var flattenedStyle = styleValues.reduce(function(result, value) {
|
|
49
|
-
return value && typeof value === "object" ? Object.assign(result, value) : result;
|
|
50
|
-
}, {});
|
|
51
|
-
return /* @__PURE__ */ jsx("div", {
|
|
52
|
-
style: flattenedStyle,
|
|
53
|
-
children
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return /* @__PURE__ */ jsx("div", {
|
|
57
|
-
style: { display: "contents" },
|
|
12
|
+
return /* @__PURE__ */ jsx(NativeSafeAreaProvider$1, {
|
|
13
|
+
style: [styles.fill, style],
|
|
14
|
+
onNativeInsetsChange: handleInsetsChange,
|
|
58
15
|
children
|
|
59
16
|
});
|
|
60
17
|
}
|
|
61
|
-
var
|
|
62
|
-
function getSupportedTransitionEvent() {
|
|
63
|
-
if (_supportedTransitionEvent != null) {
|
|
64
|
-
return _supportedTransitionEvent;
|
|
65
|
-
}
|
|
66
|
-
var element = document.createElement("invalidtype");
|
|
67
|
-
_supportedTransitionEvent = CSSTransitions.Transition;
|
|
68
|
-
for (var key in CSSTransitions) {
|
|
69
|
-
if (element.style[key] !== void 0) {
|
|
70
|
-
_supportedTransitionEvent = CSSTransitions[key];
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return _supportedTransitionEvent;
|
|
75
|
-
}
|
|
76
|
-
var _supportedEnv = null;
|
|
77
|
-
function getSupportedEnv() {
|
|
78
|
-
if (_supportedEnv !== null) {
|
|
79
|
-
return _supportedEnv;
|
|
80
|
-
}
|
|
81
|
-
var { CSS } = window;
|
|
82
|
-
if (CSS && CSS.supports && CSS.supports("top: constant(safe-area-inset-top)")) {
|
|
83
|
-
_supportedEnv = "constant";
|
|
84
|
-
} else {
|
|
85
|
-
_supportedEnv = "env";
|
|
86
|
-
}
|
|
87
|
-
return _supportedEnv;
|
|
88
|
-
}
|
|
89
|
-
function getInset(side) {
|
|
90
|
-
return `${getSupportedEnv()}(safe-area-inset-${side})`;
|
|
91
|
-
}
|
|
92
|
-
function createContextElement() {
|
|
93
|
-
var element = document.createElement("div");
|
|
94
|
-
var { style } = element;
|
|
95
|
-
style.position = "fixed";
|
|
96
|
-
style.left = "0";
|
|
97
|
-
style.top = "0";
|
|
98
|
-
style.width = "0";
|
|
99
|
-
style.height = "0";
|
|
100
|
-
style.zIndex = "-1";
|
|
101
|
-
style.overflow = "hidden";
|
|
102
|
-
style.visibility = "hidden";
|
|
103
|
-
style.transitionDuration = "0.05s";
|
|
104
|
-
style.transitionProperty = "padding";
|
|
105
|
-
style.transitionDelay = "0s";
|
|
106
|
-
style.paddingTop = getInset("top");
|
|
107
|
-
style.paddingBottom = getInset("bottom");
|
|
108
|
-
style.paddingLeft = getInset("left");
|
|
109
|
-
style.paddingRight = getInset("right");
|
|
110
|
-
return element;
|
|
111
|
-
}
|
|
18
|
+
var styles = StyleSheet.create({ fill: { flex: 1 } });
|
|
112
19
|
|
|
113
20
|
export { NativeSafeAreaProvider };
|
|
114
21
|
//# sourceMappingURL=NativeSafeAreaProvider.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeSafeAreaProvider.native.js","names":[],"sources":["esm/NativeSafeAreaProvider.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport * as React from \"react\";\
|
|
1
|
+
{"version":3,"file":"NativeSafeAreaProvider.native.js","names":["NativeSafeAreaProviderHost"],"sources":["esm/NativeSafeAreaProvider.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport * as React from \"react\";\nimport { StyleSheet } from \"react-native\";\nimport { NativeSafeAreaProvider as NativeSafeAreaProviderHost, providerEventToMetrics } from \"@vxrn/native/safe-area\";\nfunction NativeSafeAreaProvider(param) {\n var { children, style, onInsetsChange } = param;\n var handleInsetsChange = React.useCallback(function(param2) {\n var { nativeEvent } = param2;\n onInsetsChange({\n nativeEvent: providerEventToMetrics(nativeEvent)\n });\n }, [\n onInsetsChange\n ]);\n return /* @__PURE__ */ _jsx(NativeSafeAreaProviderHost, {\n style: [\n styles.fill,\n style\n ],\n onNativeInsetsChange: handleInsetsChange,\n children\n });\n}\nvar styles = StyleSheet.create({\n fill: {\n flex: 1\n }\n});\nexport {\n NativeSafeAreaProvider\n};\n//# sourceMappingURL=NativeSafeAreaProvider.native.js.map\n"],"mappings":";;;;;;AAIA,SAAS,uBAAuB,OAAO;CACrC,IAAI,EAAE,UAAU,OAAO,mBAAmB;CAC1C,IAAI,qBAAqB,MAAM,YAAY,SAAS,QAAQ;EAC1D,IAAI,EAAE,gBAAgB;EACtB,eAAe,EACb,aAAa,uBAAuB,WAAW,EACjD,CAAC;CACH,GAAG,CACD,cACF,CAAC;CACD,OAAuB,oBAAKA,0BAA4B;EACtD,OAAO,CACL,OAAO,MACP,KACF;EACA,sBAAsB;EACtB;CACF,CAAC;AACH;AACA,IAAI,SAAS,WAAW,OAAO,EAC7B,MAAM,EACJ,MAAM,EACR,EACF,CAAC"}
|
|
@@ -1,67 +1,39 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { StyleSheet, View } from "react-native";
|
|
4
|
+
import { buildSafeAreaInsetStyle } from "@vxrn/native/safe-area";
|
|
5
|
+
import { initialWindowMetrics } from "./InitialWindow.native.js";
|
|
6
|
+
import { SafeAreaInsetsContext } from "./SafeAreaContext.native.js";
|
|
4
7
|
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var edgeBitmaskMap = {
|
|
11
|
-
top: TOP,
|
|
12
|
-
right: RIGHT,
|
|
13
|
-
bottom: BOTTOM,
|
|
14
|
-
left: LEFT
|
|
8
|
+
var ZERO_INSETS = {
|
|
9
|
+
top: 0,
|
|
10
|
+
right: 0,
|
|
11
|
+
bottom: 0,
|
|
12
|
+
left: 0
|
|
15
13
|
};
|
|
16
14
|
var SafeAreaView = /* @__PURE__ */ React.forwardRef(function(param, ref) {
|
|
17
|
-
var { style
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
}, 0) : Object.keys(edges).reduce(function(acc, edge) {
|
|
22
|
-
return acc | edgeBitmaskMap[edge];
|
|
23
|
-
}, 0) : ALL;
|
|
15
|
+
var { style, mode, edges, ...rest } = param;
|
|
16
|
+
var _ref;
|
|
17
|
+
var contextInsets = React.useContext(SafeAreaInsetsContext);
|
|
18
|
+
var insets = (_ref = contextInsets !== null && contextInsets !== void 0 ? contextInsets : initialWindowMetrics === null || initialWindowMetrics === void 0 ? void 0 : initialWindowMetrics.insets) !== null && _ref !== void 0 ? _ref : ZERO_INSETS;
|
|
24
19
|
var appliedStyle = React.useMemo(function() {
|
|
25
|
-
var insetTop = edgeBitmask & TOP ? insets.top : 0;
|
|
26
|
-
var insetRight = edgeBitmask & RIGHT ? insets.right : 0;
|
|
27
|
-
var insetBottom = edgeBitmask & BOTTOM ? insets.bottom : 0;
|
|
28
|
-
var insetLeft = edgeBitmask & LEFT ? insets.left : 0;
|
|
29
|
-
var flatStyle = (Array.isArray(style) ? style.flat(Number.POSITIVE_INFINITY) : [style]).reduce(function(result, value) {
|
|
30
|
-
return value ? Object.assign(result, value) : result;
|
|
31
|
-
}, {});
|
|
32
|
-
if (mode === "margin") {
|
|
33
|
-
var { margin = 0, marginVertical = margin, marginHorizontal = margin, marginTop = marginVertical, marginRight = marginHorizontal, marginBottom = marginVertical, marginLeft = marginHorizontal } = flatStyle;
|
|
34
|
-
var marginStyle = {
|
|
35
|
-
marginTop: marginTop + insetTop,
|
|
36
|
-
marginRight: marginRight + insetRight,
|
|
37
|
-
marginBottom: marginBottom + insetBottom,
|
|
38
|
-
marginLeft: marginLeft + insetLeft
|
|
39
|
-
};
|
|
40
|
-
var { marginVertical: _marginVertical, marginHorizontal: _marginHorizontal, ...domStyle } = flatStyle;
|
|
41
|
-
return {
|
|
42
|
-
...domStyle,
|
|
43
|
-
...marginStyle
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
var { padding = 0, paddingVertical = padding, paddingHorizontal = padding, paddingTop = paddingVertical, paddingRight = paddingHorizontal, paddingBottom = paddingVertical, paddingLeft = paddingHorizontal } = flatStyle;
|
|
47
|
-
var paddingStyle = {
|
|
48
|
-
paddingTop: paddingTop + insetTop,
|
|
49
|
-
paddingRight: paddingRight + insetRight,
|
|
50
|
-
paddingBottom: paddingBottom + insetBottom,
|
|
51
|
-
paddingLeft: paddingLeft + insetLeft
|
|
52
|
-
};
|
|
53
|
-
var { paddingVertical: _paddingVertical, paddingHorizontal: _paddingHorizontal, ...domStyle1 } = flatStyle;
|
|
54
20
|
return {
|
|
55
|
-
...
|
|
56
|
-
...
|
|
21
|
+
...StyleSheet.flatten(style),
|
|
22
|
+
...buildSafeAreaInsetStyle({
|
|
23
|
+
insets,
|
|
24
|
+
edges,
|
|
25
|
+
mode,
|
|
26
|
+
style,
|
|
27
|
+
resolveStyle: StyleSheet.flatten
|
|
28
|
+
})
|
|
57
29
|
};
|
|
58
30
|
}, [
|
|
59
31
|
style,
|
|
60
32
|
insets,
|
|
61
|
-
|
|
62
|
-
|
|
33
|
+
edges,
|
|
34
|
+
mode
|
|
63
35
|
]);
|
|
64
|
-
return /* @__PURE__ */ jsx(
|
|
36
|
+
return /* @__PURE__ */ jsx(View, {
|
|
65
37
|
...rest,
|
|
66
38
|
style: appliedStyle,
|
|
67
39
|
ref
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SafeAreaView.native.js","names":[],"sources":["esm/SafeAreaView.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport * as React from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"SafeAreaView.native.js","names":[],"sources":["esm/SafeAreaView.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport * as React from \"react\";\nimport { StyleSheet, View } from \"react-native\";\nimport { buildSafeAreaInsetStyle } from \"@vxrn/native/safe-area\";\nimport { initialWindowMetrics } from \"./InitialWindow\";\nimport { SafeAreaInsetsContext } from \"./SafeAreaContext\";\nvar ZERO_INSETS = {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n};\nvar SafeAreaView = /* @__PURE__ */ React.forwardRef(function(param, ref) {\n var { style, mode, edges, ...rest } = param;\n var _ref;\n var contextInsets = React.useContext(SafeAreaInsetsContext);\n var insets = (_ref = contextInsets !== null && contextInsets !== void 0 ? contextInsets : initialWindowMetrics === null || initialWindowMetrics === void 0 ? void 0 : initialWindowMetrics.insets) !== null && _ref !== void 0 ? _ref : ZERO_INSETS;\n var appliedStyle = React.useMemo(function() {\n return {\n ...StyleSheet.flatten(style),\n ...buildSafeAreaInsetStyle({\n insets,\n edges,\n mode,\n style,\n resolveStyle: StyleSheet.flatten\n })\n };\n }, [\n style,\n insets,\n edges,\n mode\n ]);\n return /* @__PURE__ */ _jsx(View, {\n ...rest,\n style: appliedStyle,\n ref\n });\n});\nexport {\n SafeAreaView\n};\n//# sourceMappingURL=SafeAreaView.native.js.map\n"],"mappings":";;;;;;;;AAMA,IAAI,cAAc;CAChB,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;AACR;AACA,IAAI,eAA+B,sBAAM,WAAW,SAAS,OAAO,KAAK;CACvE,IAAI,EAAE,OAAO,MAAM,OAAO,GAAG,SAAS;CACtC,IAAI;CACJ,IAAI,gBAAgB,MAAM,WAAW,qBAAqB;CAC1D,IAAI,UAAU,OAAO,kBAAkB,QAAQ,kBAAkB,KAAK,IAAI,gBAAgB,yBAAyB,QAAQ,yBAAyB,KAAK,IAAI,KAAK,IAAI,qBAAqB,YAAY,QAAQ,SAAS,KAAK,IAAI,OAAO;CACxO,IAAI,eAAe,MAAM,QAAQ,WAAW;EAC1C,OAAO;GACL,GAAG,WAAW,QAAQ,KAAK;GAC3B,GAAG,wBAAwB;IACzB;IACA;IACA;IACA;IACA,cAAc,WAAW;GAC3B,CAAC;EACH;CACF,GAAG;EACD;EACA;EACA;EACA;CACF,CAAC;CACD,OAAuB,oBAAK,MAAM;EAChC,GAAG;EACH,OAAO;EACP;CACF,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vxrn/safe-area",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.50.1",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
"require": "./dist/cjs/index.cjs"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@vxrn/native": "2.0.0-beta.50.1"
|
|
31
|
+
},
|
|
29
32
|
"devDependencies": {
|
|
30
33
|
"@biomejs/biome": "2.3.3",
|
|
31
34
|
"@tamagui/build": "3.0.0-beta.1309.1"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { getInitialWindowMetrics } from '@vxrn/native/safe-area'
|
|
2
|
+
import type { Metrics } from './SafeArea-types'
|
|
3
|
+
|
|
4
|
+
export const initialWindowMetrics: Metrics | null = getInitialWindowMetrics()
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated
|
|
8
|
+
*/
|
|
9
|
+
export const initialWindowSafeAreaInsets = initialWindowMetrics?.insets
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { StyleSheet } from 'react-native'
|
|
3
|
+
import {
|
|
4
|
+
NativeSafeAreaProvider as NativeSafeAreaProviderHost,
|
|
5
|
+
providerEventToMetrics,
|
|
6
|
+
} from '@vxrn/native/safe-area'
|
|
7
|
+
import type { InsetChangedEvent, NativeSafeAreaProviderProps } from './SafeArea-types'
|
|
8
|
+
|
|
9
|
+
// native provider: the OneNativeSafeAreaProvider host measures insets on the
|
|
10
|
+
// UI thread and the adapter reshapes its flat event into context Metrics.
|
|
11
|
+
// fills like upstream so the measured view covers its parent; the reported
|
|
12
|
+
// insets stay relative to this view, exactly as with RNCSafeAreaProvider.
|
|
13
|
+
// the fill lives here rather than the shared context so web keeps its
|
|
14
|
+
// display:contents provider and sticky positioning keeps working there.
|
|
15
|
+
export function NativeSafeAreaProvider({
|
|
16
|
+
children,
|
|
17
|
+
style,
|
|
18
|
+
onInsetsChange,
|
|
19
|
+
}: NativeSafeAreaProviderProps) {
|
|
20
|
+
const handleInsetsChange = React.useCallback(
|
|
21
|
+
({ nativeEvent }: { nativeEvent: Parameters<typeof providerEventToMetrics>[0] }) => {
|
|
22
|
+
onInsetsChange({
|
|
23
|
+
nativeEvent: providerEventToMetrics(nativeEvent),
|
|
24
|
+
} as InsetChangedEvent)
|
|
25
|
+
},
|
|
26
|
+
[onInsetsChange]
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<NativeSafeAreaProviderHost
|
|
31
|
+
style={[styles.fill, style]}
|
|
32
|
+
onNativeInsetsChange={handleInsetsChange}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
</NativeSafeAreaProviderHost>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const styles = StyleSheet.create({
|
|
40
|
+
fill: { flex: 1 },
|
|
41
|
+
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { StyleSheet, View } from 'react-native'
|
|
3
|
+
import { buildSafeAreaInsetStyle } from '@vxrn/native/safe-area'
|
|
4
|
+
import { initialWindowMetrics } from './InitialWindow'
|
|
5
|
+
import { SafeAreaInsetsContext } from './SafeAreaContext'
|
|
6
|
+
import type {
|
|
7
|
+
NativeSafeAreaViewInstance,
|
|
8
|
+
NativeSafeAreaViewProps,
|
|
9
|
+
} from './SafeArea-types'
|
|
10
|
+
|
|
11
|
+
const ZERO_INSETS = { top: 0, right: 0, bottom: 0, left: 0 }
|
|
12
|
+
|
|
13
|
+
// native view: applies the nearest provider's insets as padding or margin
|
|
14
|
+
// per the edge modes. without a provider it falls back to the synchronous
|
|
15
|
+
// native initial metrics, so a standalone view still matches upstream
|
|
16
|
+
// instead of throwing like the hook.
|
|
17
|
+
export const SafeAreaView = React.forwardRef<
|
|
18
|
+
NativeSafeAreaViewInstance,
|
|
19
|
+
NativeSafeAreaViewProps
|
|
20
|
+
>(({ style, mode, edges, ...rest }, ref) => {
|
|
21
|
+
const contextInsets = React.useContext(SafeAreaInsetsContext)
|
|
22
|
+
const insets = contextInsets ?? initialWindowMetrics?.insets ?? ZERO_INSETS
|
|
23
|
+
|
|
24
|
+
const appliedStyle = React.useMemo(
|
|
25
|
+
() => ({
|
|
26
|
+
...StyleSheet.flatten(style),
|
|
27
|
+
...buildSafeAreaInsetStyle({
|
|
28
|
+
insets,
|
|
29
|
+
edges,
|
|
30
|
+
mode,
|
|
31
|
+
style,
|
|
32
|
+
resolveStyle: StyleSheet.flatten,
|
|
33
|
+
}),
|
|
34
|
+
}),
|
|
35
|
+
[style, insets, edges, mode]
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
return <View {...rest} style={appliedStyle} ref={ref} />
|
|
39
|
+
})
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Metrics } from './SafeArea-types';
|
|
2
|
+
export declare const initialWindowMetrics: Metrics | null;
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated
|
|
5
|
+
*/
|
|
6
|
+
export declare const initialWindowSafeAreaInsets: import("./SafeArea-types").EdgeInsets | undefined;
|
|
7
|
+
//# sourceMappingURL=InitialWindow.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InitialWindow.native.d.ts","sourceRoot":"","sources":["../src/InitialWindow.native.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C,eAAO,MAAM,oBAAoB,EAAE,OAAO,GAAG,IAAgC,CAAA;AAE7E;;GAEG;AACH,eAAO,MAAM,2BAA2B,mDAA+B,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { NativeSafeAreaProviderProps } from './SafeArea-types';
|
|
2
|
+
export declare function NativeSafeAreaProvider({ children, style, onInsetsChange, }: NativeSafeAreaProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=NativeSafeAreaProvider.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeSafeAreaProvider.native.d.ts","sourceRoot":"","sources":["../src/NativeSafeAreaProvider.native.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAqB,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAQtF,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,KAAK,EACL,cAAc,GACf,EAAE,2BAA2B,2CAkB7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SafeAreaView.native.d.ts","sourceRoot":"","sources":["../src/SafeAreaView.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,KAAK,EAEV,uBAAuB,EACxB,MAAM,kBAAkB,CAAA;AAQzB,eAAO,MAAM,YAAY,qFAsBvB,CAAA"}
|