clauderic / react-sortable-hoc

A set of higher-order components to turn any list into an animated, accessible and touch-friendly sortable list✌️
https://clauderic.github.io/react-sortable-hoc/
MIT License
10.77k stars 978 forks source link

Uncaught TypeError: cannot call a class as a function #847

Open kongjeey opened 2 years ago

kongjeey commented 2 years ago

When I change code, and the app re-renders, it always crashes with this error message: Uncaught TypeError: cannot call a class as a function I'm not sure why it's happening. Basically, this is what I have...

      const SortableCont = SortableContainer(({ children }: any) => <div>{children}</div>);
      const SortableItem = SortableElement((props: any) => <ButtonTypeVariations {...props} />);

      return (
          ....
         <SortableCont
            onSortOver={sortActionButtonList}
            lockToContainerEdges={true}
            axis="y"
            lockAxis="y"
            lockOffset={['5%', '5%']}
            useDragHandle={true}
         >
        {actionButtonList.map((value: any, index: number) => 
           <SortableItem key={`item-${index}`} index={index} value={{ ...value, index }} />
        )}
      </SortableCont>
    )}

Screen Shot 2022-07-12 at 3 10 11 AM

mateBe95 commented 1 year ago

bump