Skip to main content
Displays a circular loading indicator.

Example

import React from 'react';
import { ActivityIndicator, StyleSheet, View } from 'react-native';

const App = () => (
  <View style={[styles.container, styles.horizontal]}>
    <ActivityIndicator />
    <ActivityIndicator size="large" />
    <ActivityIndicator size="small" color="#0000ff" />
    <ActivityIndicator size="large" color="#00ff00" />
  </View>
);

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
  },
  horizontal: {
    flexDirection: 'row',
    justifyContent: 'space-around',
    padding: 10,
  },
});

export default App;

Props

animating
boolean
default:true
Whether to show the indicator (true) or hide it (false).
color
ColorValue
The foreground color of the spinner.Default: #999999 on iOS, system accent color on Android
size
'small' | 'large' | number
default:"'small'"
Size of the indicator.
  • 'small' - Small size indicator
  • 'large' - Large size indicator
  • number - Exact size in pixels (Android only)
Platform: number type is Android only
hidesWhenStopped
boolean
default:true
Whether the indicator should hide when not animating.Platform: iOS

Platform Differences

iOS

  • Uses a native spinner with smooth animation
  • Supports hidesWhenStopped prop
  • Default color is gray (#999999)
  • Size options are 'small' (20x20) and 'large' (36x36)

Android

  • Uses ProgressBarAndroid under the hood
  • Default color is the system accent color
  • Size can be 'small', 'large', or a specific number in pixels
  • Always visible when rendered (doesn’t support hidesWhenStopped)

Usage with Loading States

import React, { useState, useEffect } from 'react';
import { ActivityIndicator, View, Text } from 'react-native';

const LoadingData = () => {
  const [loading, setLoading] = useState(true);
  const [data, setData] = useState(null);

  useEffect(() => {
    fetchData().then(result => {
      setData(result);
      setLoading(false);
    });
  }, []);

  if (loading) {
    return (
      <View style={{ flex: 1, justifyContent: 'center' }}>
        <ActivityIndicator size="large" color="#0000ff" />
      </View>
    );
  }

  return <Text>{data}</Text>;
};

Accessibility

ActivityIndicator inherits accessibility props from View, including:
  • accessibilityLabel - Describes the loading state to screen readers
  • accessibilityHint - Provides additional context
  • accessible - Whether the element is an accessibility element

Build docs developers (and LLMs) love