This commit is contained in:
oneao committed 2025-10-28 22:22:34 +08:00
1 parent 2f021ec51f
commit 8e8ab25726
10 files changed
+74 -46

No files matched your search

-1
View File
@@ -21,7 +21,6 @@
"expo-router": "~6.0.13",
"expo-splash-screen": "~31.0.10",
"expo-status-bar": "~3.0.8",
"lottie-react-native": "~7.3.4",
"lucide-react-native": "^0.548.0",
"nativewind": "^4.2.1",
"react": "19.1.0",
-21
View File
@@ -41,9 +41,6 @@ importers:
expo-status-bar:
specifier: ~3.0.8
version: 3.0.8(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
lottie-react-native:
specifier: ~7.3.4
version: 7.3.4(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
lucide-react-native:
specifier: ^0.548.0
version: 0.548.0(react-native-svg@15.12.1(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
@@ -3640,19 +3637,6 @@ packages:
resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}
hasBin: true
lottie-react-native@7.3.4:
resolution: {integrity: sha512-XUh7eGFb7ID8JRdU6U4N4cYQeYmjtdQRvd8ZXJ6xrdSsn5gZD0c79ITOREPcwJg4YupBFHgyV1GXdAHQP+KYUQ==}
peerDependencies:
'@lottiefiles/dotlottie-react': ^0.13.5
react: '*'
react-native: '>=0.46'
react-native-windows: '>=0.63.x'
peerDependenciesMeta:
'@lottiefiles/dotlottie-react':
optional: true
react-native-windows:
optional: true
lru-cache@10.4.3:
resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==}
@@ -9700,11 +9684,6 @@ snapshots:
dependencies:
js-tokens: 4.0.0
lottie-react-native@7.3.4(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0):
dependencies:
react: 19.1.0
react-native: 0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0)
lru-cache@10.4.3: {}
lru-cache@5.1.1:
+9 -15
View File
@@ -1,25 +1,19 @@
import { router, Stack } from 'expo-router'
import LottieView from 'lottie-react-native'
import { ArrowLeft } from 'lucide-react-native'
import { View } from 'react-native'
import { Button, ButtonIcon, ButtonText } from '@/components/ui/button'
import { EmptyState } from '@/components/empty-status'
export default function NotFound() {
return (
<>
<Stack.Screen options={{ headerShown: false }} />
<View className="flex-1 justify-center items-center bg-white">
<LottieView
source={require('@/static/lottie/404.json')}
style={{ width: 300, height: 300 }}
autoPlay
loop
/>
<Button onPress={() => router.replace('/')}>
<ButtonIcon as={ArrowLeft} />
<ButtonText>返回应用首页</ButtonText>
</Button>
</View>
<EmptyState
image={require('@/static/images/404.png')}
title="(´・ω・`) 页面走丢了~"
description="回首页看看吧!"
buttonText="返回应用首页"
buttonIcon={ArrowLeft}
onButtonPress={() => router.replace('/')}
/>
</>
)
}
+14 -8
View File
@@ -3,8 +3,11 @@ import { useFonts } from 'expo-font'
import { Stack } from 'expo-router'
import * as SplashScreen from 'expo-splash-screen'
import { StatusBar } from 'expo-status-bar'
import { RefreshCw } from 'lucide-react-native'
import { useEffect } from 'react'
import { Text, View } from 'react-native'
import { Image, ScrollView, Text, View } from 'react-native'
import { EmptyState } from '@/components/empty-status'
import { Button, ButtonIcon, ButtonText } from '@/components/ui/button'
import { GluestackUIProvider } from '@/components/ui/gluestack-ui-provider'
import '@/styles/global.css'
@@ -12,13 +15,18 @@ SplashScreen.preventAutoHideAsync()
export function ErrorBoundary({ error, retry }: ErrorBoundaryProps) {
return (
<View style={{ flex: 1 }}>
<Text>{error.message}</Text>
<Text onPress={retry}>Try Again?</Text>
</View>
<GluestackUIProvider>
<EmptyState
image={require('@/static/images/server-error.png')}
title="(´・ω・`) 出错啦~"
description={`发生了一点小问题:\n${error?.message || '请稍后再试'}`}
buttonText="重新加载"
buttonIcon={RefreshCw}
onButtonPress={retry}
/>
</GluestackUIProvider>
)
}
export default function Layout() {
const [loaded, error] = useFonts({
SpaceMono: require('@/static/fonts/SpaceMono-Regular.ttf'),
@@ -29,8 +37,6 @@ export default function Layout() {
SplashScreen.hideAsync()
}
}, [loaded])
// 模拟错误,100%发生
throw new Error('模拟错误测试 ErrorBoundary!')
return (
<GluestackUIProvider>
@@ -0,0 +1,50 @@
import { Image, ScrollView, Text } from 'react-native'
import { Button, ButtonIcon, ButtonText } from '@/components/ui/button'
interface EmptyStateProps {
image: any
title: string
description?: string
buttonText: string
buttonIcon?: React.ElementType
onButtonPress: () => void
}
export function EmptyState({
image,
title,
description,
buttonText,
buttonIcon,
onButtonPress,
}: EmptyStateProps) {
return (
<ScrollView
contentContainerStyle={{
flexGrow: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white',
padding: 16,
}}
showsVerticalScrollIndicator={true}
>
<Image source={image} className="w-56 h-56 mb-4" resizeMode="contain" />
<Text className="text-2xl font-semibold text-gray-900 mb-2">{title}</Text>
{description && (
<Text className="text-base text-gray-600 text-center mb-6 leading-6">
{description}
</Text>
)}
<Button
onPress={onButtonPress}
>
{buttonIcon && <ButtonIcon as={buttonIcon} />}
<ButtonText>{buttonText}</ButtonText>
</Button>
</ScrollView>
)
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="430.493" viewBox="0 0 800 430.493" xmlns:xlink="http://www.w3.org/1999/xlink" role="img" artist="Katerina Limpitsouni" source="https://undraw.co/"><g transform="translate(-368.866 -254.661)"><ellipse cx="149.199" cy="26.107" rx="149.199" ry="26.107" transform="translate(368.866 481.453)" fill="#090814"/><ellipse cx="191.906" cy="26.107" rx="191.906" ry="26.107" transform="translate(785.054 632.939)" fill="#090814"/><path d="M527.508,703.017a139.876,139.876,0,0,1-34.251-3.807l1.007-3.942c61.693,15.766,176.375-20.484,188.785-59.673l3.879,1.228C676.145,670.877,591.731,703.017,527.508,703.017Z" transform="translate(229.585 -61.587)" fill="#2f2e41"/><path d="M422.29,529.663c-14.453-3.693-21.922-7.965-24.218-13.849-2.856-7.316,2.5-15.561,9.919-26.972,11.315-17.409,26.811-41.252,24.3-77.646-1.418-20.568-8.78-35.7-21.879-44.978-26.656-18.878-68.707-7.567-69.129-7.451l-1.085-3.921c1.8-.5,44.3-11.949,72.551,8.041,14.153,10.017,22.094,26.176,23.6,48.028,2.6,37.751-13.977,63.262-24.949,80.143-6.756,10.394-11.637,17.9-9.54,23.275,1.748,4.477,8.559,8.1,21.436,11.386Z" transform="translate(278.852 29.977)" fill="#2f2e41"/><path d="M816.039,661.123,795.384,696.05s-26.3,13.971-7.807,14.382,105.6,0,105.6,0,16.847,0-9.862-14.793l-19.389-37.478Z" transform="translate(136.968 -68.851)" fill="#e6e6e6"/><rect width="348.044" height="242.439" rx="18.046" transform="translate(801.887 355.38)" fill="#e6e6e6"/><path d="M2.712,0h319.2a2.712,2.712,0,0,1,2.712,2.712V193.294a2.712,2.712,0,0,1-2.712,2.712H2.712A2.712,2.712,0,0,1,0,193.294V2.712A2.712,2.712,0,0,1,2.712,0Z" transform="translate(813.598 368.323)" fill="#6c63ff"/><circle cx="2.055" cy="2.055" r="2.055" transform="translate(973.854 360.516)" fill="#f2f2f2"/><path d="M957.868,621.322v21.252a12.236,12.236,0,0,1-12.239,12.237H622.061a12.236,12.236,0,0,1-12.237-12.239V621.322Z" transform="translate(192.063 -56.993)" fill="#e6e6e6"/><path d="M864.04,660.444v4.109H642.968v-3.288l.3-.822,5.449-14.793h210.8Z" transform="translate(202.681 3.326)" fill="#f2f2f2"/><path d="M1096.367,755.317c-.4,1.722-1.923,3.538-5.358,5.256-12.327,6.164-37.393-1.644-37.393-1.644s-19.313-3.287-19.313-11.917a15.428,15.428,0,0,1,1.693-1.007c5.183-2.742,22.367-9.508,52.837.286a12.709,12.709,0,0,1,5.792,3.8C1095.859,751.534,1096.828,753.367,1096.367,755.317Z" transform="translate(55.429 -95.57)" fill="#f2f2f2"/><path d="M1097.171,755.317c-15.089,5.782-28.538,6.213-42.34-3.374-6.961-4.832-13.285-6.028-18.031-5.938,5.183-2.742,22.367-9.508,52.837.286a12.708,12.708,0,0,1,5.792,3.8C1096.663,751.534,1097.631,753.367,1097.171,755.317Z" transform="translate(54.626 -95.57)" fill="#e6e6e6"/><path d="M864.04,667.466v4.109H642.968v-3.288l.3-.822Z" transform="translate(202.681 -3.696)" opacity="0.1"/><path d="M794.285,488.635H592.452a6.086,6.086,0,0,1-6.079-6.079V414.467a6.086,6.086,0,0,1,6.079-6.079H794.285a6.086,6.086,0,0,1,6.079,6.079v68.088A6.086,6.086,0,0,1,794.285,488.635Z" transform="translate(-181.314 -153.727)" fill="#6c63ff"/><rect width="53.498" height="6.079" transform="translate(436.671 272.899)" fill="#f2f2f2"/><circle cx="3.648" cy="3.648" r="3.648" transform="translate(557.041 272.899)" fill="#f2f2f2"/><circle cx="3.648" cy="3.648" r="3.648" transform="translate(569.2 272.899)" fill="#f2f2f2"/><circle cx="3.648" cy="3.648" r="3.648" transform="translate(581.358 272.899)" fill="#f2f2f2"/><path d="M794.285,601.689H592.452a6.087,6.087,0,0,1-6.079-6.079V527.521a6.086,6.086,0,0,1,6.079-6.079H794.285a6.086,6.086,0,0,1,6.079,6.079v68.088A6.086,6.086,0,0,1,794.285,601.689Z" transform="translate(-181.314 -180.455)" fill="#e6e6e6"/><rect width="53.498" height="6.079" transform="translate(436.671 359.225)" fill="#6c63ff"/><circle cx="3.648" cy="3.648" r="3.648" transform="translate(557.041 359.225)" fill="#6c63ff"/><circle cx="3.648" cy="3.648" r="3.648" transform="translate(569.2 359.225)" fill="#6c63ff"/><circle cx="3.648" cy="3.648" r="3.648" transform="translate(581.358 359.225)" fill="#6c63ff"/><path d="M794.285,714.743H592.452a6.087,6.087,0,0,1-6.079-6.079V640.575a6.086,6.086,0,0,1,6.079-6.079H794.285a6.086,6.086,0,0,1,6.079,6.079v68.089A6.086,6.086,0,0,1,794.285,714.743Z" transform="translate(-181.314 -207.183)" fill="#e6e6e6"/><rect width="53.498" height="6.079" transform="translate(436.671 445.552)" fill="#6c63ff"/><circle cx="3.648" cy="3.648" r="3.648" transform="translate(557.041 445.552)" fill="#6c63ff"/><circle cx="3.648" cy="3.648" r="3.648" transform="translate(569.2 445.552)" fill="#6c63ff"/><circle cx="3.648" cy="3.648" r="3.648" transform="translate(581.358 445.552)" fill="#6c63ff"/><g transform="translate(933.489 421.851)"><path d="M0,0H88.949V88.949H0Z" fill="none"/><path d="M39.062,2A37.062,37.062,0,0,1,76.125,39.062a37.06,37.06,0,1,1-74.11,1.2L2,39.062l.015-1.038A37.061,37.061,0,0,1,39.062,2ZM39.1,50.181l-.471.026a3.706,3.706,0,0,0,0,7.361l.434.026.471-.026a3.706,3.706,0,0,0,0-7.361Zm-.037-32.362a3.706,3.706,0,0,0-3.68,3.272l-.026.43Line truncated

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

@@ -1 +0,0 @@
{"v":"5.0.3","fr":60,"ip":0,"op":481,"w":1920,"h":1080,"nm":"08 - 404 Page-2","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"astronaut","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"n":["0p667_1_0p333_0"],"t":0,"s":[0],"e":[6]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"n":["0p667_1_0p333_0"],"t":240,"s":[6],"e":[0]},{"t":480}],"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":0,"s":[1053.917,479.903,0],"e":[1004.917,482.903,0],"to":[-8.16666698455811,0.5,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":240,"s":[1004.917,482.903,0],"e":[1053.917,479.903,0],"to":[0,0,0],"ti":[-8.16666698455811,0.5,0]},{"t":480}],"ix":2},"a":{"a":0,"k":[238.431,194.157,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"gr","it":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[1.695,-0.123],[0.208,-1.775],[-8.528,-22.143],[-16.702,-14.602],[-1.408,1.101],[11.447,29.719],[28.36,-0.002]],"o":[[-1.783,0.13],[-2.59,22.033],[8.528,22.142],[1.345,1.177],[23.868,-18.628],[-10.804,-28.052],[-1.688,0]],"v":[[-38.22,-63.515],[-41.631,-60.213],[-33.12,6.934],[5.611,62.44],[10.354,62.6],[32.773,-18.445],[-33.138,-63.699]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":1,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"g":{"p":3,"k":{"a":0,"k":[0,1,0.4431,0,0.5,0.1972,0.3055,0.3828,1,0.0306,0.0999,0.1494,0,1,0.5,0.995,1,0.99],"ix":9}},"s":{"a":0,"k":[80,-37],"ix":5},"e":{"a":0,"k":[-23.5,9],"ix":6},"t":1,"nm":"Gradient Fill 1","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[322.001,69.707],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"visor","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-13.398,-34.788],[34.788,-13.398],[13.4,34.788],[-34.788,13.399]],"o":[[13.399,34.788],[-34.788,13.399],[-13.398,-34.788],[34.788,-13.399]],"v":[[62.989,-24.261],[24.261,62.989],[-62.99,24.261],[-24.261,-62.989]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[288.878,76.638],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"helmet","np":2,"cix":2,"ix":2,"mn":"ADBE Vector Group","hd":false},{"ty":"tr","p":{"a":0,"k":[264.015,127.254],"ix":2},"a":{"a":0,"k":[264.015,127.254],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":0,"s":[0],"e":[-6]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":240,"s":[-6],"e":[0]},{"t":480}],"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"helmet","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":1},"o":{"x":0.167,"y":0.167},"n":"0p833_1_0p167_0p167","t":0,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-2.649,9.747],[8.886,-1.547]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-6.153,4.911],[6.153,-4.911]],"c":false}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":60,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-6.153,4.911],[6.153,-4.911]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[0.097,13.536],[11.028,1.089]],"c":false}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":180,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[0.097,13.536],[11.028,1.089]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-6.153,4.911],[6.153,-4.911]],"c":false}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":300,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-6.153,4.911],[6.153,-4.911]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[0.097,13.536],[11.028,1.089]],"c":false}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"n":"0p833_0p833_0p333_0","t":420,"s":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[0.097,13.536],[11.028,1.089]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[0,0],[0,Line truncated