Application Android et IOS pour l'amicale des élèves
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

withCollapsible.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import React from 'react';
  2. import {useCollapsibleStack} from "react-navigation-collapsible";
  3. /**
  4. * Function used to manipulate Collapsible Hooks from a class.
  5. *
  6. * Usage :
  7. *
  8. * export withCollapsible(Component)
  9. *
  10. * replacing Component with the one you want to use.
  11. * This component will then receive the collapsibleStack prop.
  12. *
  13. * @param Component The component to use Collapsible with
  14. * @returns {React.ComponentType<React.ClassAttributes<unknown>>}
  15. */
  16. export const withCollapsible = (Component: any) => {
  17. return React.forwardRef((props: any, ref: any) => {
  18. const {
  19. onScroll,
  20. onScrollWithListener,
  21. containerPaddingTop,
  22. scrollIndicatorInsetTop,
  23. translateY,
  24. progress,
  25. opacity,
  26. } = useCollapsibleStack();
  27. return <Component
  28. collapsibleStack={{
  29. onScroll,
  30. onScrollWithListener,
  31. containerPaddingTop: containerPaddingTop,
  32. scrollIndicatorInsetTop: scrollIndicatorInsetTop,
  33. translateY,
  34. progress,
  35. opacity,
  36. }}
  37. ref={ref}
  38. {...props}
  39. />;
  40. });
  41. };