@coze-arch/cli 0.0.1-alpha.ee5d83 → 0.0.1-alpha.ef8b63

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.
Files changed (103) hide show
  1. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +30 -21
  2. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +2 -2
  3. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +2 -2
  4. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
  5. package/lib/__templates__/expo/README.md +4 -2
  6. package/lib/__templates__/expo/client/app/+not-found.tsx +30 -0
  7. package/lib/__templates__/expo/client/app/_layout.tsx +15 -12
  8. package/lib/__templates__/expo/client/app/index.tsx +1 -1
  9. package/lib/__templates__/expo/client/app.config.ts +4 -3
  10. package/lib/__templates__/expo/client/components/Screen.tsx +1 -17
  11. package/lib/__templates__/expo/client/components/ThemedView.tsx +1 -2
  12. package/lib/__templates__/expo/client/constants/theme.ts +21 -698
  13. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  14. package/lib/__templates__/expo/client/eslint.config.mjs +33 -10
  15. package/lib/__templates__/expo/client/hooks/{useColorScheme.ts → useColorScheme.tsx} +20 -6
  16. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  17. package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
  18. package/lib/__templates__/expo/client/metro.config.js +3 -0
  19. package/lib/__templates__/expo/client/package.json +36 -34
  20. package/lib/__templates__/expo/client/screens/{home → demo}/index.tsx +4 -4
  21. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +1 -0
  22. package/lib/__templates__/expo/client/utils/index.ts +22 -0
  23. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  24. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  25. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  26. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  27. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  28. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  29. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  30. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  31. package/lib/__templates__/expo/package.json +3 -0
  32. package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
  33. package/lib/__templates__/expo/pnpm-lock.yaml +1318 -2636
  34. package/lib/__templates__/expo/server/build.js +21 -0
  35. package/lib/__templates__/expo/server/package.json +9 -7
  36. package/lib/__templates__/expo/server/src/index.ts +3 -1
  37. package/lib/__templates__/expo/template.config.js +56 -0
  38. package/lib/__templates__/native-static/.coze +11 -0
  39. package/lib/__templates__/native-static/index.html +33 -0
  40. package/lib/__templates__/native-static/styles/main.css +136 -0
  41. package/lib/__templates__/native-static/template.config.js +22 -0
  42. package/lib/__templates__/nextjs/.babelrc +15 -0
  43. package/lib/__templates__/nextjs/next.config.ts +2 -2
  44. package/lib/__templates__/nextjs/package.json +11 -1
  45. package/lib/__templates__/nextjs/pnpm-lock.yaml +2701 -1813
  46. package/lib/__templates__/nextjs/src/app/layout.tsx +5 -3
  47. package/lib/__templates__/nextjs/src/app/page.tsx +17 -59
  48. package/lib/__templates__/nextjs/template.config.js +47 -12
  49. package/lib/__templates__/taro/.coze +14 -0
  50. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
  51. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
  52. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
  53. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
  54. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
  55. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -0
  56. package/lib/__templates__/taro/README.md +751 -0
  57. package/lib/__templates__/taro/_gitignore +40 -0
  58. package/lib/__templates__/taro/_npmrc +18 -0
  59. package/lib/__templates__/taro/babel.config.js +12 -0
  60. package/lib/__templates__/taro/config/dev.ts +9 -0
  61. package/lib/__templates__/taro/config/index.ts +174 -0
  62. package/lib/__templates__/taro/config/prod.ts +35 -0
  63. package/lib/__templates__/taro/eslint.config.mjs +80 -0
  64. package/lib/__templates__/taro/key/private.appid.key +0 -0
  65. package/lib/__templates__/taro/package.json +97 -0
  66. package/lib/__templates__/taro/pnpm-lock.yaml +22706 -0
  67. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  68. package/lib/__templates__/taro/project.config.json +15 -0
  69. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  70. package/lib/__templates__/taro/server/package.json +40 -0
  71. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  72. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  73. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  74. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  75. package/lib/__templates__/taro/server/src/main.ts +49 -0
  76. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  77. package/lib/__templates__/taro/src/app.config.ts +11 -0
  78. package/lib/__templates__/taro/src/app.css +52 -0
  79. package/lib/__templates__/taro/src/app.tsx +9 -0
  80. package/lib/__templates__/taro/src/index.html +39 -0
  81. package/lib/__templates__/taro/src/network.ts +39 -0
  82. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  83. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  84. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  85. package/lib/__templates__/taro/src/presets/h5-container.tsx +17 -0
  86. package/lib/__templates__/taro/src/presets/h5-navbar.tsx +167 -0
  87. package/lib/__templates__/taro/src/presets/h5-styles.ts +88 -0
  88. package/lib/__templates__/taro/src/presets/index.tsx +18 -0
  89. package/lib/__templates__/taro/src/presets/wx-debug.ts +23 -0
  90. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  91. package/lib/__templates__/taro/template.config.js +68 -0
  92. package/lib/__templates__/taro/tsconfig.json +29 -0
  93. package/lib/__templates__/taro/types/global.d.ts +32 -0
  94. package/lib/__templates__/templates.json +43 -0
  95. package/lib/__templates__/vite/package.json +10 -1
  96. package/lib/__templates__/vite/pnpm-lock.yaml +350 -2341
  97. package/lib/__templates__/vite/src/main.ts +17 -48
  98. package/lib/__templates__/vite/template.config.js +47 -10
  99. package/lib/__templates__/vite/vite.config.ts +1 -0
  100. package/lib/cli.js +850 -135
  101. package/package.json +2 -1
  102. package/lib/__templates__/expo/client/app/home.tsx +0 -1
  103. /package/lib/__templates__/expo/client/screens/{home → demo}/styles.ts +0 -0
