/**
 * External dependencies
 */
import { SafeAreaView } from 'react-native';

/**
 * WordPress dependencies
 */
import { Children, useEffect, useContext } from '@wordpress/element';

/**
 * Internal dependencies
 */
import { BottomSheetContext } from '../bottom-sheet-context';
import { createSlotFill } from '../../../slot-fill';
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
const {
  Fill,
  Slot
} = createSlotFill('BottomSheetSubSheet');
const BottomSheetSubSheet = ({
  children,
  navigationButton,
  showSheet,
  isFullScreen
}) => {
  const {
    setIsFullScreen
  } = useContext(BottomSheetContext);
  useEffect(() => {
    if (showSheet) {
      setIsFullScreen(isFullScreen);
    }
    // See https://github.com/WordPress/gutenberg/pull/41166
  }, [showSheet, isFullScreen]);
  return /*#__PURE__*/_jsxs(_Fragment, {
    children: [showSheet && /*#__PURE__*/_jsx(Fill, {
      children: /*#__PURE__*/_jsx(SafeAreaView, {
        children: children
      })
    }), Children.count(children) > 0 && navigationButton]
  });
};
BottomSheetSubSheet.Slot = Slot;
BottomSheetSubSheet.screenName = 'BottomSheetSubSheet';
export default BottomSheetSubSheet;
//# sourceMappingURL=index.native.js.map