Activity indicator

<activity-indicator> is a spinner: ActivityIndicatorView on iOS, AndroidProgressBar on Android.

Import
import { ActivityIndicator } from '@ng-native/components';
Template
<activity-indicator> once ActivityIndicator is in the component's imports
<activity-indicator size="large" color="#3a82f6" [animating]="loading()" />

size is 'small' (the default, matching React Native's 20 points), 'large' (36 points), or a number to set both dimensions at once. animating (default true) starts and stops it, and hidesWhenStopped (iOS) hides the spinner entirely rather than leaving a still one on screen while stopped.

Why it carries an explicit size

The native view has no intrinsic dimensions of its own: without a size, it stretches to fill whatever space its parent offers. That failure is invisible in the obvious way, because the spinner still draws at its natural size in the middle of the stretched box - but the box swallows gestures across its whole width, so a tap that should have landed on something else next to it does not. <activity-indicator> always sends an explicit width and height so this never happens.

Android

Android's AndroidProgressBar has no default drawable and throws out of its own update pass if the first commit arrives without one, taking the whole screen down with it - so styleAttr ('Normal', for every size, matching what React Native's own wrapper sends) and indeterminate (true) are always sent on Android. Neither reaches iOS, where ActivityIndicatorView has no equivalent props.

activity-indicatordirective@ng-native/components
import { ActivityIndicator } from '@ng-native/components';and add ActivityIndicator to the component's imports

A spinner. Commits as ActivityIndicatorView on iOS and AndroidProgressBar on Android.

Inputs

size
'small' | 'large' | number = 'small'

small and large match RN's 20 and 36 points; a number sets both dimensions.

animating
unknown

Whether the spinner turns. Defaults to true.

color
string

The spinner's colour.

hidesWhenStopped
unknown

iOS: hide the spinner when animating is false rather than showing it still.

Angular components as native iOS and Android views, built and shipped with Expo.

An alpha. MIT licensed. Sponsor its development.

An independent project, not affiliated with or endorsed by Google, the Angular team or Expo. Angular is a trademark of Google LLC.