Skip to main content

LoadingOverlay

The LoadingOverlay component displays a full-screen loading indicator with an optional backdrop. It's perfect for showing loading states during asynchronous operations like API calls or data processing.

It provides:

  • Full-screen loading indicator with transparent backdrop
  • Customizable spinner size and status colors
  • Backdrop styling options
  • Auto-dismissible after operations complete

Usage Playground

Show Component
Visible
Size
small
medium
large
Label
Code Snippet
import { LoadingOverlay } from "@react-native-blossom-ui/overlays";

function Usage() {
return (
<LoadingOverlay/>
);
}

Usage

The basic usage shows a loading spinner with a transparent backdrop. The overlay is typically displayed during asynchronous operations and dismissed when the operation completes.

Show Loading Overlay
function LoadingOverlayUsage() {
const [visible, setVisible] = useState(false)

const showLoading = () => {
setVisible(true)
setTimeout(() => setVisible(false), 2000)
}

return (
<View>
<Button onPress={showLoading}>Show Loading Overlay</Button>
<LoadingOverlay visible={visible} />
</View>
)
}

Custom

Customize the loading overlay with different spinner sizes, status colors, and backdrop styles. You can adjust the backdrop opacity and color to match your app's design.

Custom Loading Overlay
function LoadingOverlayCustom() {
const [visible, setVisible] = useState(false)

const showLoading = () => {
setVisible(true)
setTimeout(() => setVisible(false), 3000)
}

return (
<View>
<Button onPress={showLoading}>Custom Loading Overlay</Button>
<LoadingOverlay
visible={visible}
size={80}
status="error"
backdropStyle={{
backgroundColor: 'rgba(100, 100, 100, 0.5)',
}}
/>
</View>
)
}

Props

PropData TypeDefault ValueDescription
ExtendsModalProps--Inherits properties from ModalProps
visiblebooleantrueSet to false to hide it
sizenumber | BlossomSizemediumControl the size using pre-defined options
labelstring--Label text below indicator
labelStyleStyleProp<TextStyle>--Label text style
containerStyleStyleProp<ViewStyle>--Container style wrapping both label and ActivityIndicator