1- /**
2- * LoadingSpinner Component
3- *
4- * A stylish loading spinner with iOS glass effect support when available.
5- * Falls back to a nice styled container on other platforms.
6- */
7-
81import React from "react" ;
92import { View , ActivityIndicator , Platform , StyleSheet } from "react-native" ;
103import { GlassView , isLiquidGlassAvailable } from "expo-glass-effect" ;
114
125interface LoadingSpinnerProps {
13- /** Size of the spinner - defaults to large */
146 size ?: "small" | "large" ;
15- /** Color of the spinner - defaults to system color */
167 color ?: string ;
17- /** Whether to show the container background */
188 showBackground ?: boolean ;
199}
2010
@@ -25,7 +15,6 @@ export function LoadingSpinner({
2515} : LoadingSpinnerProps ) {
2616 const supportsGlass = isLiquidGlassAvailable ( ) ;
2717
28- // Use glass effect on supported iOS devices
2918 if ( supportsGlass && Platform . OS === "ios" ) {
3019 return (
3120 < GlassView style = { styles . glassContainer } glassEffectStyle = "regular" >
@@ -34,7 +23,6 @@ export function LoadingSpinner({
3423 ) ;
3524 }
3625
37- // Styled container for other platforms
3826 if ( showBackground ) {
3927 return (
4028 < View style = { styles . styledContainer } >
@@ -43,7 +31,6 @@ export function LoadingSpinner({
4331 ) ;
4432 }
4533
46- // Simple spinner without background
4734 return < ActivityIndicator size = { size } color = { color || "#000000" } /> ;
4835}
4936
@@ -60,11 +47,18 @@ const styles = StyleSheet.create({
6047 padding : 24 ,
6148 borderRadius : 20 ,
6249 backgroundColor : "rgba(255, 255, 255, 0.9)" ,
63- shadowColor : "#000" ,
64- shadowOffset : { width : 0 , height : 2 } ,
65- shadowOpacity : 0.1 ,
66- shadowRadius : 8 ,
67- elevation : 4 ,
50+ ...Platform . select ( {
51+ web : {
52+ boxShadow : "0 2px 8px rgba(0, 0, 0, 0.1)" ,
53+ } ,
54+ default : {
55+ shadowColor : "#000" ,
56+ shadowOffset : { width : 0 , height : 2 } ,
57+ shadowOpacity : 0.1 ,
58+ shadowRadius : 8 ,
59+ elevation : 4 ,
60+ } ,
61+ } ) ,
6862 } ,
6963} ) ;
7064
0 commit comments