yeet
This commit is contained in:
51
node_modules/react-native-safe-area-context/lib/commonjs/CompatNativeSafeAreaProvider.js
generated
vendored
Normal file
51
node_modules/react-native-safe-area-context/lib/commonjs/CompatNativeSafeAreaProvider.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.CompatNativeSafeAreaProvider = CompatNativeSafeAreaProvider;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _reactNative = require("react-native");
|
||||
|
||||
var _useWindowDimensions = _interopRequireDefault(require("./useWindowDimensions"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function CompatNativeSafeAreaProvider({
|
||||
children,
|
||||
style,
|
||||
onInsetsChange
|
||||
}) {
|
||||
const window = (0, _useWindowDimensions.default)();
|
||||
React.useEffect(() => {
|
||||
const insets = {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0
|
||||
};
|
||||
const frame = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: window.width,
|
||||
height: window.height
|
||||
}; // @ts-ignore: missing properties
|
||||
|
||||
onInsetsChange({
|
||||
nativeEvent: {
|
||||
insets,
|
||||
frame
|
||||
}
|
||||
});
|
||||
}, [onInsetsChange, window.height, window.width]);
|
||||
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
||||
style: style
|
||||
}, children);
|
||||
}
|
||||
//# sourceMappingURL=CompatNativeSafeAreaProvider.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/CompatNativeSafeAreaProvider.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/CompatNativeSafeAreaProvider.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["CompatNativeSafeAreaProvider.tsx"],"names":["CompatNativeSafeAreaProvider","children","style","onInsetsChange","window","React","useEffect","insets","top","bottom","left","right","frame","x","y","width","height","nativeEvent"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;;;AAEO,SAASA,4BAAT,CAAsC;AAC3CC,EAAAA,QAD2C;AAE3CC,EAAAA,KAF2C;AAG3CC,EAAAA;AAH2C,CAAtC,EAIyB;AAC9B,QAAMC,MAAM,GAAG,mCAAf;AACAC,EAAAA,KAAK,CAACC,SAAN,CAAgB,MAAM;AACpB,UAAMC,MAAM,GAAG;AACbC,MAAAA,GAAG,EAAE,CADQ;AAEbC,MAAAA,MAAM,EAAE,CAFK;AAGbC,MAAAA,IAAI,EAAE,CAHO;AAIbC,MAAAA,KAAK,EAAE;AAJM,KAAf;AAMA,UAAMC,KAAK,GAAG;AACZC,MAAAA,CAAC,EAAE,CADS;AAEZC,MAAAA,CAAC,EAAE,CAFS;AAGZC,MAAAA,KAAK,EAAEX,MAAM,CAACW,KAHF;AAIZC,MAAAA,MAAM,EAAEZ,MAAM,CAACY;AAJH,KAAd,CAPoB,CAapB;;AACAb,IAAAA,cAAc,CAAC;AAAEc,MAAAA,WAAW,EAAE;AAAEV,QAAAA,MAAF;AAAUK,QAAAA;AAAV;AAAf,KAAD,CAAd;AACD,GAfD,EAeG,CAACT,cAAD,EAAiBC,MAAM,CAACY,MAAxB,EAAgCZ,MAAM,CAACW,KAAvC,CAfH;AAgBA,sBAAO,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAEb;AAAb,KAAqBD,QAArB,CAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { View } from 'react-native';\nimport { NativeSafeAreaProviderProps } from './SafeArea.types';\nimport useWindowDimensions from './useWindowDimensions';\n\nexport function CompatNativeSafeAreaProvider({\n children,\n style,\n onInsetsChange,\n}: NativeSafeAreaProviderProps) {\n const window = useWindowDimensions();\n React.useEffect(() => {\n const insets = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n };\n const frame = {\n x: 0,\n y: 0,\n width: window.width,\n height: window.height,\n };\n // @ts-ignore: missing properties\n onInsetsChange({ nativeEvent: { insets, frame } });\n }, [onInsetsChange, window.height, window.width]);\n return <View style={style}>{children}</View>;\n}\n"]}
|
15
node_modules/react-native-safe-area-context/lib/commonjs/InitialWindow.js
generated
vendored
Normal file
15
node_modules/react-native-safe-area-context/lib/commonjs/InitialWindow.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.initialWindowSafeAreaInsets = exports.initialWindowMetrics = void 0;
|
||||
const initialWindowMetrics = null;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
exports.initialWindowMetrics = initialWindowMetrics;
|
||||
const initialWindowSafeAreaInsets = null;
|
||||
exports.initialWindowSafeAreaInsets = initialWindowSafeAreaInsets;
|
||||
//# sourceMappingURL=InitialWindow.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/InitialWindow.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/InitialWindow.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["InitialWindow.ts"],"names":["initialWindowMetrics","initialWindowSafeAreaInsets"],"mappings":";;;;;;AAEO,MAAMA,oBAAoC,GAAG,IAA7C;AAEP;;;;;AAGO,MAAMC,2BAA8C,GAAG,IAAvD","sourcesContent":["import { EdgeInsets, Metrics } from './SafeArea.types';\n\nexport const initialWindowMetrics: Metrics | null = null;\n\n/**\n * @deprecated\n */\nexport const initialWindowSafeAreaInsets: EdgeInsets | null = null;\n"]}
|
20
node_modules/react-native-safe-area-context/lib/commonjs/InitialWindow.native.js
generated
vendored
Normal file
20
node_modules/react-native-safe-area-context/lib/commonjs/InitialWindow.native.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.initialWindowSafeAreaInsets = exports.initialWindowMetrics = void 0;
|
||||
|
||||
var _reactNative = require("react-native");
|
||||
|
||||
const RNCSafeAreaProviderConfig = _reactNative.UIManager.getViewManagerConfig('RNCSafeAreaProvider');
|
||||
|
||||
const initialWindowMetrics = RNCSafeAreaProviderConfig != null && RNCSafeAreaProviderConfig.Constants != null ? RNCSafeAreaProviderConfig.Constants.initialWindowMetrics : null;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
exports.initialWindowMetrics = initialWindowMetrics;
|
||||
const initialWindowSafeAreaInsets = initialWindowMetrics === null || initialWindowMetrics === void 0 ? void 0 : initialWindowMetrics.insets;
|
||||
exports.initialWindowSafeAreaInsets = initialWindowSafeAreaInsets;
|
||||
//# sourceMappingURL=InitialWindow.native.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/InitialWindow.native.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/InitialWindow.native.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["InitialWindow.native.ts"],"names":["RNCSafeAreaProviderConfig","UIManager","getViewManagerConfig","initialWindowMetrics","Constants","initialWindowSafeAreaInsets","insets"],"mappings":";;;;;;;AAAA;;AAGA,MAAMA,yBAAyB,GAAGC,uBAAUC,oBAAV,CAChC,qBADgC,CAAlC;;AAIO,MAAMC,oBAAoB,GAAIH,yBAAyB,IAAI,IAA7B,IACrCA,yBAAyB,CAACI,SAA1B,IAAuC,IADF,GAEjCJ,yBAAyB,CAACI,SAA1B,CAAoCD,oBAFH,GAGjC,IAHG;AAKP;;;;;AAGO,MAAME,2BAA2B,GAAGF,oBAAH,aAAGA,oBAAH,uBAAGA,oBAAoB,CAAEG,MAA1D","sourcesContent":["import { UIManager } from 'react-native';\nimport { Metrics } from './SafeArea.types';\n\nconst RNCSafeAreaProviderConfig = UIManager.getViewManagerConfig(\n 'RNCSafeAreaProvider',\n) as any;\n\nexport const initialWindowMetrics = (RNCSafeAreaProviderConfig != null &&\nRNCSafeAreaProviderConfig.Constants != null\n ? RNCSafeAreaProviderConfig.Constants.initialWindowMetrics\n : null) as Metrics | null;\n\n/**\n * @deprecated\n */\nexport const initialWindowSafeAreaInsets = initialWindowMetrics?.insets;\n"]}
|
152
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.js
generated
vendored
Normal file
152
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.js
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = NativeSafeAreaView;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _reactNative = require("react-native");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
/**
|
||||
* TODO:
|
||||
* Currently insets and frame are based on the window and are not
|
||||
* relative to the provider view. This is inconsistent with iOS and Android.
|
||||
* However in most cases if the provider view covers the screen this is not
|
||||
* an issue.
|
||||
*/
|
||||
const CSSTransitions = {
|
||||
WebkitTransition: 'webkitTransitionEnd',
|
||||
Transition: 'transitionEnd',
|
||||
MozTransition: 'transitionend',
|
||||
MSTransition: 'msTransitionEnd',
|
||||
OTransition: 'oTransitionEnd'
|
||||
};
|
||||
|
||||
function NativeSafeAreaView({
|
||||
children,
|
||||
style,
|
||||
onInsetsChange
|
||||
}) {
|
||||
React.useEffect(() => {
|
||||
// Skip for SSR.
|
||||
if (typeof document === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
const element = createContextElement();
|
||||
document.body.appendChild(element);
|
||||
|
||||
const onEnd = () => {
|
||||
const {
|
||||
paddingTop,
|
||||
paddingBottom,
|
||||
paddingLeft,
|
||||
paddingRight
|
||||
} = window.getComputedStyle(element);
|
||||
const insets = {
|
||||
top: paddingTop ? parseInt(paddingTop, 10) : 0,
|
||||
bottom: paddingBottom ? parseInt(paddingBottom, 10) : 0,
|
||||
left: paddingLeft ? parseInt(paddingLeft, 10) : 0,
|
||||
right: paddingRight ? parseInt(paddingRight, 10) : 0
|
||||
};
|
||||
const frame = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: document.documentElement.offsetWidth,
|
||||
height: document.documentElement.offsetHeight
|
||||
}; // @ts-ignore: missing properties
|
||||
|
||||
onInsetsChange({
|
||||
nativeEvent: {
|
||||
insets,
|
||||
frame
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
element.addEventListener(getSupportedTransitionEvent(), onEnd);
|
||||
onEnd();
|
||||
return () => {
|
||||
document.body.removeChild(element);
|
||||
element.removeEventListener(getSupportedTransitionEvent(), onEnd);
|
||||
};
|
||||
}, [onInsetsChange]);
|
||||
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
||||
style: style
|
||||
}, children);
|
||||
}
|
||||
|
||||
let _supportedTransitionEvent = null;
|
||||
|
||||
function getSupportedTransitionEvent() {
|
||||
if (_supportedTransitionEvent !== null) {
|
||||
return _supportedTransitionEvent;
|
||||
}
|
||||
|
||||
const element = document.createElement('invalidtype');
|
||||
_supportedTransitionEvent = CSSTransitions.Transition;
|
||||
|
||||
for (const key in CSSTransitions) {
|
||||
if (element.style[key] !== undefined) {
|
||||
_supportedTransitionEvent = CSSTransitions[key];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return _supportedTransitionEvent;
|
||||
}
|
||||
|
||||
let _supportedEnv = null;
|
||||
|
||||
function getSupportedEnv() {
|
||||
if (_supportedEnv !== null) {
|
||||
return _supportedEnv;
|
||||
}
|
||||
|
||||
const {
|
||||
CSS
|
||||
} = window;
|
||||
|
||||
if (CSS && CSS.supports && CSS.supports('top: constant(safe-area-inset-top)')) {
|
||||
_supportedEnv = 'constant';
|
||||
} else {
|
||||
_supportedEnv = 'env';
|
||||
}
|
||||
|
||||
return _supportedEnv;
|
||||
}
|
||||
|
||||
function getInset(side) {
|
||||
return "".concat(getSupportedEnv(), "(safe-area-inset-").concat(side, ")");
|
||||
}
|
||||
|
||||
function createContextElement() {
|
||||
const element = document.createElement('div');
|
||||
const {
|
||||
style
|
||||
} = element;
|
||||
style.position = 'fixed';
|
||||
style.left = '0';
|
||||
style.top = '0';
|
||||
style.width = '0';
|
||||
style.height = '0';
|
||||
style.zIndex = '-1';
|
||||
style.overflow = 'hidden';
|
||||
style.visibility = 'hidden'; // Bacon: Anything faster than this and the callback will be invoked too early with the wrong insets
|
||||
|
||||
style.transitionDuration = '0.05s';
|
||||
style.transitionProperty = 'padding';
|
||||
style.transitionDelay = '0s';
|
||||
style.paddingTop = getInset('top');
|
||||
style.paddingBottom = getInset('bottom');
|
||||
style.paddingLeft = getInset('left');
|
||||
style.paddingRight = getInset('right');
|
||||
return element;
|
||||
}
|
||||
//# sourceMappingURL=NativeSafeAreaProvider.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.macos.js
generated
vendored
Normal file
12
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.macos.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _CompatNativeSafeAreaProvider = require("./CompatNativeSafeAreaProvider");
|
||||
|
||||
var _default = _CompatNativeSafeAreaProvider.CompatNativeSafeAreaProvider;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=NativeSafeAreaProvider.macos.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.macos.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.macos.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["NativeSafeAreaProvider.macos.tsx"],"names":["CompatNativeSafeAreaProvider"],"mappings":";;;;;;;AAAA;;eAEeA,0D","sourcesContent":["import { CompatNativeSafeAreaProvider } from './CompatNativeSafeAreaProvider';\n\nexport default CompatNativeSafeAreaProvider;\n"]}
|
13
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.native.js
generated
vendored
Normal file
13
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.native.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _reactNative = require("react-native");
|
||||
|
||||
var _default = (0, _reactNative.requireNativeComponent)('RNCSafeAreaProvider');
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=NativeSafeAreaProvider.native.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.native.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.native.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["NativeSafeAreaProvider.native.tsx"],"names":[],"mappings":";;;;;;;AAAA;;eAGe,yCACb,qBADa,C","sourcesContent":["import { requireNativeComponent } from 'react-native';\nimport { NativeSafeAreaProviderProps } from './SafeArea.types';\n\nexport default requireNativeComponent<NativeSafeAreaProviderProps>(\n 'RNCSafeAreaProvider',\n);\n"]}
|
12
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.windows.js
generated
vendored
Normal file
12
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.windows.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _CompatNativeSafeAreaProvider = require("./CompatNativeSafeAreaProvider");
|
||||
|
||||
var _default = _CompatNativeSafeAreaProvider.CompatNativeSafeAreaProvider;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=NativeSafeAreaProvider.windows.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.windows.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/NativeSafeAreaProvider.windows.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["NativeSafeAreaProvider.windows.tsx"],"names":["CompatNativeSafeAreaProvider"],"mappings":";;;;;;;AAAA;;eAEeA,0D","sourcesContent":["import { CompatNativeSafeAreaProvider } from './CompatNativeSafeAreaProvider';\n\nexport default CompatNativeSafeAreaProvider;\n"]}
|
2
node_modules/react-native-safe-area-context/lib/commonjs/SafeArea.types.js
generated
vendored
Normal file
2
node_modules/react-native-safe-area-context/lib/commonjs/SafeArea.types.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=SafeArea.types.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/SafeArea.types.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/SafeArea.types.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
138
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaContext.js
generated
vendored
Normal file
138
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaContext.js
generated
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.SafeAreaProvider = SafeAreaProvider;
|
||||
exports.useSafeAreaInsets = useSafeAreaInsets;
|
||||
exports.useSafeAreaFrame = useSafeAreaFrame;
|
||||
exports.withSafeAreaInsets = withSafeAreaInsets;
|
||||
exports.useSafeArea = useSafeArea;
|
||||
exports.SafeAreaContext = exports.SafeAreaConsumer = exports.SafeAreaFrameContext = exports.SafeAreaInsetsContext = void 0;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _reactNative = require("react-native");
|
||||
|
||||
var _NativeSafeAreaProvider = _interopRequireDefault(require("./NativeSafeAreaProvider"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
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); }
|
||||
|
||||
const SafeAreaInsetsContext = React.createContext(null);
|
||||
exports.SafeAreaInsetsContext = SafeAreaInsetsContext;
|
||||
const SafeAreaFrameContext = React.createContext(null);
|
||||
exports.SafeAreaFrameContext = SafeAreaFrameContext;
|
||||
|
||||
function SafeAreaProvider({
|
||||
children,
|
||||
initialMetrics,
|
||||
initialSafeAreaInsets,
|
||||
style
|
||||
}) {
|
||||
var _ref, _ref2, _initialMetrics$inset, _ref3, _initialMetrics$frame;
|
||||
|
||||
const parentInsets = useParentSafeAreaInsets();
|
||||
const parentFrame = useParentSafeAreaFrame();
|
||||
const [insets, setInsets] = React.useState((_ref = (_ref2 = (_initialMetrics$inset = initialMetrics === null || initialMetrics === void 0 ? void 0 : initialMetrics.insets) !== null && _initialMetrics$inset !== void 0 ? _initialMetrics$inset : initialSafeAreaInsets) !== null && _ref2 !== void 0 ? _ref2 : parentInsets) !== null && _ref !== void 0 ? _ref : null);
|
||||
const [frame, setFrame] = React.useState((_ref3 = (_initialMetrics$frame = initialMetrics === null || initialMetrics === void 0 ? void 0 : initialMetrics.frame) !== null && _initialMetrics$frame !== void 0 ? _initialMetrics$frame : parentFrame) !== null && _ref3 !== void 0 ? _ref3 : {
|
||||
// Backwards compat so we render anyway if we don't have frame.
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: _reactNative.Dimensions.get('window').width,
|
||||
height: _reactNative.Dimensions.get('window').height
|
||||
});
|
||||
const onInsetsChange = React.useCallback(event => {
|
||||
const {
|
||||
nativeEvent: {
|
||||
frame: nextFrame,
|
||||
insets: nextInsets
|
||||
}
|
||||
} = event;
|
||||
|
||||
if ( // Backwards compat with old native code that won't send frame.
|
||||
nextFrame && (nextFrame.height !== frame.height || nextFrame.width !== frame.width || nextFrame.x !== frame.x || nextFrame.y !== frame.y)) {
|
||||
setFrame(nextFrame);
|
||||
}
|
||||
|
||||
if (!insets || nextInsets.bottom !== insets.bottom || nextInsets.left !== insets.left || nextInsets.right !== insets.right || nextInsets.top !== insets.top) {
|
||||
setInsets(nextInsets);
|
||||
}
|
||||
}, [frame, insets]);
|
||||
return /*#__PURE__*/React.createElement(_NativeSafeAreaProvider.default, {
|
||||
style: [styles.fill, style],
|
||||
onInsetsChange: onInsetsChange
|
||||
}, insets != null ? /*#__PURE__*/React.createElement(SafeAreaFrameContext.Provider, {
|
||||
value: frame
|
||||
}, /*#__PURE__*/React.createElement(SafeAreaInsetsContext.Provider, {
|
||||
value: insets
|
||||
}, children)) : null);
|
||||
}
|
||||
|
||||
const styles = _reactNative.StyleSheet.create({
|
||||
fill: {
|
||||
flex: 1
|
||||
}
|
||||
});
|
||||
|
||||
function useParentSafeAreaInsets() {
|
||||
return React.useContext(SafeAreaInsetsContext);
|
||||
}
|
||||
|
||||
function useParentSafeAreaFrame() {
|
||||
return React.useContext(SafeAreaFrameContext);
|
||||
}
|
||||
|
||||
function useSafeAreaInsets() {
|
||||
const safeArea = React.useContext(SafeAreaInsetsContext);
|
||||
|
||||
if (safeArea == null) {
|
||||
throw new Error('No safe area insets value available. Make sure you are rendering `<SafeAreaProvider>` at the top of your app.');
|
||||
}
|
||||
|
||||
return safeArea;
|
||||
}
|
||||
|
||||
function useSafeAreaFrame() {
|
||||
const frame = React.useContext(SafeAreaFrameContext);
|
||||
|
||||
if (frame == null) {
|
||||
throw new Error('No safe area frame value available. Make sure you are rendering `<SafeAreaProvider>` at the top of your app.');
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
function withSafeAreaInsets(WrappedComponent) {
|
||||
return /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(SafeAreaConsumer, null, insets => /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, {
|
||||
insets: insets,
|
||||
ref: ref
|
||||
}))));
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
|
||||
function useSafeArea() {
|
||||
return useSafeAreaInsets();
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
|
||||
const SafeAreaConsumer = SafeAreaInsetsContext.Consumer;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
exports.SafeAreaConsumer = SafeAreaConsumer;
|
||||
const SafeAreaContext = SafeAreaInsetsContext;
|
||||
exports.SafeAreaContext = SafeAreaContext;
|
||||
//# sourceMappingURL=SafeAreaContext.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaContext.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaContext.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
97
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.js
generated
vendored
Normal file
97
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.SafeAreaView = SafeAreaView;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _reactNative = require("react-native");
|
||||
|
||||
var _SafeAreaContext = require("./SafeAreaContext");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
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); }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
// prettier-ignore
|
||||
const TOP = 0b1000,
|
||||
RIGHT = 0b0100,
|
||||
BOTTOM = 0b0010,
|
||||
LEFT = 0b0001,
|
||||
ALL = 0b1111;
|
||||
/* eslint-disable no-bitwise */
|
||||
|
||||
const edgeBitmaskMap = {
|
||||
top: TOP,
|
||||
right: RIGHT,
|
||||
bottom: BOTTOM,
|
||||
left: LEFT
|
||||
};
|
||||
|
||||
function SafeAreaView(_ref) {
|
||||
let {
|
||||
style = {},
|
||||
mode,
|
||||
edges
|
||||
} = _ref,
|
||||
rest = _objectWithoutProperties(_ref, ["style", "mode", "edges"]);
|
||||
|
||||
const insets = (0, _SafeAreaContext.useSafeAreaInsets)();
|
||||
const edgeBitmask = edges != null ? edges.reduce((accum, edge) => accum | edgeBitmaskMap[edge], 0) : ALL;
|
||||
const appliedStyle = React.useMemo(() => {
|
||||
const insetTop = edgeBitmask & TOP ? insets.top : 0;
|
||||
const insetRight = edgeBitmask & RIGHT ? insets.right : 0;
|
||||
const insetBottom = edgeBitmask & BOTTOM ? insets.bottom : 0;
|
||||
const insetLeft = edgeBitmask & LEFT ? insets.left : 0;
|
||||
|
||||
const flatStyle = _reactNative.StyleSheet.flatten(style);
|
||||
|
||||
if (mode === 'margin') {
|
||||
const {
|
||||
margin = 0,
|
||||
marginVertical = margin,
|
||||
marginHorizontal = margin,
|
||||
marginTop = marginVertical,
|
||||
marginRight = marginHorizontal,
|
||||
marginBottom = marginVertical,
|
||||
marginLeft = marginHorizontal
|
||||
} = flatStyle;
|
||||
const marginStyle = {
|
||||
marginTop: marginTop + insetTop,
|
||||
marginRight: marginRight + insetRight,
|
||||
marginBottom: marginBottom + insetBottom,
|
||||
marginLeft: marginLeft + insetLeft
|
||||
};
|
||||
return [style, marginStyle];
|
||||
} else {
|
||||
const {
|
||||
padding = 0,
|
||||
paddingVertical = padding,
|
||||
paddingHorizontal = padding,
|
||||
paddingTop = paddingVertical,
|
||||
paddingRight = paddingHorizontal,
|
||||
paddingBottom = paddingVertical,
|
||||
paddingLeft = paddingHorizontal
|
||||
} = flatStyle;
|
||||
const paddingStyle = {
|
||||
paddingTop: paddingTop + insetTop,
|
||||
paddingRight: paddingRight + insetRight,
|
||||
paddingBottom: paddingBottom + insetBottom,
|
||||
paddingLeft: paddingLeft + insetLeft
|
||||
};
|
||||
return [style, paddingStyle];
|
||||
}
|
||||
}, [style, insets, mode, edgeBitmask]);
|
||||
return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
|
||||
style: appliedStyle
|
||||
}, rest));
|
||||
}
|
||||
//# sourceMappingURL=SafeAreaView.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.macos.js
generated
vendored
Normal file
12
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.macos.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.SafeAreaView = void 0;
|
||||
|
||||
var _reactNative = require("react-native");
|
||||
|
||||
const SafeAreaView = _reactNative.View;
|
||||
exports.SafeAreaView = SafeAreaView;
|
||||
//# sourceMappingURL=SafeAreaView.macos.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.macos.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.macos.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["SafeAreaView.macos.tsx"],"names":["SafeAreaView","View"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,YAAY,GAAGC,iBAArB","sourcesContent":["import { View } from 'react-native';\n\nexport const SafeAreaView = View;\n"]}
|
12
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.native.js
generated
vendored
Normal file
12
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.native.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.SafeAreaView = void 0;
|
||||
|
||||
var _reactNative = require("react-native");
|
||||
|
||||
const SafeAreaView = (0, _reactNative.requireNativeComponent)('RNCSafeAreaView');
|
||||
exports.SafeAreaView = SafeAreaView;
|
||||
//# sourceMappingURL=SafeAreaView.native.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.native.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.native.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["SafeAreaView.native.tsx"],"names":["SafeAreaView"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,YAAY,GAAG,yCAC1B,iBAD0B,CAArB","sourcesContent":["import { requireNativeComponent } from 'react-native';\nimport { NativeSafeAreaViewProps } from './SafeArea.types';\n\nexport const SafeAreaView = requireNativeComponent<NativeSafeAreaViewProps>(\n 'RNCSafeAreaView',\n);\n"]}
|
12
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.windows.js
generated
vendored
Normal file
12
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.windows.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.SafeAreaView = void 0;
|
||||
|
||||
var _reactNative = require("react-native");
|
||||
|
||||
const SafeAreaView = _reactNative.View;
|
||||
exports.SafeAreaView = SafeAreaView;
|
||||
//# sourceMappingURL=SafeAreaView.windows.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.windows.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.windows.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["SafeAreaView.windows.tsx"],"names":["SafeAreaView","View"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,YAAY,GAAGC,iBAArB","sourcesContent":["import { View } from 'react-native';\n\nexport const SafeAreaView = View;\n"]}
|
54
node_modules/react-native-safe-area-context/lib/commonjs/index.js
generated
vendored
Normal file
54
node_modules/react-native-safe-area-context/lib/commonjs/index.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _SafeAreaContext = require("./SafeAreaContext");
|
||||
|
||||
Object.keys(_SafeAreaContext).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _SafeAreaContext[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _SafeAreaView = require("./SafeAreaView");
|
||||
|
||||
Object.keys(_SafeAreaView).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _SafeAreaView[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _InitialWindow = require("./InitialWindow");
|
||||
|
||||
Object.keys(_InitialWindow).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _InitialWindow[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _SafeArea = require("./SafeArea.types");
|
||||
|
||||
Object.keys(_SafeArea).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _SafeArea[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/index.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './SafeAreaContext';\nexport * from './SafeAreaView';\nexport * from './InitialWindow';\nexport * from './SafeArea.types';\n"]}
|
39
node_modules/react-native-safe-area-context/lib/commonjs/useWindowDimensions.js
generated
vendored
Normal file
39
node_modules/react-native-safe-area-context/lib/commonjs/useWindowDimensions.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = useWindowDimensions;
|
||||
|
||||
var _reactNative = require("react-native");
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
// Copied from https://github.com/facebook/react-native/blob/8d57691a/Libraries/Utilities/useWindowDimensions.js
|
||||
// for compatibility with React Native < 0.61.
|
||||
function useWindowDimensions() {
|
||||
const [dimensions, setDimensions] = (0, _react.useState)(() => _reactNative.Dimensions.get('window'));
|
||||
(0, _react.useEffect)(() => {
|
||||
function handleChange({
|
||||
window
|
||||
}) {
|
||||
if (dimensions.width !== window.width || dimensions.height !== window.height || dimensions.scale !== window.scale || dimensions.fontScale !== window.fontScale) {
|
||||
setDimensions(window);
|
||||
}
|
||||
}
|
||||
|
||||
_reactNative.Dimensions.addEventListener('change', handleChange); // We might have missed an update between calling `get` in render and
|
||||
// `addEventListener` in this handler, so we set it here. If there was
|
||||
// no change, React will filter out this update as a no-op.
|
||||
|
||||
|
||||
handleChange({
|
||||
window: _reactNative.Dimensions.get('window')
|
||||
});
|
||||
return () => {
|
||||
_reactNative.Dimensions.removeEventListener('change', handleChange);
|
||||
};
|
||||
}, [dimensions]);
|
||||
return dimensions;
|
||||
}
|
||||
//# sourceMappingURL=useWindowDimensions.js.map
|
1
node_modules/react-native-safe-area-context/lib/commonjs/useWindowDimensions.js.map
generated
vendored
Normal file
1
node_modules/react-native-safe-area-context/lib/commonjs/useWindowDimensions.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["useWindowDimensions.tsx"],"names":["useWindowDimensions","dimensions","setDimensions","Dimensions","get","handleChange","window","width","height","scale","fontScale","addEventListener","removeEventListener"],"mappings":";;;;;;;AAAA;;AACA;;AASA;AACA;AACe,SAASA,mBAAT,GAA+C;AAC5D,QAAM,CAACC,UAAD,EAAaC,aAAb,IAA8B,qBAAS,MAAMC,wBAAWC,GAAX,CAAe,QAAf,CAAf,CAApC;AACA,wBAAU,MAAM;AACd,aAASC,YAAT,CAAsB;AAAEC,MAAAA;AAAF,KAAtB,EAA8D;AAC5D,UACEL,UAAU,CAACM,KAAX,KAAqBD,MAAM,CAACC,KAA5B,IACAN,UAAU,CAACO,MAAX,KAAsBF,MAAM,CAACE,MAD7B,IAEAP,UAAU,CAACQ,KAAX,KAAqBH,MAAM,CAACG,KAF5B,IAGAR,UAAU,CAACS,SAAX,KAAyBJ,MAAM,CAACI,SAJlC,EAKE;AACAR,QAAAA,aAAa,CAACI,MAAD,CAAb;AACD;AACF;;AACDH,4BAAWQ,gBAAX,CAA4B,QAA5B,EAAsCN,YAAtC,EAXc,CAYd;AACA;AACA;;;AACAA,IAAAA,YAAY,CAAC;AAAEC,MAAAA,MAAM,EAAEH,wBAAWC,GAAX,CAAe,QAAf;AAAV,KAAD,CAAZ;AACA,WAAO,MAAM;AACXD,8BAAWS,mBAAX,CAA+B,QAA/B,EAAyCP,YAAzC;AACD,KAFD;AAGD,GAnBD,EAmBG,CAACJ,UAAD,CAnBH;AAoBA,SAAOA,UAAP;AACD","sourcesContent":["import { Dimensions } from 'react-native';\nimport { useEffect, useState } from 'react';\n\ntype DisplayMetrics = {\n width: number;\n height: number;\n scale: number;\n fontScale: number;\n};\n\n// Copied from https://github.com/facebook/react-native/blob/8d57691a/Libraries/Utilities/useWindowDimensions.js\n// for compatibility with React Native < 0.61.\nexport default function useWindowDimensions(): DisplayMetrics {\n const [dimensions, setDimensions] = useState(() => Dimensions.get('window'));\n useEffect(() => {\n function handleChange({ window }: { window: DisplayMetrics }) {\n if (\n dimensions.width !== window.width ||\n dimensions.height !== window.height ||\n dimensions.scale !== window.scale ||\n dimensions.fontScale !== window.fontScale\n ) {\n setDimensions(window);\n }\n }\n Dimensions.addEventListener('change', handleChange);\n // We might have missed an update between calling `get` in render and\n // `addEventListener` in this handler, so we set it here. If there was\n // no change, React will filter out this update as a no-op.\n handleChange({ window: Dimensions.get('window') });\n return () => {\n Dimensions.removeEventListener('change', handleChange);\n };\n }, [dimensions]);\n return dimensions;\n}\n"]}
|
Reference in New Issue
Block a user