refactor: move third-party modules out from SystemInfo to Library
Showing
4 changed files
with
53 additions
and
32 deletions
| @@ -21,6 +21,7 @@ import { Platform } from 'react-native'; | @@ -21,6 +21,7 @@ import { Platform } from 'react-native'; | ||
| 21 | import RNLocalize from './RNLocalize'; | 21 | import RNLocalize from './RNLocalize'; |
| 22 | import { useI18nStrings } from '../i18n'; | 22 | import { useI18nStrings } from '../i18n'; |
| 23 | import CameraScreen from './CameraScreen'; | 23 | import CameraScreen from './CameraScreen'; |
| 24 | +import Library from './Library'; | ||
| 24 | 25 | ||
| 25 | const MainTab = createBottomTabNavigator<MainTabParamList>(); | 26 | const MainTab = createBottomTabNavigator<MainTabParamList>(); |
| 26 | 27 | ||
| @@ -64,6 +65,14 @@ const Home = () => { | @@ -64,6 +65,14 @@ const Home = () => { | ||
| 64 | name={'ios-color-palette'} | 65 | name={'ios-color-palette'} |
| 65 | /> | 66 | /> |
| 66 | ); | 67 | ); |
| 68 | + case 'Library': | ||
| 69 | + return ( | ||
| 70 | + <Ionicons | ||
| 71 | + size={size} | ||
| 72 | + color={color} | ||
| 73 | + name={focused ? 'ios-list-box' : 'ios-list'} | ||
| 74 | + /> | ||
| 75 | + ); | ||
| 67 | default: | 76 | default: |
| 68 | break; | 77 | break; |
| 69 | } | 78 | } |
| @@ -71,6 +80,7 @@ const Home = () => { | @@ -71,6 +80,7 @@ const Home = () => { | ||
| 71 | }; | 80 | }; |
| 72 | }} | 81 | }} |
| 73 | > | 82 | > |
| 83 | + <MainTab.Screen name="Library" component={Library} /> | ||
| 74 | <MainTab.Screen name="SystemInfo" component={SystemInfo} /> | 84 | <MainTab.Screen name="SystemInfo" component={SystemInfo} /> |
| 75 | <MainTab.Screen name="DesignList" component={DesignList} /> | 85 | <MainTab.Screen name="DesignList" component={DesignList} /> |
| 76 | </MainTab.Navigator> | 86 | </MainTab.Navigator> |
src/screen/Library.tsx
0 → 100644
| 1 | +import React from 'react'; | ||
| 2 | +import { BGList, BGScroll, ListItem, Divider } from '../component/View'; | ||
| 3 | +import { MainTabScreenProps } from '../type/Navigation'; | ||
| 4 | +import { useI18nStrings } from '../i18n'; | ||
| 5 | + | ||
| 6 | +const Library = ({ navigation }: MainTabScreenProps<'Library'>) => { | ||
| 7 | + const strings = useI18nStrings(); | ||
| 8 | + return ( | ||
| 9 | + <BGScroll> | ||
| 10 | + <ListItem | ||
| 11 | + title="RNDeviceInfo" | ||
| 12 | + onPress={() => navigation.navigate('RNDeviceInfoList')} | ||
| 13 | + chevron | ||
| 14 | + /> | ||
| 15 | + <Divider /> | ||
| 16 | + <ListItem | ||
| 17 | + title={'RNCWebview'} | ||
| 18 | + onPress={() => | ||
| 19 | + navigation.navigate('WebviewScreen', { | ||
| 20 | + uri: 'https://www.baidu.com', | ||
| 21 | + }) | ||
| 22 | + } | ||
| 23 | + chevron | ||
| 24 | + /> | ||
| 25 | + <Divider /> | ||
| 26 | + <ListItem | ||
| 27 | + title={'RNLocalize'} | ||
| 28 | + onPress={() => navigation.navigate('RNLocalize')} | ||
| 29 | + rightTitle={strings.name} | ||
| 30 | + chevron | ||
| 31 | + /> | ||
| 32 | + <Divider /> | ||
| 33 | + <ListItem | ||
| 34 | + title={'RNCamera'} | ||
| 35 | + onPress={() => navigation.navigate('RNCamera')} | ||
| 36 | + chevron | ||
| 37 | + /> | ||
| 38 | + </BGScroll> | ||
| 39 | + ); | ||
| 40 | +}; | ||
| 41 | + | ||
| 42 | +export default Library; |
| @@ -4,7 +4,6 @@ import { screensEnabled } from 'react-native-screens'; | @@ -4,7 +4,6 @@ import { screensEnabled } from 'react-native-screens'; | ||
| 4 | import { useNetInfo } from '@react-native-community/netinfo'; | 4 | import { useNetInfo } from '@react-native-community/netinfo'; |
| 5 | import { ListItem, BGScroll, Card, Divider } from '../component/View'; | 5 | import { ListItem, BGScroll, Card, Divider } from '../component/View'; |
| 6 | import { MainTabScreenProps } from '../type/Navigation'; | 6 | import { MainTabScreenProps } from '../type/Navigation'; |
| 7 | -import { useI18nStrings } from '../i18n'; | ||
| 8 | 7 | ||
| 9 | declare var global: { HermesInternal: null | {} }; | 8 | declare var global: { HermesInternal: null | {} }; |
| 10 | 9 | ||
| @@ -12,7 +11,6 @@ const SystemInfo = ({ | @@ -12,7 +11,6 @@ const SystemInfo = ({ | ||
| 12 | navigation, | 11 | navigation, |
| 13 | route, | 12 | route, |
| 14 | }: MainTabScreenProps<'SystemInfo'>) => { | 13 | }: MainTabScreenProps<'SystemInfo'>) => { |
| 15 | - const strings = useI18nStrings(); | ||
| 16 | const netInfo = useNetInfo(); | 14 | const netInfo = useNetInfo(); |
| 17 | const { width, height, fontScale, scale } = useWindowDimensions(); | 15 | const { width, height, fontScale, scale } = useWindowDimensions(); |
| 18 | return ( | 16 | return ( |
| @@ -61,36 +59,6 @@ const SystemInfo = ({ | @@ -61,36 +59,6 @@ const SystemInfo = ({ | ||
| 61 | rightTitle={JSON.stringify(netInfo.details)} | 59 | rightTitle={JSON.stringify(netInfo.details)} |
| 62 | /> | 60 | /> |
| 63 | </Card> | 61 | </Card> |
| 64 | - <Card shadow> | ||
| 65 | - <ListItem | ||
| 66 | - title="RNDeviceInfo" | ||
| 67 | - onPress={() => navigation.navigate('RNDeviceInfoList')} | ||
| 68 | - chevron | ||
| 69 | - /> | ||
| 70 | - <Divider /> | ||
| 71 | - <ListItem | ||
| 72 | - title={'RNCWebview'} | ||
| 73 | - onPress={() => | ||
| 74 | - navigation.navigate('WebviewScreen', { | ||
| 75 | - uri: 'https://www.baidu.com', | ||
| 76 | - }) | ||
| 77 | - } | ||
| 78 | - chevron | ||
| 79 | - /> | ||
| 80 | - <Divider /> | ||
| 81 | - <ListItem | ||
| 82 | - title={'RNLocalize'} | ||
| 83 | - onPress={() => navigation.navigate('RNLocalize')} | ||
| 84 | - rightTitle={strings.name} | ||
| 85 | - chevron | ||
| 86 | - /> | ||
| 87 | - <Divider /> | ||
| 88 | - <ListItem | ||
| 89 | - title={'Camera'} | ||
| 90 | - onPress={() => navigation.navigate('RNCamera')} | ||
| 91 | - chevron | ||
| 92 | - /> | ||
| 93 | - </Card> | ||
| 94 | </BGScroll> | 62 | </BGScroll> |
| 95 | ); | 63 | ); |
| 96 | }; | 64 | }; |
| @@ -3,6 +3,7 @@ import { BottomTabNavigationProp } from '@react-navigation/bottom-tabs'; | @@ -3,6 +3,7 @@ import { BottomTabNavigationProp } from '@react-navigation/bottom-tabs'; | ||
| 3 | import { StackNavigationProp } from '@react-navigation/stack'; | 3 | import { StackNavigationProp } from '@react-navigation/stack'; |
| 4 | 4 | ||
| 5 | export type MainTabParamList = { | 5 | export type MainTabParamList = { |
| 6 | + Library: undefined; | ||
| 6 | SystemInfo: undefined; | 7 | SystemInfo: undefined; |
| 7 | DesignList: undefined; | 8 | DesignList: undefined; |
| 8 | }; | 9 | }; |
-
Please register or login to post a comment