// withHooks

import { LibIcon } from 'esoftplay/cache/lib/icon/import';
import { LibStyle } from 'esoftplay/cache/lib/style/import';
import useSafeState from 'esoftplay/state';
import React from 'react';
import { TouchableOpacity, View } from 'react-native';


export interface EventExpanderArgs {

}
export interface EventExpanderProps {
  style?: any,
  children?: any,
  minHeight?: number,
  defaultExpandStatus?: boolean
}
export default function m(props: EventExpanderProps): any {
  const [expand, setExpand] = useSafeState(!!props.defaultExpandStatus)
  const minHeight = props.minHeight || 80
  return (
    <View style={props.style} >
      <View style={{ maxHeight: expand ? undefined : minHeight, overflow: 'hidden' }} >
        {props.children}
      </View>
      {
        props?.children?.props?.children?.length > 6 &&
        <TouchableOpacity activeOpacity={1} onPress={() => setExpand((x) => !x)} style={styleId_ZvFdlx} >
          <LibIcon.SimpleLineIcons name={expand ? "arrow-up" : "arrow-down"} color={LibStyle.colorPrimary} size={16} />
        </TouchableOpacity>
      }
    </View>
  )
}
const styleId_ZvFdlx: any = { height: 40, alignItems: 'center', justifyContent: 'center', backgroundColor: 'white' }