UNPKG

expo-router

Version:

Expo Router is a file-based router for React Native and web applications.

83 lines (81 loc) • 2.68 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "getInitialURLWithTimeout", { enumerable: true, get: function() { return getInitialURLWithTimeout; } }); function _expolinking() { const data = /*#__PURE__*/ _interop_require_wildcard(require("expo-linking")); _expolinking = function() { return data; }; return data; } function _reactnative() { const data = require("react-native"); _reactnative = function() { return data; }; return data; } function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interop_require_wildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = { __proto__: null }; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for(var key in obj){ if (key !== "default" && 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 getInitialURLWithTimeout() { if (typeof window === 'undefined') { return ''; } else if (_reactnative().Platform.OS === 'ios') { // Use the new Expo API for iOS. This has better support for App Clips and handoff. return _expolinking().getLinkingURL(); } return Promise.race([ // TODO: Phase this out in favor of expo-linking on Android. _reactnative().Linking.getInitialURL(), new Promise((resolve)=>// Timeout in 150ms if `getInitialState` doesn't resolve // Workaround for https://github.com/facebook/react-native/issues/25675 setTimeout(()=>resolve(null), 150)) ]); } //# sourceMappingURL=getInitialURLWithTimeout.js.map