navigation-react-native-web
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -174,40 +174,6 @@ 'use strict'; | ||
/** | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2021 Software Mansion | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
const infiniteThenable = { then: () => { } }; | ||
var Suspender = ({ freeze, children }) => { | ||
var promiseCache = React.useRef ? React.useRef({}).current : {}; | ||
if (freeze && !promiseCache.promise) { | ||
promiseCache.promise = new Promise((resolve) => { | ||
promiseCache.resolve = resolve; | ||
}); | ||
throw promiseCache.promise; | ||
} | ||
else if (freeze) { | ||
throw promiseCache.promise; | ||
} | ||
else if (promiseCache.promise) { | ||
promiseCache.resolve(); | ||
promiseCache.promise = undefined; | ||
} | ||
if (freeze) | ||
throw infiniteThenable; | ||
return children; | ||
@@ -259,3 +225,37 @@ }; | ||
var BottomSheet = () => null; | ||
const Sheet = ({ detent, defaultDetent = 'collapsed', modal = true, onChangeDetent, children }) => { | ||
const [selectedDetent, setSelectedDetent] = React.useState(detent || defaultDetent); | ||
const dialogEl = React.useRef(null); | ||
if (detent != null && detent !== selectedDetent) | ||
setSelectedDetent(detent); | ||
React.useEffect(() => { | ||
if (selectedDetent !== 'hidden') { | ||
if (modal) | ||
dialogEl.current.showModal(); | ||
else | ||
dialogEl.current.show(); | ||
} | ||
else { | ||
dialogEl.current.close(); | ||
} | ||
}, [selectedDetent, modal]); | ||
const onClose = () => { | ||
if (selectedDetent !== 'hidden') { | ||
if (detent == null) | ||
setSelectedDetent('hidden'); | ||
if (!!onChangeDetent) | ||
onChangeDetent('hidden'); | ||
} | ||
}; | ||
return (React__default.createElement("dialog", { key: '' + modal, ref: dialogEl, onClose: onClose, style: { | ||
display: selectedDetent !== 'hidden' ? 'flex' : 'none', | ||
backgroundColor: 'transparent', | ||
width: '100%', | ||
height: '100%', | ||
border: 0, | ||
padding: 0, | ||
zIndex: 54, | ||
} }, children)); | ||
}; | ||
const BottomSheet = Sheet; | ||
@@ -305,2 +305,3 @@ var FloatingActionButton = () => null; | ||
exports.SharedElement = SharedEl; | ||
exports.Sheet = Sheet; | ||
exports.StatusBar = StatusBar; | ||
@@ -307,0 +308,0 @@ exports.TabBar = TabBar; |
{ | ||
"name": "navigation-react-native-web", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "React Native Web plugin for the Navigation router", | ||
@@ -9,3 +9,3 @@ "main": "navigation.react.native.web.js", | ||
"type": "git", | ||
"url": "https://github.com/grahammendick/navigation" | ||
"url": "git+https://github.com/grahammendick/navigation.git" | ||
}, | ||
@@ -12,0 +12,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
372
19261