廓形仪rn版本-技术调研
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.

40 lines
870 B

  1. 'use client';
  2. import { ActivityIndicator } from 'react-native';
  3. import React from 'react';
  4. import { tva } from '@gluestack-ui/nativewind-utils/tva';
  5. import { cssInterop } from 'nativewind';
  6. cssInterop(ActivityIndicator, {
  7. className: { target: 'style', nativeStyleToProp: { color: true } },
  8. });
  9. const spinnerStyle = tva({});
  10. const Spinner = React.forwardRef<
  11. React.ComponentRef<typeof ActivityIndicator>,
  12. React.ComponentProps<typeof ActivityIndicator>
  13. >(function Spinner(
  14. {
  15. className,
  16. color,
  17. focusable = false,
  18. 'aria-label': ariaLabel = 'loading',
  19. ...props
  20. },
  21. ref
  22. ) {
  23. return (
  24. <ActivityIndicator
  25. ref={ref}
  26. focusable={focusable}
  27. aria-label={ariaLabel}
  28. {...props}
  29. color={color}
  30. className={spinnerStyle({ class: className })}
  31. />
  32. );
  33. });
  34. Spinner.displayName = 'Spinner';
  35. export { Spinner };