UIPackage React Native
Search

Spinner

Themed native ActivityIndicator with overridable label, color, size, and busy state.

Install

First install? Set up the registry in your app.

npx --yes --package=https://native.uipkge.dev/cli/uipkge-native-0.1.1.tgz uipkge-native add spinner

Source files

Expand a file to read the source the installer copies into your app.

components/ui/spinner/Spinner.tsx
import * as React from 'react'
import { ActivityIndicator, type ActivityIndicatorProps } from 'react-native'
import { useThemeColors } from '@/lib/theme'

export interface SpinnerProps extends ActivityIndicatorProps {
  className?: string
}

export const Spinner = React.forwardRef<React.ComponentRef<typeof ActivityIndicator>, SpinnerProps>(
  ({ color, animating = true, accessibilityLabel = 'Loading', accessibilityState, ...props }, ref) => {
    const colors = useThemeColors()
    return (
      <ActivityIndicator
        ref={ref}
        accessibilityRole="progressbar"
        {...props}
        animating={animating}
        color={color ?? colors.primary}
        accessibilityLabel={accessibilityLabel}
        accessibilityState={{ ...accessibilityState, busy: animating }}
      />
    )
  },
)
Spinner.displayName = 'Spinner'
components/ui/spinner/index.ts
export * from './Spinner'
Browse overlays and feedback