@coze-arch/cli 0.0.1-alpha.01c0ee
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +143 -0
- package/bin/main +2 -0
- package/lib/__templates__/expo/.coze +12 -0
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +46 -0
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +229 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +47 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +34 -0
- package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
- package/lib/__templates__/expo/README.md +74 -0
- package/lib/__templates__/expo/_gitignore +11 -0
- package/lib/__templates__/expo/_npmrc +20 -0
- package/lib/__templates__/expo/client/app/+not-found.tsx +30 -0
- package/lib/__templates__/expo/client/app/_layout.tsx +36 -0
- package/lib/__templates__/expo/client/app/index.tsx +1 -0
- package/lib/__templates__/expo/client/app.config.ts +76 -0
- package/lib/__templates__/expo/client/assets/fonts/SpaceMono-Regular.ttf +0 -0
- package/lib/__templates__/expo/client/assets/images/adaptive-icon.png +0 -0
- package/lib/__templates__/expo/client/assets/images/default-avatar.png +0 -0
- package/lib/__templates__/expo/client/assets/images/favicon.png +0 -0
- package/lib/__templates__/expo/client/assets/images/icon.png +0 -0
- package/lib/__templates__/expo/client/assets/images/partial-react-logo.png +0 -0
- package/lib/__templates__/expo/client/assets/images/react-logo.png +0 -0
- package/lib/__templates__/expo/client/assets/images/react-logo@2x.png +0 -0
- package/lib/__templates__/expo/client/assets/images/react-logo@3x.png +0 -0
- package/lib/__templates__/expo/client/assets/images/splash-icon.png +0 -0
- package/lib/__templates__/expo/client/components/Screen.tsx +314 -0
- package/lib/__templates__/expo/client/components/SmartDateInput.tsx +238 -0
- package/lib/__templates__/expo/client/components/ThemedText.tsx +33 -0
- package/lib/__templates__/expo/client/components/ThemedView.tsx +37 -0
- package/lib/__templates__/expo/client/constants/theme.ts +177 -0
- package/lib/__templates__/expo/client/contexts/AuthContext.tsx +49 -0
- package/lib/__templates__/expo/client/declarations.d.ts +5 -0
- package/lib/__templates__/expo/client/eslint-formatter-simple.mjs +49 -0
- package/lib/__templates__/expo/client/eslint.config.mjs +128 -0
- package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
- package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
- package/lib/__templates__/expo/client/hooks/useTheme.ts +33 -0
- package/lib/__templates__/expo/client/metro.config.js +124 -0
- package/lib/__templates__/expo/client/package.json +95 -0
- package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
- package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
- package/lib/__templates__/expo/client/scripts/install-missing-deps.js +105 -0
- package/lib/__templates__/expo/client/tsconfig.json +24 -0
- package/lib/__templates__/expo/client/utils/index.ts +76 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
- package/lib/__templates__/expo/eslint-plugins/forbid-emoji/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/forbid-emoji/rule.js +112 -0
- package/lib/__templates__/expo/eslint-plugins/forbid-emoji/tech.md +94 -0
- package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
- package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
- package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/rule.js +120 -0
- package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/tech.md +58 -0
- package/lib/__templates__/expo/package.json +25 -0
- package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
- package/lib/__templates__/expo/pnpm-lock.yaml +12657 -0
- package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
- package/lib/__templates__/expo/server/build.js +21 -0
- package/lib/__templates__/expo/server/package.json +34 -0
- package/lib/__templates__/expo/server/src/index.ts +20 -0
- package/lib/__templates__/expo/server/tsconfig.json +24 -0
- package/lib/__templates__/expo/template.config.js +106 -0
- package/lib/__templates__/expo/tsconfig.json +1 -0
- package/lib/__templates__/native-static/.coze +11 -0
- package/lib/__templates__/native-static/index.html +33 -0
- package/lib/__templates__/native-static/styles/main.css +136 -0
- package/lib/__templates__/native-static/template.config.js +22 -0
- package/lib/__templates__/nextjs/.babelrc +15 -0
- package/lib/__templates__/nextjs/.coze +12 -0
- package/lib/__templates__/nextjs/README.md +363 -0
- package/lib/__templates__/nextjs/_gitignore +99 -0
- package/lib/__templates__/nextjs/_npmrc +23 -0
- package/lib/__templates__/nextjs/components.json +21 -0
- package/lib/__templates__/nextjs/eslint.config.mjs +23 -0
- package/lib/__templates__/nextjs/next-env.d.ts +6 -0
- package/lib/__templates__/nextjs/next.config.ts +18 -0
- package/lib/__templates__/nextjs/package.json +93 -0
- package/lib/__templates__/nextjs/pnpm-lock.yaml +12404 -0
- package/lib/__templates__/nextjs/postcss.config.mjs +7 -0
- package/lib/__templates__/nextjs/public/file.svg +1 -0
- package/lib/__templates__/nextjs/public/globe.svg +1 -0
- package/lib/__templates__/nextjs/public/next.svg +1 -0
- package/lib/__templates__/nextjs/public/vercel.svg +1 -0
- package/lib/__templates__/nextjs/public/window.svg +1 -0
- package/lib/__templates__/nextjs/scripts/build.sh +17 -0
- package/lib/__templates__/nextjs/scripts/dev.sh +39 -0
- package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
- package/lib/__templates__/nextjs/scripts/start.sh +21 -0
- package/lib/__templates__/nextjs/src/app/favicon.ico +0 -0
- package/lib/__templates__/nextjs/src/app/globals.css +137 -0
- package/lib/__templates__/nextjs/src/app/layout.tsx +74 -0
- package/lib/__templates__/nextjs/src/app/page.tsx +35 -0
- package/lib/__templates__/nextjs/src/app/robots.ts +11 -0
- package/lib/__templates__/nextjs/src/components/ui/accordion.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/alert-dialog.tsx +157 -0
- package/lib/__templates__/nextjs/src/components/ui/alert.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/aspect-ratio.tsx +11 -0
- package/lib/__templates__/nextjs/src/components/ui/avatar.tsx +53 -0
- package/lib/__templates__/nextjs/src/components/ui/badge.tsx +46 -0
- package/lib/__templates__/nextjs/src/components/ui/breadcrumb.tsx +109 -0
- package/lib/__templates__/nextjs/src/components/ui/button-group.tsx +83 -0
- package/lib/__templates__/nextjs/src/components/ui/button.tsx +62 -0
- package/lib/__templates__/nextjs/src/components/ui/calendar.tsx +220 -0
- package/lib/__templates__/nextjs/src/components/ui/card.tsx +92 -0
- package/lib/__templates__/nextjs/src/components/ui/carousel.tsx +241 -0
- package/lib/__templates__/nextjs/src/components/ui/chart.tsx +357 -0
- package/lib/__templates__/nextjs/src/components/ui/checkbox.tsx +32 -0
- package/lib/__templates__/nextjs/src/components/ui/collapsible.tsx +33 -0
- package/lib/__templates__/nextjs/src/components/ui/command.tsx +184 -0
- package/lib/__templates__/nextjs/src/components/ui/context-menu.tsx +252 -0
- package/lib/__templates__/nextjs/src/components/ui/dialog.tsx +143 -0
- package/lib/__templates__/nextjs/src/components/ui/drawer.tsx +135 -0
- package/lib/__templates__/nextjs/src/components/ui/dropdown-menu.tsx +257 -0
- package/lib/__templates__/nextjs/src/components/ui/empty.tsx +104 -0
- package/lib/__templates__/nextjs/src/components/ui/field.tsx +248 -0
- package/lib/__templates__/nextjs/src/components/ui/form.tsx +167 -0
- package/lib/__templates__/nextjs/src/components/ui/hover-card.tsx +44 -0
- package/lib/__templates__/nextjs/src/components/ui/input-group.tsx +170 -0
- package/lib/__templates__/nextjs/src/components/ui/input-otp.tsx +77 -0
- package/lib/__templates__/nextjs/src/components/ui/input.tsx +21 -0
- package/lib/__templates__/nextjs/src/components/ui/item.tsx +193 -0
- package/lib/__templates__/nextjs/src/components/ui/kbd.tsx +28 -0
- package/lib/__templates__/nextjs/src/components/ui/label.tsx +24 -0
- package/lib/__templates__/nextjs/src/components/ui/menubar.tsx +276 -0
- package/lib/__templates__/nextjs/src/components/ui/navigation-menu.tsx +168 -0
- package/lib/__templates__/nextjs/src/components/ui/pagination.tsx +127 -0
- package/lib/__templates__/nextjs/src/components/ui/popover.tsx +48 -0
- package/lib/__templates__/nextjs/src/components/ui/progress.tsx +31 -0
- package/lib/__templates__/nextjs/src/components/ui/radio-group.tsx +45 -0
- package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +63 -0
- package/lib/__templates__/nextjs/src/components/ui/scroll-area.tsx +58 -0
- package/lib/__templates__/nextjs/src/components/ui/select.tsx +190 -0
- package/lib/__templates__/nextjs/src/components/ui/separator.tsx +28 -0
- package/lib/__templates__/nextjs/src/components/ui/sheet.tsx +139 -0
- package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +724 -0
- package/lib/__templates__/nextjs/src/components/ui/skeleton.tsx +13 -0
- package/lib/__templates__/nextjs/src/components/ui/slider.tsx +63 -0
- package/lib/__templates__/nextjs/src/components/ui/sonner.tsx +40 -0
- package/lib/__templates__/nextjs/src/components/ui/spinner.tsx +16 -0
- package/lib/__templates__/nextjs/src/components/ui/switch.tsx +31 -0
- package/lib/__templates__/nextjs/src/components/ui/table.tsx +116 -0
- package/lib/__templates__/nextjs/src/components/ui/tabs.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/textarea.tsx +18 -0
- package/lib/__templates__/nextjs/src/components/ui/toggle-group.tsx +83 -0
- package/lib/__templates__/nextjs/src/components/ui/toggle.tsx +47 -0
- package/lib/__templates__/nextjs/src/components/ui/tooltip.tsx +61 -0
- package/lib/__templates__/nextjs/src/hooks/use-mobile.ts +19 -0
- package/lib/__templates__/nextjs/src/lib/utils.ts +6 -0
- package/lib/__templates__/nextjs/src/server.ts +35 -0
- package/lib/__templates__/nextjs/template.config.js +120 -0
- package/lib/__templates__/nextjs/tsconfig.json +34 -0
- package/lib/__templates__/nuxt-vue/.coze +12 -0
- package/lib/__templates__/nuxt-vue/README.md +73 -0
- package/lib/__templates__/nuxt-vue/_gitignore +24 -0
- package/lib/__templates__/nuxt-vue/_npmrc +23 -0
- package/lib/__templates__/nuxt-vue/app/app.vue +6 -0
- package/lib/__templates__/nuxt-vue/app/pages/index.vue +23 -0
- package/lib/__templates__/nuxt-vue/assets/css/main.css +24 -0
- package/lib/__templates__/nuxt-vue/nuxt.config.ts +116 -0
- package/lib/__templates__/nuxt-vue/package.json +35 -0
- package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8759 -0
- package/lib/__templates__/nuxt-vue/postcss.config.mjs +8 -0
- package/lib/__templates__/nuxt-vue/public/favicon.ico +0 -0
- package/lib/__templates__/nuxt-vue/public/robots.txt +2 -0
- package/lib/__templates__/nuxt-vue/scripts/build.sh +14 -0
- package/lib/__templates__/nuxt-vue/scripts/dev.sh +39 -0
- package/lib/__templates__/nuxt-vue/scripts/prepare.sh +14 -0
- package/lib/__templates__/nuxt-vue/scripts/start.sh +21 -0
- package/lib/__templates__/nuxt-vue/server/api/hello.ts +10 -0
- package/lib/__templates__/nuxt-vue/server/middleware/logger.ts +10 -0
- package/lib/__templates__/nuxt-vue/server/routes/health.ts +10 -0
- package/lib/__templates__/nuxt-vue/tailwind.config.js +13 -0
- package/lib/__templates__/nuxt-vue/template.config.js +87 -0
- package/lib/__templates__/nuxt-vue/tsconfig.json +18 -0
- package/lib/__templates__/taro/.coze +14 -0
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
- package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
- package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -0
- package/lib/__templates__/taro/README.md +763 -0
- package/lib/__templates__/taro/_gitignore +40 -0
- package/lib/__templates__/taro/_npmrc +18 -0
- package/lib/__templates__/taro/babel.config.js +12 -0
- package/lib/__templates__/taro/config/dev.ts +9 -0
- package/lib/__templates__/taro/config/index.ts +237 -0
- package/lib/__templates__/taro/config/prod.ts +34 -0
- package/lib/__templates__/taro/eslint.config.mjs +135 -0
- package/lib/__templates__/taro/key/private.appid.key +0 -0
- package/lib/__templates__/taro/package.json +112 -0
- package/lib/__templates__/taro/patches/@tarojs__plugin-mini-ci@4.1.9.patch +30 -0
- package/lib/__templates__/taro/pnpm-lock.yaml +23412 -0
- package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
- package/lib/__templates__/taro/project.config.json +15 -0
- package/lib/__templates__/taro/server/nest-cli.json +10 -0
- package/lib/__templates__/taro/server/package.json +40 -0
- package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
- package/lib/__templates__/taro/server/src/app.module.ts +10 -0
- package/lib/__templates__/taro/server/src/app.service.ts +8 -0
- package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
- package/lib/__templates__/taro/server/src/main.ts +49 -0
- package/lib/__templates__/taro/server/tsconfig.json +24 -0
- package/lib/__templates__/taro/src/app.config.ts +11 -0
- package/lib/__templates__/taro/src/app.css +156 -0
- package/lib/__templates__/taro/src/app.tsx +9 -0
- package/lib/__templates__/taro/src/components/ui/accordion.tsx +159 -0
- package/lib/__templates__/taro/src/components/ui/alert-dialog.tsx +260 -0
- package/lib/__templates__/taro/src/components/ui/alert.tsx +60 -0
- package/lib/__templates__/taro/src/components/ui/aspect-ratio.tsx +36 -0
- package/lib/__templates__/taro/src/components/ui/avatar.tsx +84 -0
- package/lib/__templates__/taro/src/components/ui/badge.tsx +37 -0
- package/lib/__templates__/taro/src/components/ui/breadcrumb.tsx +117 -0
- package/lib/__templates__/taro/src/components/ui/button-group.tsx +83 -0
- package/lib/__templates__/taro/src/components/ui/button.tsx +67 -0
- package/lib/__templates__/taro/src/components/ui/calendar.tsx +394 -0
- package/lib/__templates__/taro/src/components/ui/card.tsx +108 -0
- package/lib/__templates__/taro/src/components/ui/carousel.tsx +228 -0
- package/lib/__templates__/taro/src/components/ui/checkbox.tsx +58 -0
- package/lib/__templates__/taro/src/components/ui/code-block.tsx +169 -0
- package/lib/__templates__/taro/src/components/ui/collapsible.tsx +71 -0
- package/lib/__templates__/taro/src/components/ui/command.tsx +385 -0
- package/lib/__templates__/taro/src/components/ui/context-menu.tsx +614 -0
- package/lib/__templates__/taro/src/components/ui/dialog.tsx +256 -0
- package/lib/__templates__/taro/src/components/ui/drawer.tsx +192 -0
- package/lib/__templates__/taro/src/components/ui/dropdown-menu.tsx +561 -0
- package/lib/__templates__/taro/src/components/ui/field.tsx +228 -0
- package/lib/__templates__/taro/src/components/ui/hover-card.tsx +282 -0
- package/lib/__templates__/taro/src/components/ui/input-group.tsx +197 -0
- package/lib/__templates__/taro/src/components/ui/input-otp.tsx +136 -0
- package/lib/__templates__/taro/src/components/ui/input.tsx +56 -0
- package/lib/__templates__/taro/src/components/ui/label.tsx +24 -0
- package/lib/__templates__/taro/src/components/ui/menubar.tsx +595 -0
- package/lib/__templates__/taro/src/components/ui/navigation-menu.tsx +264 -0
- package/lib/__templates__/taro/src/components/ui/pagination.tsx +118 -0
- package/lib/__templates__/taro/src/components/ui/popover.tsx +291 -0
- package/lib/__templates__/taro/src/components/ui/portal.tsx +19 -0
- package/lib/__templates__/taro/src/components/ui/progress.tsx +28 -0
- package/lib/__templates__/taro/src/components/ui/radio-group.tsx +64 -0
- package/lib/__templates__/taro/src/components/ui/resizable.tsx +346 -0
- package/lib/__templates__/taro/src/components/ui/scroll-area.tsx +34 -0
- package/lib/__templates__/taro/src/components/ui/select.tsx +438 -0
- package/lib/__templates__/taro/src/components/ui/separator.tsx +30 -0
- package/lib/__templates__/taro/src/components/ui/sheet.tsx +262 -0
- package/lib/__templates__/taro/src/components/ui/skeleton.tsx +17 -0
- package/lib/__templates__/taro/src/components/ui/slider.tsx +203 -0
- package/lib/__templates__/taro/src/components/ui/sonner.tsx +1 -0
- package/lib/__templates__/taro/src/components/ui/switch.tsx +55 -0
- package/lib/__templates__/taro/src/components/ui/table.tsx +142 -0
- package/lib/__templates__/taro/src/components/ui/tabs.tsx +114 -0
- package/lib/__templates__/taro/src/components/ui/textarea.tsx +54 -0
- package/lib/__templates__/taro/src/components/ui/toast.tsx +517 -0
- package/lib/__templates__/taro/src/components/ui/toggle-group.tsx +120 -0
- package/lib/__templates__/taro/src/components/ui/toggle.tsx +77 -0
- package/lib/__templates__/taro/src/components/ui/tooltip.tsx +455 -0
- package/lib/__templates__/taro/src/index.html +39 -0
- package/lib/__templates__/taro/src/lib/hooks/use-keyboard-offset.ts +37 -0
- package/lib/__templates__/taro/src/lib/measure.ts +115 -0
- package/lib/__templates__/taro/src/lib/platform.ts +12 -0
- package/lib/__templates__/taro/src/lib/utils.ts +6 -0
- package/lib/__templates__/taro/src/network.ts +39 -0
- package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
- package/lib/__templates__/taro/src/pages/index/index.css +1 -0
- package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
- package/lib/__templates__/taro/src/presets/dev-debug.ts +23 -0
- package/lib/__templates__/taro/src/presets/h5-container.tsx +15 -0
- package/lib/__templates__/taro/src/presets/h5-navbar.tsx +238 -0
- package/lib/__templates__/taro/src/presets/h5-styles.ts +220 -0
- package/lib/__templates__/taro/src/presets/index.tsx +18 -0
- package/lib/__templates__/taro/stylelint.config.mjs +4 -0
- package/lib/__templates__/taro/template.config.js +68 -0
- package/lib/__templates__/taro/tsconfig.json +29 -0
- package/lib/__templates__/taro/types/global.d.ts +32 -0
- package/lib/__templates__/templates.json +162 -0
- package/lib/__templates__/vite/.coze +12 -0
- package/lib/__templates__/vite/README.md +418 -0
- package/lib/__templates__/vite/_gitignore +67 -0
- package/lib/__templates__/vite/_npmrc +23 -0
- package/lib/__templates__/vite/eslint.config.mjs +14 -0
- package/lib/__templates__/vite/index.html +13 -0
- package/lib/__templates__/vite/package.json +44 -0
- package/lib/__templates__/vite/pnpm-lock.yaml +3465 -0
- package/lib/__templates__/vite/postcss.config.js +6 -0
- package/lib/__templates__/vite/scripts/build.sh +17 -0
- package/lib/__templates__/vite/scripts/dev.sh +39 -0
- package/lib/__templates__/vite/scripts/prepare.sh +9 -0
- package/lib/__templates__/vite/scripts/start.sh +21 -0
- package/lib/__templates__/vite/server/routes/index.ts +31 -0
- package/lib/__templates__/vite/server/server.ts +65 -0
- package/lib/__templates__/vite/server/vite.ts +67 -0
- package/lib/__templates__/vite/src/index.css +21 -0
- package/lib/__templates__/vite/src/index.ts +5 -0
- package/lib/__templates__/vite/src/main.ts +34 -0
- package/lib/__templates__/vite/tailwind.config.js +9 -0
- package/lib/__templates__/vite/template.config.js +127 -0
- package/lib/__templates__/vite/tsconfig.json +17 -0
- package/lib/__templates__/vite/vite.config.ts +20 -0
- package/lib/cli.js +2631 -0
- package/package.json +81 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
2
|
+
import { Link } from 'expo-router';
|
|
3
|
+
import { useTheme } from '@/hooks/useTheme';
|
|
4
|
+
import { Spacing } from '@/constants/theme';
|
|
5
|
+
|
|
6
|
+
export default function NotFoundScreen() {
|
|
7
|
+
const { theme } = useTheme();
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<View style={[styles.container, { backgroundColor: theme.backgroundRoot }]}>
|
|
11
|
+
<Text>
|
|
12
|
+
页面不存在
|
|
13
|
+
</Text>
|
|
14
|
+
<Link href="/" style={[styles.gohome]}>
|
|
15
|
+
返回首页
|
|
16
|
+
</Link>
|
|
17
|
+
</View>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
container: {
|
|
23
|
+
flex: 1,
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
},
|
|
27
|
+
gohome: {
|
|
28
|
+
marginTop: Spacing['2xl'],
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
3
|
+
import { Stack } from 'expo-router';
|
|
4
|
+
import { StatusBar } from 'expo-status-bar';
|
|
5
|
+
import { LogBox } from 'react-native';
|
|
6
|
+
import Toast from 'react-native-toast-message';
|
|
7
|
+
import { AuthProvider } from "@/contexts/AuthContext";
|
|
8
|
+
import { ColorSchemeProvider } from '@/hooks/useColorScheme';
|
|
9
|
+
|
|
10
|
+
LogBox.ignoreLogs([
|
|
11
|
+
"TurboModuleRegistry.getEnforcing(...): 'RNMapsAirModule' could not be found",
|
|
12
|
+
// 添加其它想暂时忽略的错误或警告信息
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
export default function RootLayout() {
|
|
16
|
+
return (
|
|
17
|
+
<AuthProvider>
|
|
18
|
+
<ColorSchemeProvider>
|
|
19
|
+
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
20
|
+
<StatusBar style="dark"></StatusBar>
|
|
21
|
+
<Stack screenOptions={{
|
|
22
|
+
// 设置所有页面的切换动画为从右侧滑入,适用于iOS 和 Android
|
|
23
|
+
animation: 'slide_from_right',
|
|
24
|
+
gestureEnabled: true,
|
|
25
|
+
gestureDirection: 'horizontal',
|
|
26
|
+
// 隐藏自带的头部
|
|
27
|
+
headerShown: false
|
|
28
|
+
}}>
|
|
29
|
+
<Stack.Screen name="index" options={{ title: "" }} />
|
|
30
|
+
</Stack>
|
|
31
|
+
<Toast />
|
|
32
|
+
</GestureHandlerRootView>
|
|
33
|
+
</ColorSchemeProvider>
|
|
34
|
+
</AuthProvider>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@/screens/demo';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ExpoConfig, ConfigContext } from 'expo/config';
|
|
2
|
+
|
|
3
|
+
const appName = process.env.COZE_PROJECT_NAME || process.env.EXPO_PUBLIC_COZE_PROJECT_NAME || '应用';
|
|
4
|
+
const projectId = process.env.COZE_PROJECT_ID || process.env.EXPO_PUBLIC_COZE_PROJECT_ID;
|
|
5
|
+
const slugAppName = projectId ? `app${projectId}` : 'myapp';
|
|
6
|
+
|
|
7
|
+
export default ({ config }: ConfigContext): ExpoConfig => {
|
|
8
|
+
return {
|
|
9
|
+
...config,
|
|
10
|
+
"name": appName,
|
|
11
|
+
"slug": slugAppName,
|
|
12
|
+
"version": "1.0.0",
|
|
13
|
+
"orientation": "portrait",
|
|
14
|
+
"icon": "./assets/images/icon.png",
|
|
15
|
+
"scheme": "myapp",
|
|
16
|
+
"userInterfaceStyle": "automatic",
|
|
17
|
+
"newArchEnabled": true,
|
|
18
|
+
"ios": {
|
|
19
|
+
"supportsTablet": true
|
|
20
|
+
},
|
|
21
|
+
"android": {
|
|
22
|
+
"adaptiveIcon": {
|
|
23
|
+
"foregroundImage": "./assets/images/adaptive-icon.png",
|
|
24
|
+
"backgroundColor": "#ffffff"
|
|
25
|
+
},
|
|
26
|
+
"package": `com.anonymous.x${projectId || '0'}`
|
|
27
|
+
},
|
|
28
|
+
"web": {
|
|
29
|
+
"bundler": "metro",
|
|
30
|
+
"output": "single",
|
|
31
|
+
"favicon": "./assets/images/favicon.png"
|
|
32
|
+
},
|
|
33
|
+
"plugins": [
|
|
34
|
+
process.env.EXPO_PUBLIC_BACKEND_BASE_URL ? [
|
|
35
|
+
"expo-router",
|
|
36
|
+
{
|
|
37
|
+
"origin": process.env.EXPO_PUBLIC_BACKEND_BASE_URL
|
|
38
|
+
}
|
|
39
|
+
] : 'expo-router',
|
|
40
|
+
[
|
|
41
|
+
"expo-splash-screen",
|
|
42
|
+
{
|
|
43
|
+
"image": "./assets/images/splash-icon.png",
|
|
44
|
+
"imageWidth": 200,
|
|
45
|
+
"resizeMode": "contain",
|
|
46
|
+
"backgroundColor": "#ffffff"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
"expo-image-picker",
|
|
51
|
+
{
|
|
52
|
+
"photosPermission": `允许${appName}访问您的相册,以便您上传或保存图片。`,
|
|
53
|
+
"cameraPermission": `允许${appName}使用您的相机,以便您直接拍摄照片上传。`,
|
|
54
|
+
"microphonePermission": `允许${appName}访问您的麦克风,以便您拍摄带有声音的视频。`
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
"expo-location",
|
|
59
|
+
{
|
|
60
|
+
"locationWhenInUsePermission": `${appName}需要访问您的位置以提供周边服务及导航功能。`
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
"expo-camera",
|
|
65
|
+
{
|
|
66
|
+
"cameraPermission": `${appName}需要访问相机以拍摄照片和视频。`,
|
|
67
|
+
"microphonePermission": `${appName}需要访问麦克风以录制视频声音。`,
|
|
68
|
+
"recordAudioAndroid": true
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
],
|
|
72
|
+
"experiments": {
|
|
73
|
+
"typedRoutes": true
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Platform,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
ScrollView,
|
|
6
|
+
View,
|
|
7
|
+
TouchableWithoutFeedback,
|
|
8
|
+
Keyboard,
|
|
9
|
+
ViewStyle,
|
|
10
|
+
FlatList,
|
|
11
|
+
SectionList,
|
|
12
|
+
Modal,
|
|
13
|
+
} from 'react-native';
|
|
14
|
+
import { useSafeAreaInsets, Edge } from 'react-native-safe-area-context';
|
|
15
|
+
import { StatusBar } from 'expo-status-bar';
|
|
16
|
+
// 引入 KeyboardAware 系列组件
|
|
17
|
+
import {
|
|
18
|
+
KeyboardAwareScrollView,
|
|
19
|
+
KeyboardAwareFlatList,
|
|
20
|
+
KeyboardAwareSectionList
|
|
21
|
+
} from 'react-native-keyboard-aware-scroll-view';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* # Screen 组件使用指南
|
|
25
|
+
*
|
|
26
|
+
* 核心原则:统一使用手动安全区管理 (padding),支持沉浸式布局,解决 iOS/Android 状态栏一致性问题。
|
|
27
|
+
*
|
|
28
|
+
* ## 1. 普通页面 (默认)
|
|
29
|
+
* - 场景:标准的白底或纯色背景页面,Header 在安全区下方。
|
|
30
|
+
* - 用法:`<Screen>{children}</Screen>`
|
|
31
|
+
* - 行为:自动处理上下左右安全区,状态栏文字黑色。
|
|
32
|
+
*
|
|
33
|
+
* ## 2. 沉浸式 Header (推荐)
|
|
34
|
+
* - 场景:Header 背景色/图片需要延伸到状态栏 (如首页、个人中心)。
|
|
35
|
+
* - 用法:`<Screen safeAreaEdges={['left', 'right', 'bottom']}>` (去掉 'top')
|
|
36
|
+
* - 配合:页面内部 Header 组件必须手动添加 paddingTop:
|
|
37
|
+
* ```tsx
|
|
38
|
+
* const insets = useSafeAreaInsets();
|
|
39
|
+
* <View style={{ paddingTop: insets.top + 12, backgroundColor: '...' }}>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* ## 3. 底部有 TabBar 或 悬浮按钮
|
|
43
|
+
* - 场景:页面底部有固定导航栏,或者需要精细控制底部留白。
|
|
44
|
+
* - 用法:`<Screen safeAreaEdges={['top', 'left', 'right']}>` (去掉 'bottom')
|
|
45
|
+
* - 配合:
|
|
46
|
+
* - 若是滚动页:`<ScrollView contentContainerStyle={{ paddingBottom: insets.bottom + 80 }}>`
|
|
47
|
+
* - 若是固定页:`<View style={{ paddingBottom: insets.bottom + 60 }}>`
|
|
48
|
+
*
|
|
49
|
+
* ## 4. 滚动列表/表单
|
|
50
|
+
* - 场景:长内容,需要键盘避让。
|
|
51
|
+
* - 用法:`<Screen>{children}</Screen>`
|
|
52
|
+
* - 行为:若子树不包含 ScrollView/FlatList/SectionList,则外层自动使用 ScrollView,
|
|
53
|
+
* 自动处理键盘遮挡,底部安全区会自动加在内容末尾。
|
|
54
|
+
*/
|
|
55
|
+
interface ScreenProps {
|
|
56
|
+
children: React.ReactNode;
|
|
57
|
+
/** 背景色,默认 #fff */
|
|
58
|
+
backgroundColor?: string;
|
|
59
|
+
/**
|
|
60
|
+
* 状态栏样式
|
|
61
|
+
* - 'dark': 黑色文字 (默认)
|
|
62
|
+
* - 'light': 白色文字 (深色背景时用)
|
|
63
|
+
*/
|
|
64
|
+
statusBarStyle?: 'auto' | 'inverted' | 'light' | 'dark';
|
|
65
|
+
/**
|
|
66
|
+
* 状态栏背景色
|
|
67
|
+
* - 默认 'transparent' 以支持沉浸式
|
|
68
|
+
* - Android 下如果需要不透明,可传入具体颜色
|
|
69
|
+
*/
|
|
70
|
+
statusBarColor?: string;
|
|
71
|
+
/**
|
|
72
|
+
* 安全区控制 (关键属性)
|
|
73
|
+
* - 默认: ['top', 'left', 'right', 'bottom'] (全避让)
|
|
74
|
+
* - 沉浸式 Header: 去掉 'top'
|
|
75
|
+
* - 自定义底部: 去掉 'bottom'
|
|
76
|
+
*/
|
|
77
|
+
safeAreaEdges?: Edge[];
|
|
78
|
+
/** 自定义容器样式 */
|
|
79
|
+
style?: ViewStyle;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
type KeyboardAwareProps = {
|
|
83
|
+
element: React.ReactElement<any, any>;
|
|
84
|
+
extraPadding: number;
|
|
85
|
+
contentInsetBehaviorIOS: 'automatic' | 'never';
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const KeyboardAwareScrollable = ({
|
|
89
|
+
element,
|
|
90
|
+
extraPadding,
|
|
91
|
+
contentInsetBehaviorIOS,
|
|
92
|
+
}: KeyboardAwareProps) => {
|
|
93
|
+
// 获取原始组件的 props
|
|
94
|
+
const childAttrs: any = (element as any).props || {};
|
|
95
|
+
const originStyle = childAttrs['contentContainerStyle'];
|
|
96
|
+
const styleArray = Array.isArray(originStyle) ? originStyle : originStyle ? [originStyle] : [];
|
|
97
|
+
const merged = Object.assign({}, ...styleArray);
|
|
98
|
+
const currentPB = typeof merged.paddingBottom === 'number' ? merged.paddingBottom : 0;
|
|
99
|
+
|
|
100
|
+
// 合并 paddingBottom (安全区 + 额外留白)
|
|
101
|
+
const enhancedContentStyle = [{ ...merged, paddingBottom: currentPB + extraPadding }];
|
|
102
|
+
|
|
103
|
+
// 基础配置 props,用于传递给 KeyboardAware 组件
|
|
104
|
+
const commonProps = {
|
|
105
|
+
...childAttrs,
|
|
106
|
+
contentContainerStyle: enhancedContentStyle,
|
|
107
|
+
keyboardShouldPersistTaps: childAttrs['keyboardShouldPersistTaps'] ?? 'handled',
|
|
108
|
+
keyboardDismissMode: childAttrs['keyboardDismissMode'] ?? 'on-drag',
|
|
109
|
+
enableOnAndroid: true,
|
|
110
|
+
// 类似于原代码中的 setTimeout/scrollToEnd 逻辑,这里设置额外的滚动高度确保输入框可见
|
|
111
|
+
extraHeight: 100,
|
|
112
|
+
// 禁用自带的 ScrollView 自动 inset,由外部 padding 控制
|
|
113
|
+
enableAutomaticScroll: true,
|
|
114
|
+
...(Platform.OS === 'ios'
|
|
115
|
+
? { contentInsetAdjustmentBehavior: childAttrs['contentInsetAdjustmentBehavior'] ?? contentInsetBehaviorIOS }
|
|
116
|
+
: {}),
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const t = (element as any).type;
|
|
120
|
+
|
|
121
|
+
// 根据组件类型返回对应的 KeyboardAware 版本
|
|
122
|
+
// 注意:不再使用 KeyboardAvoidingView,直接替换为增强版 ScrollView
|
|
123
|
+
if (t === ScrollView) {
|
|
124
|
+
return <KeyboardAwareScrollView {...commonProps} />;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (t === FlatList) {
|
|
128
|
+
return <KeyboardAwareFlatList {...commonProps} />;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (t === SectionList) {
|
|
132
|
+
return <KeyboardAwareSectionList {...commonProps} />;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// 理论上不应运行到这里,如果是非标准组件则原样返回,仅修改样式
|
|
136
|
+
return React.cloneElement(element, {
|
|
137
|
+
contentContainerStyle: enhancedContentStyle,
|
|
138
|
+
keyboardShouldPersistTaps: childAttrs['keyboardShouldPersistTaps'] ?? 'handled',
|
|
139
|
+
keyboardDismissMode: childAttrs['keyboardDismissMode'] ?? 'on-drag',
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const Screen = ({
|
|
144
|
+
children,
|
|
145
|
+
backgroundColor = '#fff',
|
|
146
|
+
statusBarStyle = 'dark',
|
|
147
|
+
statusBarColor = 'transparent',
|
|
148
|
+
safeAreaEdges = ['top', 'left', 'right', 'bottom'],
|
|
149
|
+
style,
|
|
150
|
+
}: ScreenProps) => {
|
|
151
|
+
const insets = useSafeAreaInsets();
|
|
152
|
+
const [keyboardShown, setKeyboardShown] = React.useState(false);
|
|
153
|
+
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
|
|
156
|
+
const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
|
|
157
|
+
const s1 = Keyboard.addListener(showEvent, () => setKeyboardShown(true));
|
|
158
|
+
const s2 = Keyboard.addListener(hideEvent, () => setKeyboardShown(false));
|
|
159
|
+
return () => { s1.remove(); s2.remove(); };
|
|
160
|
+
}, []);
|
|
161
|
+
|
|
162
|
+
// 自动检测:若子树中包含 ScrollView/FlatList/SectionList,则认为页面自身处理滚动
|
|
163
|
+
const isNodeScrollable = (node: React.ReactNode): boolean => {
|
|
164
|
+
const isScrollableElement = (el: unknown): boolean => {
|
|
165
|
+
if (!React.isValidElement(el)) return false;
|
|
166
|
+
const element = el as React.ReactElement<any, any>;
|
|
167
|
+
const t = element.type;
|
|
168
|
+
// 不递归检查 Modal 内容,避免将弹窗内的 ScrollView 误判为页面已具备垂直滚动
|
|
169
|
+
if (t === Modal) return false;
|
|
170
|
+
const props = element.props as Record<string, unknown> | undefined;
|
|
171
|
+
// 仅识别“垂直”滚动容器;横向滚动不视为页面已处理垂直滚动
|
|
172
|
+
// eslint-disable-next-line react/prop-types
|
|
173
|
+
const isHorizontal = !!(props && (props as any).horizontal === true);
|
|
174
|
+
if ((t === ScrollView || t === FlatList || t === SectionList) && !isHorizontal) return true;
|
|
175
|
+
const c: React.ReactNode | undefined = props && 'children' in props
|
|
176
|
+
? (props.children as React.ReactNode)
|
|
177
|
+
: undefined;
|
|
178
|
+
if (Array.isArray(c)) return c.some(isScrollableElement);
|
|
179
|
+
return c ? isScrollableElement(c) : false;
|
|
180
|
+
};
|
|
181
|
+
if (Array.isArray(node)) return node.some(isScrollableElement);
|
|
182
|
+
return isScrollableElement(node);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const childIsNativeScrollable = isNodeScrollable(children);
|
|
186
|
+
|
|
187
|
+
// 说明:避免双重补白
|
|
188
|
+
// KeyboardAwareScrollView 内部会自动处理键盘高度。
|
|
189
|
+
// 我们主要关注非键盘状态下的 Safe Area 管理。
|
|
190
|
+
|
|
191
|
+
// 解析安全区设置
|
|
192
|
+
const hasTop = safeAreaEdges.includes('top');
|
|
193
|
+
const hasBottom = safeAreaEdges.includes('bottom');
|
|
194
|
+
const hasLeft = safeAreaEdges.includes('left');
|
|
195
|
+
const hasRight = safeAreaEdges.includes('right');
|
|
196
|
+
|
|
197
|
+
// 强制禁用 iOS 自动调整内容区域,完全由手动 padding 控制,消除系统自动计算带来的多余空白
|
|
198
|
+
const contentInsetBehaviorIOS = 'never';
|
|
199
|
+
|
|
200
|
+
const wrapperStyle: ViewStyle = {
|
|
201
|
+
flex: 1,
|
|
202
|
+
backgroundColor,
|
|
203
|
+
paddingTop: hasTop ? insets.top : 0,
|
|
204
|
+
paddingLeft: hasLeft ? insets.left : 0,
|
|
205
|
+
paddingRight: hasRight ? insets.right : 0,
|
|
206
|
+
// 当页面不使用外层 ScrollView 时(子树本身可滚动),由外层 View 负责底部安全区
|
|
207
|
+
paddingBottom: (childIsNativeScrollable && hasBottom)
|
|
208
|
+
? (keyboardShown ? 0 : insets.bottom)
|
|
209
|
+
: 0,
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// 若子树不可滚动,则外层使用 KeyboardAwareScrollView 提供“全局页面滑动”能力
|
|
213
|
+
const useScrollContainer = !childIsNativeScrollable;
|
|
214
|
+
|
|
215
|
+
// 2. 滚动容器配置
|
|
216
|
+
// 如果使用滚动容器,则使用 KeyboardAwareScrollView 替代原有的 ScrollView
|
|
217
|
+
const Container = useScrollContainer ? KeyboardAwareScrollView : View;
|
|
218
|
+
|
|
219
|
+
const containerProps = useScrollContainer ? {
|
|
220
|
+
contentContainerStyle: {
|
|
221
|
+
flexGrow: 1,
|
|
222
|
+
// 滚动模式下,Bottom 安全区由内容容器处理,保证内容能完整显示且不被 Home Indicator 遮挡,同时背景色能延伸到底部
|
|
223
|
+
paddingBottom: hasBottom ? (keyboardShown ? 0 : insets.bottom) : 0,
|
|
224
|
+
},
|
|
225
|
+
keyboardShouldPersistTaps: 'handled' as const,
|
|
226
|
+
showsVerticalScrollIndicator: false,
|
|
227
|
+
keyboardDismissMode: 'on-drag' as const,
|
|
228
|
+
enableOnAndroid: true,
|
|
229
|
+
extraHeight: 100, // 替代原代码手动计算的 offset
|
|
230
|
+
// iOS 顶部白条修复:强制不自动添加顶部安全区
|
|
231
|
+
...(Platform.OS === 'ios'
|
|
232
|
+
? { contentInsetAdjustmentBehavior: contentInsetBehaviorIOS }
|
|
233
|
+
: {}),
|
|
234
|
+
} : {};
|
|
235
|
+
|
|
236
|
+
// 3. 若子元素自身包含滚动容器,给该滚动容器单独添加键盘避让,不影响其余固定元素(如底部栏)
|
|
237
|
+
const wrapScrollableWithKeyboardAvoid = (nodes: React.ReactNode): React.ReactNode => {
|
|
238
|
+
const isVerticalScrollable = (el: React.ReactElement<any, any>): boolean => {
|
|
239
|
+
const t = el.type;
|
|
240
|
+
const elementProps = (el as any).props || {};
|
|
241
|
+
const isHorizontal = !!(elementProps as any).horizontal;
|
|
242
|
+
return (t === ScrollView || t === FlatList || t === SectionList) && !isHorizontal;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const wrapIfNeeded = (el: React.ReactElement<any, any>, idx?: number): React.ReactElement => {
|
|
246
|
+
if (isVerticalScrollable(el)) {
|
|
247
|
+
return (
|
|
248
|
+
<KeyboardAwareScrollable
|
|
249
|
+
key={el.key ?? idx}
|
|
250
|
+
element={el}
|
|
251
|
+
extraPadding={keyboardShown ? 0 : (hasBottom ? insets.bottom : 0)}
|
|
252
|
+
contentInsetBehaviorIOS={contentInsetBehaviorIOS}
|
|
253
|
+
/>
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
return el;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
if (Array.isArray(nodes)) {
|
|
260
|
+
return nodes.map((n, idx) => {
|
|
261
|
+
if (React.isValidElement(n)) {
|
|
262
|
+
return wrapIfNeeded(n as React.ReactElement<any, any>, idx);
|
|
263
|
+
}
|
|
264
|
+
return n;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
if (React.isValidElement(nodes)) {
|
|
268
|
+
return wrapIfNeeded(nodes as React.ReactElement<any, any>, 0);
|
|
269
|
+
}
|
|
270
|
+
return nodes;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
return (
|
|
274
|
+
// 核心原则:严禁使用 SafeAreaView,统一使用 View + padding 手动管理
|
|
275
|
+
<View style={wrapperStyle}>
|
|
276
|
+
{/* 状态栏配置:强制透明背景 + 沉浸式,以支持背景图延伸 */}
|
|
277
|
+
<StatusBar
|
|
278
|
+
style={statusBarStyle}
|
|
279
|
+
backgroundColor={statusBarColor}
|
|
280
|
+
translucent
|
|
281
|
+
/>
|
|
282
|
+
|
|
283
|
+
{/* 键盘避让:仅当外层使用 ScrollView 时启用,避免固定底部栏随键盘上移 */}
|
|
284
|
+
{useScrollContainer ? (
|
|
285
|
+
// 替换为 KeyboardAwareScrollView,移除原先的 KeyboardAvoidingView 包裹
|
|
286
|
+
// 因为 KeyboardAwareScrollView 已经内置了处理逻辑
|
|
287
|
+
<Container style={[styles.innerContainer, style]} {...containerProps}>
|
|
288
|
+
{children}
|
|
289
|
+
</Container>
|
|
290
|
+
) : (
|
|
291
|
+
// 页面自身已处理滚动,不启用全局键盘避让,保证固定底部栏不随键盘上移
|
|
292
|
+
childIsNativeScrollable ? (
|
|
293
|
+
<View style={[styles.innerContainer, style]}>
|
|
294
|
+
{wrapScrollableWithKeyboardAvoid(children)}
|
|
295
|
+
</View>
|
|
296
|
+
) : (
|
|
297
|
+
<TouchableWithoutFeedback onPress={Keyboard.dismiss} disabled={Platform.OS === 'web'}>
|
|
298
|
+
<View style={[styles.innerContainer, style]}>
|
|
299
|
+
{children}
|
|
300
|
+
</View>
|
|
301
|
+
</TouchableWithoutFeedback>
|
|
302
|
+
)
|
|
303
|
+
)}
|
|
304
|
+
</View>
|
|
305
|
+
);
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
const styles = StyleSheet.create({
|
|
309
|
+
innerContainer: {
|
|
310
|
+
flex: 1,
|
|
311
|
+
// 确保内部容器透明,避免背景色遮挡
|
|
312
|
+
backgroundColor: 'transparent',
|
|
313
|
+
},
|
|
314
|
+
});
|