The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { NativeThemeHost } from "./NativeThemeHost.android"; |
| 2 | import { LoadingIndicator } from "@expo/ui/jetpack-compose"; |
| 3 | import { size as composeSize } from "@expo/ui/jetpack-compose/modifiers"; |
| 4 | import { StyleSheet, View, type ActivityIndicatorProps } from "react-native"; |
| 5 | import { useResolveClassNames, withUniwind } from "uniwind"; |
| 6 | |
| 7 | function AndroidActivityIndicator({ |
| 8 | animating = true, |
| 9 | color, |
| 10 | colorClassName: _colorClassName, |
| 11 | className: _className, |
| 12 | hidesWhenStopped: _hidesWhenStopped, |
| 13 | size = "small", |
| 14 | style, |
| 15 | ...viewProps |
| 16 | }: ActivityIndicatorProps) { |
| 17 | const { color: primaryColor } = useResolveClassNames("text-primary"); |
| 18 | const diameter = typeof size === "number" ? size : size === "large" ? 48 : 20; |
| 19 | |
| 20 | return ( |
| 21 | <View |
| 22 | accessible={animating} |
| 23 | accessibilityRole="progressbar" |
| 24 | accessibilityState={{ busy: animating }} |
| 25 | {...viewProps} |
| 26 | style={[styles.container, style]} |
| 27 | > |
| 28 | <View |
| 29 | pointerEvents="none" |
| 30 | importantForAccessibility="no-hide-descendants" |
| 31 | style={{ width: diameter, height: diameter }} |
| 32 | > |
| 33 | {animating ? ( |
| 34 | <NativeThemeHost ignoreSafeAreaKeyboardInsets style={{ flex: 1 }}> |
| 35 | <LoadingIndicator |
| 36 | color={color ?? primaryColor} |
| 37 | modifiers={[composeSize(diameter, diameter)]} |
| 38 | /> |
| 39 | </NativeThemeHost> |
| 40 | ) : null} |
| 41 | </View> |
| 42 | </View> |
| 43 | ); |
| 44 | } |
| 45 | |
| 46 | export const AppActivityIndicator = withUniwind(AndroidActivityIndicator); |
| 47 | |
| 48 | const styles = StyleSheet.create({ |
| 49 | container: { alignItems: "center", justifyContent: "center" }, |
| 50 | }); |