import { ScrollView, View } from '@tarojs/components';

import type { PropsWithChildren } from 'react';
import type { MlBaseFormListProps } from './types';

export function Body({ formListData, children }: PropsWithChildren<Pick<MlBaseFormListProps, 'formListData'>>) {
  return (
    <View className="flex-1 min-h-0 flex flex-col divide-y gap-y-1">
      {formListData.length > 0 ? (
        <ScrollView
          className="h-full w-full"
          enhanced
          // @ts-expect-error TODO: Taro type error
          trapScroll
          bounces={false}
          showScrollbar={false}
          scrollY
          scrollWithAnimation
        >
          {children}
        </ScrollView>
      ) : (
        <View>empty</View>
      )}
    </View>
  );
}
