File size: 1,655 Bytes
68465df | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | import {View, TouchableOpacity, ViewStyle, TextStyle} from "react-native"
import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons"
import {Text} from "@/components/ignite"
import {useAppTheme} from "@/contexts/ThemeContext"
import {ThemedStyle} from "@/theme"
interface InternetConnectionFallbackComponentProps {
retry: () => void
message?: string
}
export default function InternetConnectionFallbackComponent({
retry,
message = "Unable to connect. Please check your internet connection.",
}: InternetConnectionFallbackComponentProps) {
const {theme, themed} = useAppTheme()
return (
<View style={themed($fallbackContainer)}>
<MaterialCommunityIcons name="wifi-off" size={60} color={theme.colors.text} />
<Text text={message} style={themed($fallbackText)} />
<TouchableOpacity style={themed($retryButton)} onPress={retry}>
<Text text="Retry" style={themed($retryButtonText)} />
</TouchableOpacity>
</View>
)
}
const $fallbackContainer: ThemedStyle<ViewStyle> = () => ({
alignItems: "center",
flex: 1,
justifyContent: "center",
padding: 20,
})
const $fallbackText: ThemedStyle<TextStyle> = ({colors}) => ({
color: colors.text,
fontSize: 16,
textAlign: "center",
marginVertical: 20,
})
const $retryButton: ThemedStyle<ViewStyle> = ({colors}) => ({
borderRadius: 8,
paddingHorizontal: 20,
paddingVertical: 10,
backgroundColor: colors.primary,
})
const $retryButtonText: ThemedStyle<TextStyle> = ({colors}) => ({
fontSize: 16,
fontWeight: "600",
color: colors.palette.neutral100,
})
|