import { View } from "react-native";
import { WidgetViewRendererProps } from "../../App/common/interface/components";
import BaseWidget from "../widgets/BaseWidget";

const WidgetViewRenderer = ({
  widgetList,
  handleActions,
  screenState,
  handleClick,
  pointerEvents,
}: WidgetViewRendererProps) => {
  return (
    <View pointerEvents={pointerEvents || "auto"}>
      {widgetList?.map((widget, index) => {
        return (
          <BaseWidget
            widget={widget}
            handleScreenActions={handleActions}
            screenState={screenState}
            widgetIndex={index}
            key={index}
            handleClick={handleClick}
          />
        );
      })}
    </View>
  );
};

export default WidgetViewRenderer;