@@ -1,7 +1,7 @@
1
- ROOT_DIR="$(cd "$(dirname "$0")" && pwd)"
1
+ ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
2
2
  PREVIEW_DIR="${COZE_PREVIEW_DIR:-/source/preview}"
3
3
  LOG_DIR="${COZE_LOG_DIR:-$ROOT_DIR/logs}"
4
- LOG_FILE="$LOG_DIR/app.log"
4
+ LOG_CLIENT_FILE="$LOG_DIR/client.log"
5
5
  mkdir -p "$LOG_DIR"
6
6
 
7
7
  # ==================== 配置项 ====================
@@ -15,13 +15,14 @@ EXPO_PORT="5000"
15
15
  WEB_URL="${COZE_PROJECT_DOMAIN_DEFAULT:-http://127.0.0.1:${SERVER_PORT}}"
16
16
  ASSUME_YES="1"
17
17
  EXPO_PUBLIC_BACKEND_BASE_URL="${EXPO_PUBLIC_BACKEND_BASE_URL:-$WEB_URL}"
18
-
18
+ EXPO_PUBLIC_COZE_PROJECT_ID="${COZE_PROJECT_ID:-}"
19
19
 
20
20
  EXPO_PACKAGER_PROXY_URL="${EXPO_PUBLIC_BACKEND_BASE_URL}"
21
- export EXPO_PUBLIC_BACKEND_BASE_URL EXPO_PACKAGER_PROXY_URL
21
+ export EXPO_PUBLIC_BACKEND_BASE_URL EXPO_PACKAGER_PROXY_URL EXPO_PUBLIC_COZE_PROJECT_ID
22
22
  # 运行时变量(为避免 set -u 的未绑定错误,预置为空)
23
23
  SERVER_PID=""
24
24
  EXPO_PID=""
25
+
25
26
  # ==================== 工具函数 ====================
