Back to React Native

ActivityIndicator

website/versioned_docs/version-0.79/activityindicator.md

latest2.2 KB
Original Source

Displays a circular loading indicator.

Example

SnackPlayer
import React from 'react';
import {ActivityIndicator, StyleSheet} from 'react-native';
import {SafeAreaView, SafeAreaProvider} from 'react-native-safe-area-context';

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

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

export default App;

Reference

Props

View Props

Inherits View Props.


animating

Whether to show the indicator (true) or hide it (false).

TypeDefault
booltrue

color

The foreground color of the spinner.

TypeDefault
colornull (system accent default color)<div className="label android">Android</div><hr/><ins style={{background: '#999'}} className="color-box" />'#999999' <div className="label ios">iOS</div>

hidesWhenStopped <div className="label ios">iOS</div>

Whether the indicator should hide when not animating.

TypeDefault
booltrue

size

Size of the indicator.

TypeDefault
enum('small', 'large')<hr/>number <div className="label android">Android</div>'small'