Browse Source

feat: 添加page示例

master
echo 1 month ago
parent
commit
f551a26a0a
  1. 4
      README.md
  2. 2
      app/(tabs)/demo.tsx
  3. 2
      app/test.tsx
  4. 45
      pages/TestPage/index.tsx
  5. 38
      pages/TestPage/styles.ts
  6. 36
      pages/index.ts
  7. 36
      screens/index.ts

4
README.md

@ -110,7 +110,7 @@ rn-demo/
│ │ ├── demo.tsx # 完整示例页面 🎯
│ │ ├── paper.tsx # React Native Paper 示例
│ │ └── _layout.tsx # 标签布局
│ ├── test-page.tsx # 测试页面(无 tabs)🎯
│ ├── test.tsx # 测试页面(无 tabs)🎯
│ ├── _layout.tsx # 根布局 - 自动检查更新 ⭐
│ ├── modal.tsx # 模态页面示例
│ ├── +html.tsx # Web HTML 模板
@ -223,7 +223,7 @@ rn-demo/
- **`app/_layout.tsx`** - 应用启动时自动检查更新
- **`app/(tabs)/index.tsx`** - 热更新演示页面
- **`app/(tabs)/demo.tsx`** - 完整示例页面,展示所有工具的使用 🎯
- **`app/test-page.tsx`** - 测试页面示例(不包含底部 tabs)🎯
- **`app/test.tsx`** - 测试页面示例(不包含底部 tabs)🎯
#### 💻 业务代码目录(扁平化结构)🎯

2
app/(tabs)/demo.tsx

@ -298,7 +298,7 @@ export default function DemoScreen() {
style={[styles.button, styles.primaryButton]}
onPress={() => {
haptics.light();
router.push('/test-page');
router.push('/test');
}}
>
<Text style={styles.buttonText}> </Text>

2
app/test.tsx

@ -0,0 +1,2 @@
import { TestPage } from '@/pages';
export default TestPage;

45
app/test-page.tsx → pages/TestPage/index.tsx

@ -1,12 +1,13 @@
import { StyleSheet, ScrollView } from 'react-native';
import { ScrollView } from 'react-native';
import { Stack, useRouter } from 'expo-router';
import { ThemedText, ThemedView } from '@/components';
import { styles } from './styles';
/**
*
*
*
* tabs
*
*
*
* - header
* -
@ -79,41 +80,3 @@ export default function TestPage() {
</>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
scrollView: {
flex: 1,
},
content: {
padding: 20,
},
title: {
marginBottom: 16,
},
description: {
marginBottom: 24,
lineHeight: 24,
},
section: {
marginBottom: 24,
},
item: {
marginTop: 8,
marginLeft: 8,
lineHeight: 24,
},
infoBox: {
padding: 16,
borderRadius: 8,
backgroundColor: 'rgba(0, 122, 255, 0.1)',
marginTop: 8,
},
infoText: {
marginTop: 8,
lineHeight: 22,
},
});

38
pages/TestPage/styles.ts

@ -0,0 +1,38 @@
import { StyleSheet } from 'react-native';
export const styles = StyleSheet.create({
container: {
flex: 1,
},
scrollView: {
flex: 1,
},
content: {
padding: 20,
},
title: {
marginBottom: 16,
},
description: {
marginBottom: 24,
lineHeight: 24,
},
section: {
marginBottom: 24,
},
item: {
marginTop: 8,
marginLeft: 8,
lineHeight: 24,
},
infoBox: {
padding: 16,
borderRadius: 8,
backgroundColor: 'rgba(0, 122, 255, 0.1)',
marginTop: 8,
},
infoText: {
marginTop: 8,
lineHeight: 22,
},
});

36
pages/index.ts

@ -0,0 +1,36 @@
/**
* pages
*
*
*
*
* pages/
* index.ts #
* TestPage/ #
* index.tsx #
* components/ #
* styles.ts #
* ProfilePage/ #
* SettingsPage/ #
*
* 使
* 1. pages/
* 2. app/ pages/
* 3. 便
*
*
* ```typescript
* // pages/TestPage/index.tsx
* export default function TestPage() {
* return <View>...</View>;
* }
*
* // app/test.tsx
* import TestPage from '@/pages/TestPage';
* export default TestPage;
* ```
*/
// 导出业务页面组件
export { default as TestPage } from './TestPage';

36
screens/index.ts

@ -1,36 +0,0 @@
/**
* Screens
*
*
*
*
* screens/
* index.ts #
* TestScreen/ #
* index.tsx #
* components/ #
* styles.ts #
* ProfileScreen/ #
* SettingsScreen/ #
*
* 使
* 1. screens/
* 2. app/ screens/
* 3. 便
*
*
* ```typescript
* // screens/TestScreen/index.tsx
* export default function TestScreen() {
* return <View>...</View>;
* }
*
* // app/test.tsx
* import TestScreen from '@/screens/TestScreen';
* export default TestScreen;
* ```
*/
// 当前暂无导出,等待添加业务页面组件
export {};
Loading…
Cancel
Save