26
27
  check_command() {
27
28
  if ! command -v "$1" &> /dev/null; then
@@ -88,14 +89,17 @@ ensure_port() {
88
89
  pipe_to_log() {
89
90
  local source="${1:-CLIENT}"
90
91
  local raw_log="${2:-}"
91
- local line timestamp ts msg record
92
+ local line clean_line timestamp
92
93
  while IFS= read -r line || [ -n "$line" ]; do
94
+ clean_line=$(printf '%s' "$line" | sed 's/\x1b\[[0-9;]*[mA-Za-z]//g')
95
+ if echo "$clean_line" | grep -qE '(^(Web|iOS|Android) node_modules/.*expo-router.*entry\.js.*%|^(Web|iOS|Android) Bundled [0-9]+ms node_modules/.*expo-router.*entry\.js|Logs will appear in the browser)'; then
96
+ continue
97
+ fi
93
98
  if [ -n "$raw_log" ]; then
94
- echo "$line" >> "$raw_log"
99
+ timestamp=$(date '+%Y-%m-%d %H:%M:%S')
100
+ echo "[$timestamp] $clean_line" >> "$raw_log"
95
101
  fi
96
- line=$(echo "[$source] $line" | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g; s/\x1b\[[0-9;]*m//g')
97
- msg="${line}"
98
- echo "$msg"
102
+ printf '[%s] %s\n' "$source" "$clean_line"
99
103
  done
100
104
  }
101
105
 
@@ -111,14 +115,14 @@ wait_port_connectable() {
111
115
  start_expo() {
112
116
  local offline="${1:-0}"
113
117
 
114
- pushd ./client
118
+ pushd "$ROOT_DIR/client"
115
119
 
116
120
  if [ "$offline" = "1" ]; then
117
- ( EXPO_OFFLINE=1 EXPO_NO_DOCTOR=1 EXPO_PUBLIC_BACKEND_BASE_URL="$EXPO_PUBLIC_BACKEND_BASE_URL" EXPO_PACKAGER_PROXY_URL="$EXPO_PACKAGER_PROXY_URL" \
118
- nohup npx expo start --clear --port "$EXPO_PORT" 2>&1 | pipe_to_log "CLIENT" "../logs/client.log" ) &
121
+ ( EXPO_OFFLINE=1 EXPO_NO_DEPENDENCY_VALIDATION=1 EXPO_PUBLIC_BACKEND_BASE_URL="$EXPO_PUBLIC_BACKEND_BASE_URL" EXPO_PACKAGER_PROXY_URL="$EXPO_PACKAGER_PROXY_URL" EXPO_PUBLIC_COZE_PROJECT_ID="$EXPO_PUBLIC_COZE_PROJECT_ID" \
122
+ nohup npx expo start --clear --port "$EXPO_PORT" 2>&1 | pipe_to_log "CLIENT" "$LOG_CLIENT_FILE" ) &
119
123
  else
120
- ( EXPO_NO_DOCTOR=1 EXPO_PUBLIC_BACKEND_BASE_URL="$EXPO_PUBLIC_BACKEND_BASE_URL" EXPO_PACKAGER_PROXY_URL="$EXPO_PACKAGER_PROXY_URL" \
121
- nohup npx expo start --clear --port "$EXPO_PORT" 2>&1 | pipe_to_log "CLIENT" "../logs/client.log" ) &
124
+ ( EXPO_NO_DEPENDENCY_VALIDATION=1 EXPO_PUBLIC_BACKEND_BASE_URL="$EXPO_PUBLIC_BACKEND_BASE_URL" EXPO_PACKAGER_PROXY_URL="$EXPO_PACKAGER_PROXY_URL" EXPO_PUBLIC_COZE_PROJECT_ID="$EXPO_PUBLIC_COZE_PROJECT_ID" \
125
+ nohup npx expo start --clear --port "$EXPO_PORT" 2>&1 | pipe_to_log "CLIENT" "$LOG_CLIENT_FILE" ) &
122
126
  fi
123
127
  EXPO_PID=$!
124
128
  disown $EXPO_PID 2>/dev/null || true
@@ -129,9 +133,9 @@ start_expo() {
129
133
  detect_expo_fetch_failed() {
130
134
  local timeout="${1:-8}"
131
135
  local waited=0
132
- local log_file="logs/client.log"
136
+ local log_file="$LOG_CLIENT_FILE"
133
137
  while [ "$waited" -lt "$timeout" ]; do
134
- if [ -f "$log_file" ] && grep -q "TypeError: fetch failed" "$log_file" 2>/dev/null; then
138
+ if [ -f "$log_file" ] && tail -n 100 "$log_file" 2>/dev/null | grep -q "TypeError: fetch failed"; then
135
139
  return 0
136
140
  fi
137
141
  sleep 1
@@ -150,6 +154,12 @@ if [ -f "$PREVIEW_DIR/pre_install.py" ]; then
150
154
  python "$PREVIEW_DIR/pre_install.py" || echo "pre_install.py 执行失败"
151
155
  fi
152
156
 
157
+ echo "检查根目录 post_install.py"
158
+ if [ -f "$PREVIEW_DIR/post_install.py" ]; then
159
+ echo "执行:python $PREVIEW_DIR/post_install.py"
160
+ python "$PREVIEW_DIR/post_install.py" || echo "post_install.py 执行失败"
161
+ fi
162
+
153
163
  echo "==================== 开始启动 ===================="
154
164
  echo "开始执行服务启动脚本(start_dev.sh)..."
155
165
  echo "正在检查依赖命令和目录是否存在..."
@@ -159,15 +169,13 @@ check_command "pnpm"
159
169
  check_command "lsof"
160
170
  check_command "bash"
161
171
 
162
- echo "准备日志目录:logs"
163
- mkdir -p logs
164
172
  # 端口占用预检查与处理
165
173
  ensure_port SERVER_PORT "$SERVER_PORT"
166
174
  ensure_port EXPO_PORT "$EXPO_PORT"
167
175
 
168
176
  echo "==================== 启动 server 服务 ===================="
169
- echo "正在执行:npm run dev"
170
- ( PORT="$SERVER_PORT" nohup npm run dev --prefix ./server 2>&1 | pipe_to_log "SERVER" "logs/server.log" ) &
177
+ echo "正在执行:pnpm run dev (server)"
178
+ ( pushd "$ROOT_DIR/server" > /dev/null && SERVER_PORT="$SERVER_PORT" nohup pnpm run dev; popd > /dev/null ) &
171
179
  SERVER_PID=$!
172
180
  disown $SERVER_PID 2>/dev/null || true
173
181
  if [ -z "${SERVER_PID}" ]; then
@@ -181,13 +189,14 @@ start_expo 0
181
189
  if detect_expo_fetch_failed 8; then
182
190
  echo "Expo 启动检测到网络错误:TypeError: fetch failed,启用离线模式重试"
183
191
  if [ -n "${EXPO_PID}" ]; then kill -9 "$EXPO_PID" 2>/dev/null || true; fi
184
- : > logs/client.log
192
+ : > "$ROOT_DIR/logs/client.log"
185
193
  start_expo 1
186
194
  fi
187
195
  # 输出以下环境变量,确保 Expo 项目能正确连接到 Server 服务
188
196
  echo "Expo 环境变量配置:"
189
197
  echo "EXPO_PUBLIC_BACKEND_BASE_URL=${EXPO_PUBLIC_BACKEND_BASE_URL}"
190
198
  echo "EXPO_PACKAGER_PROXY_URL=${EXPO_PACKAGER_PROXY_URL}"
199
+ echo "EXPO_PUBLIC_COZE_PROJECT_ID=${EXPO_PUBLIC_COZE_PROJECT_ID}"
191
200
  if [ -z "${EXPO_PID}" ]; then
192
201
  echo "无法获取 Expo 后台进程 PID"
193
202
  fi
@@ -40,8 +40,8 @@ fi
40
40
  info "==================== 依赖安装完成!====================\n"
41
41
 
42
42
  info "==================== dist打包 ===================="
43
- info "开始执行:npm run build --prefix server"
44
- (cd "$ROOT_DIR" && npm run build --prefix ./server) || error "dist打包失败"
43
+ info "开始执行:pnpm run build (server)"
44
+ (pushd "$ROOT_DIR/server" > /dev/null && pnpm run build; popd > /dev/null) || error "dist打包失败"
45
45
  info "==================== dist打包完成!====================\n"
46
46
 
47
47
  info "下一步:执行 ./prod_run.sh 启动服务"
@@ -29,6 +29,6 @@ check_command() {
29
29
  check_command "pnpm"
30
30
  check_command "npm"
31
31
 
32
- info "开始执行:npm run start"
33
- (cd "$ROOT_DIR" && PORT="$PORT" npm run start --prefix ./server) || error "服务启动失败"
32
+ info "开始执行:pnpm run start (server)"
33
+ (pushd "$ROOT_DIR/server" > /dev/null && PORT="$PORT" pnpm run start; popd > /dev/null) || error "服务启动失败"
34
34
  info "服务启动完成!\n"
@@ -0,0 +1,46 @@
1
+ #!/bin/bash
2
+
3
+ ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
4
+ SERVER_DIR="$ROOT_DIR/server"
5
+ LOG_DIR="${COZE_LOG_DIR:-$ROOT_DIR/logs}"
6
+ LOG_SERVER_FILE="$LOG_DIR/server.log"
7
+ SERVER_PORT="${SERVER_PORT:-9091}"
8
+
9
+ mkdir -p "$LOG_DIR"
10
+
11
+ pipe_to_log() {
12
+ local source="${1:-SERVER}"
13
+ local raw_log="${2:-}"
14
+ local line clean_line timestamp
15
+ while IFS= read -r line || [ -n "$line" ]; do
16
+ clean_line=$(printf '%s' "$line" | sed 's/\x1b\[[0-9;]*[mA-Za-z]//g')
17
+ if [ -n "$raw_log" ]; then
18
+ timestamp=$(date '+%Y-%m-%d %H:%M:%S')
19
+ echo "[$timestamp] $clean_line" >> "$raw_log"
20
+ fi
21
+ printf '[%s] %s\n' "$source" "$clean_line"
22
+ done
23
+ }
24
+
25
+ kill_old_server() {
26
+ if command -v lsof &> /dev/null; then
27
+ local pids
28
+ pids=$(lsof -t -i tcp:"$SERVER_PORT" -sTCP:LISTEN 2>/dev/null || true)
29
+ if [ -n "$pids" ]; then
30
+ echo "正在关闭旧的 server 进程:$pids"
31
+ kill -9 $pids 2>/dev/null || echo "关闭进程失败:$pids"
32
+ sleep 1
33
+ fi
34
+ fi
35
+ }
36
+
37
+ echo "==================== Server Dev Run ===================="
38
+ echo "Server 目录:$SERVER_DIR"
39
+ echo "Server 端口:$SERVER_PORT"
40
+ echo "日志文件:$LOG_SERVER_FILE"
41
+
42
+ kill_old_server
43
+
44
+ echo "启动 server 服务..."
45
+ cd "$SERVER_DIR"
46
+ NODE_ENV=development PORT="$SERVER_PORT" npx tsx watch ./src/index.ts 2>&1 | pipe_to_log "SERVER" "$LOG_SERVER_FILE"
@@ -15,17 +15,19 @@
15
15
  | └── package.json # 服务端 package.json
16
16
  ├── client/ # React Native 前端代码
17
17
  │ ├── app/ # Expo Router 路由目录(仅路由配置)
18
- │ │ ├── _layout.tsx # 根布局文件(必需)
18
+ │ │ ├── _layout.tsx # 根布局文件(必需,务必阅读)
19
19
  │ │ ├── home.tsx # 首页
20
20
  │ │ └── index.tsx # re-export home.tsx
21
21
  │ ├── screens/ # 页面实现目录(与 app/ 路由对应)
22
- │ │ └── home/
22
+ │ │ └── demo/ # demo 示例页面
23
23
  │ │ ├── index.tsx # 页面组件实现
24
24
  │ │ └── styles.ts # 页面样式
25
25
  │ ├── components/ # 可复用组件
26
26
  │ │ └── Screen.tsx # 页面容器组件(必用)
27
27
  │ ├── hooks/ # 自定义 Hooks
28
28
  │ ├── contexts/ # React Context 代码
29
+ │ ├── constants/ # 常量定义(如主题配置)
30
+ │ ├── utils/ # 工具函数
29
31
  │ ├── assets/ # 静态资源
30
32
  | └── package.json # Expo 应用 package.json
31
33
  ├── package.json
@@ -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
+ });
@@ -5,6 +5,7 @@ import { StatusBar } from 'expo-status-bar';
5
5
  import { LogBox } from 'react-native';
6
6
  import Toast from 'react-native-toast-message';
7
7
  import { AuthProvider } from "@/contexts/AuthContext";
8
+ import { ColorSchemeProvider } from '@/hooks/useColorScheme';
8
9
 
9
10
  LogBox.ignoreLogs([
10
11
  "TurboModuleRegistry.getEnforcing(...): 'RNMapsAirModule' could not be found",
@@ -14,20 +15,22 @@ LogBox.ignoreLogs([
14
15
  export default function RootLayout() {
15
16
  return (
16
17
  <AuthProvider>
18
+ <ColorSchemeProvider>
17
19
  <GestureHandlerRootView style={{ flex: 1 }}>
18
- <StatusBar style="dark"></StatusBar>
19
- <Stack screenOptions={{
20
- // 设置所有页面的切换动画为从右侧滑入,适用于iOS 和 Android
21
- animation: 'slide_from_right',
22
- gestureEnabled: true,
23
- gestureDirection: 'horizontal',
24
- // 隐藏自带的头部
25
- headerShown: false
26
- }}>
27
- <Stack.Screen name="index" options={{ title: "" }} />
28
- </Stack>
29
- <Toast />
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 />
30
32
  </GestureHandlerRootView>
33
+ </ColorSchemeProvider>
31
34
  </AuthProvider>
32
35
  );
33
36
  }
@@ -1 +1 @@
1
- export { default } from './home'
1
+ export { default } from '@/screens/demo';
@@ -1,7 +1,8 @@
1
1
  import { ExpoConfig, ConfigContext } from 'expo/config';
2
2
 
3
- const appName = 'My App';
4
- const slugAppName = 'my-app';
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';
5
6
 
6
7
  export default ({ config }: ConfigContext): ExpoConfig => {
7
8
  return {
@@ -22,7 +23,7 @@ export default ({ config }: ConfigContext): ExpoConfig => {
22
23
  "foregroundImage": "./assets/images/adaptive-icon.png",
23
24
  "backgroundColor": "#ffffff"
24
25
  },
25
- "package": "com.anonymous.myapp"
26
+ "package": `com.anonymous.x${projectId || '0'}`
26
27
  },
27
28
  "web": {
28
29
  "bundler": "metro",
@@ -197,26 +197,10 @@ export const Screen = ({
197
197
  // 强制禁用 iOS 自动调整内容区域,完全由手动 padding 控制,消除系统自动计算带来的多余空白
198
198
  const contentInsetBehaviorIOS = 'never';
199
199
 
200
- // 1. 外层容器样式
201
- // 负责:背景色、Top/Left/Right 安全区、以及非滚动模式下的 Bottom 安全区
202
- const childArray = React.Children.toArray(children);
203
- let firstChild: React.ReactElement<any, any> | null = null;
204
- for (let i = 0; i < childArray.length; i++) {
205
- const el = childArray[i];
206
- if (React.isValidElement(el)) { firstChild = el as React.ReactElement<any, any>; break; }
207
- }
208
- const firstChildHasInlinePaddingTop = (() => {
209
- if (!firstChild) return false;
210
- const st: any = (firstChild as any).props?.style;
211
- const arr = Array.isArray(st) ? st : st ? [st] : [];
212
- return arr.some((s) => s && typeof s === 'object' && typeof (s as any).paddingTop === 'number' && (s as any).paddingTop > 10);
213
- })();
214
- const applyTopInset = hasTop && !firstChildHasInlinePaddingTop;
215
-
216
200
  const wrapperStyle: ViewStyle = {
217
201
  flex: 1,
218
202
  backgroundColor,
219
- paddingTop: applyTopInset ? insets.top : 0,
203
+ paddingTop: hasTop ? insets.top : 0,
220
204
  paddingLeft: hasLeft ? insets.left : 0,
221
205
  paddingRight: hasRight ? insets.right : 0,
222
206
  // 当页面不使用外层 ScrollView 时(子树本身可滚动),由外层 View 负责底部安全区
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { View, ViewProps, ViewStyle } from 'react-native';
3
3
  import { useTheme } from '@/hooks/useTheme';
4
4
 
5
- type BackgroundLevel = 'root' | 'default' | 'secondary' | 'tertiary';
5
+ type BackgroundLevel = 'root' | 'default' | 'tertiary';
6
6
 
7
7
  interface ThemedViewProps extends ViewProps {
8
8
  level?: BackgroundLevel;
@@ -12,7 +12,6 @@ interface ThemedViewProps extends ViewProps {
12
12
  const backgroundMap: Record<BackgroundLevel, string> = {
13
13
  root: 'backgroundRoot',
14
14
  default: 'backgroundDefault',
15
- secondary: 'backgroundSecondary',
16
15
  tertiary: 'backgroundTertiary',
17
16
  };
18
17