import { Dimensions, SafeAreaView, StyleSheet, View } from 'react-native';
export let SlotFixedLocation = /*#__PURE__*/function (SlotFixedLocation) {
  SlotFixedLocation["rightBottom"] = "rightBottom";
  SlotFixedLocation["rightTop"] = "rightTop";
  SlotFixedLocation["leftBottom"] = "leftBottom";
  SlotFixedLocation["leftTop"] = "leftTop";
  SlotFixedLocation["bottomCenter"] = "bottomCenter";
  SlotFixedLocation["topCenter"] = "topCenter";
  return SlotFixedLocation;
}({});
const {
  width: windowWidth,
  height: windowHeight
} = Dimensions.get('window');
export const SlotFixedStylesConfig = {
  rightBottom: {
    right: 4,
    bottom: 4
  },
  rightTop: {
    top: 4,
    right: 4
  },
  leftBottom: {
    left: 4,
    bottom: 4
  },
  leftTop: {
    left: 4,
    top: 4
  },
  bottomCenter: {
    left: 0,
    bottom: 0
  },
  topCenter: {
    left: 0,
    top: 0
  }
};
export function pickSlotPosition(slot) {
  return SlotFixedStylesConfig[slot] || SlotFixedStylesConfig.rightTop;
}
/**
 * 插槽的定义：样式和位置已经固定，只能从已经定义好的样式中选择进行
 * 1、插槽固定以后，只能修改插槽定义的位置信息：
 * 例如：rightTop 修改的属性是 right/top/maxHeight/height/width/maxWidth
 * 2、为确保Slot中的组件按照顺序排列，Slot 需要给children遍历套一层View固定（可选，先不实现）
 *  @component
 *
 * @param props
 * @returns
 */
export function Slot(props) {
  const {
    children,
    slot,
    width = 0.2,
    height = 0.35,
    backgroundColor = 'white',
    style = {}
  } = props;

  // TODO： 重构样式计算方式，支持更多的样式配置写入
  const styles = StyleSheet.create({
    container: {
      flex: 1,
      position: 'absolute',
      maxHeight: windowHeight * 0.5,
      height: windowHeight * height,
      width: windowWidth * width,
      maxWidth: windowWidth * 0.4,
      flexDirection: 'column',
      backgroundColor,
      ...pickSlotPosition(slot),
      ...style
    },
    scrollView: {
      flex: 1,
      flexDirection: 'column'
    }
  });
  return /*#__PURE__*/React.createElement(SafeAreaView, {
    style: styles.container
  }, /*#__PURE__*/React.createElement(View, {
    style: styles.scrollView
  }, children));
}
export default Slot;
//# sourceMappingURL=SlotOlderVersion.js.map