UNPKG

@wordpress/components

Version:
42 lines (37 loc) 1.23 kB
import { createElement, Fragment } from "@wordpress/element"; /** * External dependencies */ import { SafeAreaView } from 'react-native'; /** * WordPress dependencies */ import { Children, useEffect, useContext } from '@wordpress/element'; import { createSlotFill, BottomSheetContext } from '@wordpress/components'; const { Fill, Slot } = createSlotFill('BottomSheetSubSheet'); const BottomSheetSubSheet = _ref => { let { children, navigationButton, showSheet, isFullScreen } = _ref; const { setIsFullScreen } = useContext(BottomSheetContext); useEffect(() => { if (showSheet) { setIsFullScreen(isFullScreen); } // Disable reason: deferring this refactor to the native team. // see https://github.com/WordPress/gutenberg/pull/41166 // eslint-disable-next-line react-hooks/exhaustive-deps }, [showSheet, isFullScreen]); return createElement(Fragment, null, showSheet && createElement(Fill, null, createElement(SafeAreaView, null, children)), Children.count(children) > 0 && navigationButton); }; BottomSheetSubSheet.Slot = Slot; BottomSheetSubSheet.screenName = 'BottomSheetSubSheet'; export default BottomSheetSubSheet; //# sourceMappingURL=index.native.js.map