浏览代码

格式化优化

panhui 5 年之前
父节点
当前提交
1277a213f1

+ 41 - 37
.eslintrc.json

@@ -1,39 +1,43 @@
 {
-  "extends": ["airbnb", "prettier"],
-  "plugins": ["prettier"],
-  "parser": "babel-eslint",
-  "env": {
-    "browser": true,
-    "es6": true
-  },
-  "globals": {
-    "__DEV__": "readonly"
-  },
-  "rules": {
-    "prettier/prettier": "error",
-    "no-use-before-define": [
-      "error",
-      { "functions": true, "classes": true, "variables": false }
-    ],
-    "no-else-return": 0,
-    "import/no-unresolved": 0,
-    "no-unused-vars": [
-      "error",
-      { "vars": "local", "varsIgnorePattern": "WebBrowser" }
-    ],
-    "no-nested-ternary": 0,
-    "react/no-array-index-key": 0,
-    "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
-    "no-unused-expressions": [
-      "error",
-      { "allowShortCircuit": true, "allowTernary": true }
-    ],
-    "no-param-reassign": 0,
-    "react/prop-types": [0, { "ignore": ["navigation"] }],
-    "react/jsx-props-no-spreading": [
-      1,
-      { "html": "ignore", "exceptions": ["Icon", "props", "Avatar", "Text"] }
-    ],
-    "react/jsx-curly-newline": "off"
-  }
+    "extends": ["airbnb", "prettier"],
+    "plugins": ["prettier"],
+    "parser": "babel-eslint",
+    "env": {
+        "browser": true,
+        "es6": true
+    },
+    "globals": {
+        "__DEV__": "readonly"
+    },
+    "rules": {
+        "prettier/prettier": "error",
+        "no-use-before-define": [
+            "error",
+            { "functions": true, "classes": true, "variables": false }
+        ],
+        "react/jsx-indent": [2, 2, { "checkAttributes": false }],
+        "no-else-return": 0,
+        "import/no-unresolved": 0,
+        "no-unused-vars": [
+            "error",
+            { "vars": "local", "varsIgnorePattern": "WebBrowser" }
+        ],
+        "no-nested-ternary": 0,
+        "react/no-array-index-key": 0,
+        "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
+        "no-unused-expressions": [
+            "error",
+            { "allowShortCircuit": true, "allowTernary": true }
+        ],
+        "no-param-reassign": 0,
+        "react/prop-types": [0, { "ignore": ["navigation"] }],
+        "react/jsx-props-no-spreading": [
+            1,
+            {
+                "html": "ignore",
+                "exceptions": ["Icon", "props", "Avatar", "Text"]
+            }
+        ],
+        "react/jsx-curly-newline": "off"
+    }
 }

+ 1 - 1
.prettierrc.json

@@ -1,7 +1,7 @@
 {
   "trailingComma": "es5",
   "tabWidth": 2,
-  "semi": false,
+  "semi": true,
   "singleQuote": true,
   "endOfLine": "auto"
 }

+ 31 - 31
App.js

@@ -1,44 +1,44 @@
-import * as React from 'react'
-import { StatusBar, Platform, StyleSheet, View } from 'react-native'
-import { NavigationContainer, CommonActions } from '@react-navigation/native'
+import * as React from 'react';
+import { StatusBar, Platform, StyleSheet, View } from 'react-native';
+import { NavigationContainer, CommonActions } from '@react-navigation/native';
 import {
   createStackNavigator,
   CardStyleInterpolators,
-} from '@react-navigation/stack'
-import { UseAPIProvider } from '@umijs/use-request'
+} from '@react-navigation/stack';
+import { UseAPIProvider } from '@umijs/use-request';
 
-import { Provider as PaperProvider } from 'react-native-paper'
-import { Provider } from '@ant-design/react-native'
-import useModel from 'flooks'
-import { useUpdateEffect } from '@umijs/hooks'
+import { Provider as PaperProvider } from 'react-native-paper';
+import { Provider } from '@ant-design/react-native';
+import useModel from 'flooks';
+import { useUpdateEffect } from '@umijs/hooks';
 
-import { navigationRef } from './navigation/RootNavigation'
-import useCachedResources from './hooks/useCachedResources'
-import BottomTabNavigator from './navigation/BottomTabNavigator'
-import BasicScreens from './navigation/BaseNavigator'
-import words from './flooks/Words'
-import user from './flooks/User'
-import request from './Utils/RequestUtils'
-import theme from './constants/Theme'
+import { navigationRef } from './navigation/RootNavigation';
+import useCachedResources from './hooks/useCachedResources';
+import BottomTabNavigator from './navigation/BottomTabNavigator';
+import BasicScreens from './navigation/BaseNavigator';
+import words from './flooks/Words';
+import user from './flooks/User';
+import request from './Utils/RequestUtils';
+import theme from './constants/Theme';
 
-const Stack = createStackNavigator()
+const Stack = createStackNavigator();
 
 export default function App() {
-  const isLoadingComplete = useCachedResources()
-  const { wordsInit, local } = useModel(words, ['local'])
+  const isLoadingComplete = useCachedResources();
+  const { wordsInit, local } = useModel(words, ['local']);
   // Load words  local语言转变,切换语言
   React.useEffect(() => {
-    wordsInit()
-  }, [local])
-  const { id } = useModel(user, ['id'])
+    wordsInit();
+  }, [local]);
+  const { id } = useModel(user, ['id']);
   useUpdateEffect(() => {
-    let initName = ''
+    let initName = '';
     if (id === 0) {
       // 未登录
-      initName = 'Login'
+      initName = 'Login';
     } else if (id !== null) {
       // 已登录
-      initName = 'Home'
+      initName = 'Home';
     }
     if (initName) {
       navigationRef.current.dispatch(
@@ -50,12 +50,12 @@ export default function App() {
             },
           ],
         })
-      )
+      );
     }
-  }, [id])
+  }, [id]);
 
   if (!isLoadingComplete) {
-    return null
+    return null;
   } else {
     return (
       <View style={styles.container}>
@@ -88,7 +88,7 @@ export default function App() {
           </PaperProvider>
         </UseAPIProvider>
       </View>
-    )
+    );
   }
 }
 
@@ -97,4 +97,4 @@ const styles = StyleSheet.create({
     flex: 1,
     backgroundColor: '#fff',
   },
-})
+});

+ 11 - 11
Utils/AsyncStorageUtils.js

@@ -1,16 +1,16 @@
-import { AsyncStorage } from 'react-native'
+import { AsyncStorage } from 'react-native';
 
 const addAsyncStorage = async (key, value) => {
-  await AsyncStorage.setItem(key, value)
-  return true
-}
+  await AsyncStorage.setItem(key, value);
+  return true;
+};
 const removeAsyncStorage = async (key) => {
-  await AsyncStorage.removeItem(key)
-  return true
-}
+  await AsyncStorage.removeItem(key);
+  return true;
+};
 const getAsyncStorage = async (key) => {
-  const val = await AsyncStorage.getItem(key)
-  return val
-}
+  const val = await AsyncStorage.getItem(key);
+  return val;
+};
 
-export { addAsyncStorage, removeAsyncStorage, getAsyncStorage }
+export { addAsyncStorage, removeAsyncStorage, getAsyncStorage };

+ 3 - 3
Utils/FormUtils.js

@@ -1,6 +1,6 @@
 function submitPhone(inputPhone) {
-  const value = inputPhone.replace(/ /g, '')
-  return value
+  const value = inputPhone.replace(/ /g, '');
+  return value;
 }
 
-export default submitPhone
+export default submitPhone;

+ 17 - 17
Utils/RequestUtils.js

@@ -1,21 +1,21 @@
-import { extend } from 'umi-request'
-import qs from 'qs'
-import { getAsyncStorage } from './AsyncStorageUtils'
+import { extend } from 'umi-request';
+import qs from 'qs';
+import { getAsyncStorage } from './AsyncStorageUtils';
 
-const baseUrl = 'http://dingdong.izouma.com'
+const baseUrl = 'http://dingdong.izouma.com';
 const request = extend({
   prefix: baseUrl,
   credentials: 'include',
   errorHandler: (error) => {
-    let errorInfo = ''
+    let errorInfo = '';
     if (error.response) {
-      errorInfo = error.data
+      errorInfo = error.data;
     } else {
-      errorInfo = error.message
+      errorInfo = error.message;
     }
-    throw errorInfo
+    throw errorInfo;
   },
-})
+});
 
 request.interceptors.request.use(
   (url, options) => {
@@ -24,16 +24,16 @@ request.interceptors.request.use(
         Accept: 'application/json',
         'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
         ...options.headers,
-      }
-      options.data = qs.stringify(options.data)
+      };
+      options.data = qs.stringify(options.data);
     }
     return getAsyncStorage('token').then((token) => {
       const headers = {
         'Access-Control-Allow-Origin': '*',
         ...options.headers,
-      }
+      };
       if (token) {
-        headers.Authorization = `Bearer ${token}`
+        headers.Authorization = `Bearer ${token}`;
       }
       return Promise.resolve({
         url,
@@ -41,9 +41,9 @@ request.interceptors.request.use(
           ...options,
           headers,
         },
-      })
-    })
+      });
+    });
   },
   { global: true }
-)
-export default request
+);
+export default request;

文件差异内容过多而无法显示
+ 0 - 0
Utils/SvgUtils.js


+ 1 - 1
Utils/SvgUtilsNew.js

@@ -178,4 +178,4 @@ export default new Map([
       ],
     },
   ],
-])
+]);

+ 48 - 42
components/Button.js

@@ -1,6 +1,12 @@
-import * as React from 'react'
-import { View } from 'react-native'
-import { Paragraph, Button, Caption, withTheme, Text } from 'react-native-paper'
+import * as React from 'react';
+import { View } from 'react-native';
+import {
+  Paragraph,
+  Button,
+  Caption,
+  withTheme,
+  Text,
+} from 'react-native-paper';
 
 function MyButton(props) {
   const {
@@ -13,47 +19,47 @@ function MyButton(props) {
     theme,
     block,
     style,
-  } = props
-  let { fontColor } = props
-  const { colors } = theme
-  let contentStyle = {}
-  let color = ''
-  let mode = 'contained'
-  let childNode
-  let dark = true
+  } = props;
+  let { fontColor } = props;
+  const { colors } = theme;
+  let contentStyle = {};
+  let color = '';
+  let mode = 'contained';
+  let childNode;
+  let dark = true;
 
   switch (type) {
     case 'primary':
-      color = colors.primary
-      break
+      color = colors.primary;
+      break;
     case 'info':
       if (outline || text) {
-        color = colors.info
+        color = colors.info;
       } else {
-        color = colors.lightInfo
-        fontColor = colors.info
+        color = colors.lightInfo;
+        fontColor = colors.info;
       }
-      break
+      break;
     case 'danger':
-      color = colors.error
-      break
+      color = colors.error;
+      break;
     default:
-      color = colors.primary
-      break
+      color = colors.primary;
+      break;
   }
 
   if (outline) {
-    mode = 'outline'
-    dark = false
+    mode = 'outline';
+    dark = false;
   }
   if (text) {
-    mode = 'text'
-    dark = false
+    mode = 'text';
+    dark = false;
   }
 
   switch (size) {
     case 'mini':
-      contentStyle = { height: 22 }
+      contentStyle = { height: 22 };
       childNode = () => (
         <Text
           style={[
@@ -63,10 +69,10 @@ function MyButton(props) {
         >
           {children}
         </Text>
-      )
-      break
+      );
+      break;
     case 'small':
-      contentStyle = { height: 30 }
+      contentStyle = { height: 30 };
       childNode = () => (
         <Caption
           style={[
@@ -75,10 +81,10 @@ function MyButton(props) {
         >
           {children}
         </Caption>
-      )
-      break
+      );
+      break;
     case 'normal':
-      contentStyle = { width: 120, height: 44 }
+      contentStyle = { width: 120, height: 44 };
       childNode = () => (
         <Paragraph
           style={[
@@ -87,10 +93,10 @@ function MyButton(props) {
         >
           {children}
         </Paragraph>
-      )
-      break
+      );
+      break;
     default:
-      contentStyle = { width: 120, height: 30 }
+      contentStyle = { width: 120, height: 30 };
       childNode = () => (
         <Paragraph
           style={[
@@ -99,12 +105,12 @@ function MyButton(props) {
         >
           {children}
         </Paragraph>
-      )
-      break
+      );
+      break;
   }
 
   if (block) {
-    delete contentStyle.width
+    delete contentStyle.width;
     return (
       <Button
         mode={mode}
@@ -122,7 +128,7 @@ function MyButton(props) {
       >
         {childNode()}
       </Button>
-    )
+    );
   } else {
     return (
       <View style={{ ...style }}>
@@ -130,7 +136,7 @@ function MyButton(props) {
           mode={mode}
           color={color}
           contentStyle={contentStyle}
-          onPress={onPress}
+          onPress={onPressa}
           style={{
             elevation: 0,
             shadowOffset: {
@@ -143,8 +149,8 @@ function MyButton(props) {
           {childNode()}
         </Button>
       </View>
-    )
+    );
   }
 }
 
-export default withTheme(MyButton)
+export default withTheme(MyButton);

+ 6 - 6
components/Header.js

@@ -1,8 +1,8 @@
-import * as React from 'react'
-import { StatusBar, Platform } from 'react-native'
-import Constants from 'expo-constants'
-import { Appbar } from 'react-native-paper'
-import { goBack } from '../navigation/RootNavigation'
+import * as React from 'react';
+import { StatusBar, Platform } from 'react-native';
+import Constants from 'expo-constants';
+import { Appbar } from 'react-native-paper';
+import { goBack } from '../navigation/RootNavigation';
 
 export default function Header() {
   return (
@@ -21,5 +21,5 @@ export default function Header() {
         <Appbar.Action icon="dots-vertical" />
       </Appbar.Header>
     </>
-  )
+  );
 }

+ 13 - 13
components/HomeHeader.js

@@ -1,22 +1,22 @@
-import * as React from 'react'
-import { StatusBar, Platform } from 'react-native'
-import Constants from 'expo-constants'
-import { Appbar, Menu } from 'react-native-paper'
-import { useBoolean } from '@umijs/hooks'
-import useModel from 'flooks'
-import words from '../flooks/Words'
-import user from '../flooks/User'
+import * as React from 'react';
+import { StatusBar, Platform } from 'react-native';
+import Constants from 'expo-constants';
+import { Appbar, Menu } from 'react-native-paper';
+import { useBoolean } from '@umijs/hooks';
+import useModel from 'flooks';
+import words from '../flooks/Words';
+import user from '../flooks/User';
 
 export default function Header() {
-  const { state, setTrue, setFalse } = useBoolean(false)
+  const { state, setTrue, setFalse } = useBoolean(false);
   const {
     setlocal,
     TlocationWord,
     TchangeToth,
     TchangeToChinese,
     local,
-  } = useModel(words)
-  const { logout } = useModel(user, [])
+  } = useModel(words);
+  const { logout } = useModel(user, []);
 
   return (
     <>
@@ -44,7 +44,7 @@ export default function Header() {
           <Menu.Item onPress={logout} title="退出登录" />
           <Menu.Item
             onPress={() => {
-              setlocal()
+              setlocal();
             }}
             title={local ? TchangeToChinese : TchangeToth}
           />
@@ -52,5 +52,5 @@ export default function Header() {
         </Menu>
       </Appbar.Header>
     </>
-  )
+  );
 }

+ 3 - 1
components/StyledText.js

@@ -2,5 +2,7 @@ import * as React from 'react';
 import { Text } from 'react-native';
 
 export function MonoText(props) {
-  return <Text {...props} style={[props.style, { fontFamily: 'space-mono' }]} />;
+  return (
+    <Text {...props} style={[props.style, { fontFamily: 'space-mono' }]} />
+  );
 }

+ 24 - 22
components/SvgIcon.js

@@ -1,45 +1,47 @@
-import * as React from 'react'
-import { svg, path } from 'react-native-svg'
-import { withTheme } from 'react-native-paper'
-import svgMap from '../Utils/SvgUtilsNew'
+import * as React from 'react';
+import { svg, path } from 'react-native-svg';
+import { withTheme } from 'react-native-paper';
+import svgMap from '../Utils/SvgUtilsNew';
 
 function Icon(props) {
-  const { name, width, height, type, theme, fillAll } = props
-  let { color } = props
-  const { colors } = theme
+  const { name, width, height, type, theme, fillAll } = props;
+  let { color } = props;
+  const { colors } = theme;
   if (type) {
-    color = colors[type]
+    color = colors[type];
   }
-  const svgInfo = svgMap.get(name)
-  const viewBox = svgInfo ? svgInfo.viewBox || '0 0 1024 1024' : '0 0 1024 1024'
+  const svgInfo = svgMap.get(name);
+  const viewBox = svgInfo
+    ? svgInfo.viewBox || '0 0 1024 1024'
+    : '0 0 1024 1024';
   const pathList = svgInfo
     ? svgInfo.pathList || [
         {
           ...svgInfo,
         },
       ]
-    : []
-  console.log(color)
+    : [];
+  console.log(color);
   const pathComList = () => {
     return pathList.map((item, index) => {
-      const pathProps = { ...item }
+      const pathProps = { ...item };
       if ((fillAll || !item.strokeWidth) && color) {
-        pathProps.fill = color
+        pathProps.fill = color;
       }
 
       if (item.strokeWidth && color) {
-        pathProps.stroke = color
+        pathProps.stroke = color;
       }
-      delete pathProps.viewBox
-      console.log(pathProps)
-      return <path {...pathProps} key={index} />
-    })
-  }
+      delete pathProps.viewBox;
+      console.log(pathProps);
+      return <path {...pathProps} key={index} />;
+    });
+  };
   return (
     <svg width={width} height={height} viewBox={viewBox}>
       {pathComList()}
     </svg>
-  )
+  );
 }
 
-export default withTheme(Icon)
+export default withTheme(Icon);

+ 5 - 5
components/TabBarIcon.js

@@ -1,10 +1,10 @@
-import { Ionicons } from '@expo/vector-icons'
-import * as React from 'react'
+import { Ionicons } from '@expo/vector-icons';
+import * as React from 'react';
 
-import Colors from '../constants/Colors'
+import Colors from '../constants/Colors';
 
 export default function TabBarIcon(props) {
-  const { name, focused } = props
+  const { name, focused } = props;
   return (
     <Ionicons
       name={name}
@@ -12,5 +12,5 @@ export default function TabBarIcon(props) {
       style={{ marginBottom: -3 }}
       color={focused ? Colors.tabIconSelected : Colors.tabIconDefault}
     />
-  )
+  );
 }

+ 14 - 14
components/Text.js

@@ -1,4 +1,4 @@
-import * as React from 'react'
+import * as React from 'react';
 import {
   Headline,
   Paragraph,
@@ -6,14 +6,14 @@ import {
   Caption,
   withTheme,
   Text,
-} from 'react-native-paper'
+} from 'react-native-paper';
 
 function MyText(props) {
-  const { type, size, children, bold } = props
-  let { color, theme, style } = props
-  const { colors } = theme
+  const { type, size, children, bold } = props;
+  let { color, theme, style } = props;
+  const { colors } = theme;
   if (type) {
-    color = colors[type]
+    color = colors[type];
   }
 
   if (color) {
@@ -23,13 +23,13 @@ function MyText(props) {
         ...theme.colors,
         text: color,
       },
-    }
+    };
   }
   if (bold) {
     style = {
       ...style,
       fontWeight: 'bold',
-    }
+    };
   }
 
   switch (size) {
@@ -39,32 +39,32 @@ function MyText(props) {
         <Headline theme={theme} style={{ ...style }}>
           {children}
         </Headline>
-      )
+      );
     case 's1':
       // 16
       return (
         <Subheading theme={theme} style={{ ...style }}>
           {children}
         </Subheading>
-      )
+      );
     case 'c1':
       // 12
       return (
         <Caption theme={theme} style={{ ...style }}>
           {children}
         </Caption>
-      )
+      );
     case 'c2':
       // 10
       return (
         <Text theme={theme} style={[{ fontSize: 10 }, { ...style }]}>
           {children}
         </Text>
-      )
+      );
     default:
       // 14
-      return <Paragraph theme={theme}>{children}</Paragraph>
+      return <Paragraph theme={theme}>{children}</Paragraph>;
   }
 }
 
-export default withTheme(MyText)
+export default withTheme(MyText);

+ 5 - 0
flooks/Banner.js

@@ -0,0 +1,5 @@
+const banner = (now) => ({
+  bannerList: [],
+});
+
+export default banner;

+ 15 - 15
flooks/Toast.js

@@ -1,35 +1,35 @@
-import { Toast, Portal } from '@ant-design/react-native'
+import { Toast, Portal } from '@ant-design/react-native';
 
 const myToast = (now) => ({
   tKey: '',
   loading() {
-    const { tKey } = now()
+    const { tKey } = now();
     if (!tKey) {
-      const newKey = Toast.loading('Loading...', 0)
+      const newKey = Toast.loading('Loading...', 0);
       now({
         tKey: newKey,
-      })
+      });
     }
   },
   success(title) {
-    const { clearLoading } = now()
-    clearLoading()
-    Toast.success(title, 2)
+    const { clearLoading } = now();
+    clearLoading();
+    Toast.success(title, 2);
   },
   warnning(title) {
-    const { clearLoading } = now()
-    clearLoading()
-    Toast.info(title, 2)
+    const { clearLoading } = now();
+    clearLoading();
+    Toast.info(title, 2);
   },
   clearLoading() {
-    const { tKey } = now()
+    const { tKey } = now();
     if (tKey) {
-      Portal.remove(tKey)
+      Portal.remove(tKey);
       now({
         tKey: '',
-      })
+      });
     }
   },
-})
+});
 
-export default myToast
+export default myToast;

+ 26 - 23
flooks/User.js

@@ -1,7 +1,10 @@
-import request from '../Utils/RequestUtils'
-import { addAsyncStorage, removeAsyncStorage } from '../Utils/AsyncStorageUtils'
-import submitPhone from '../Utils/FormUtils'
-import Toast from './Toast'
+import request from '../Utils/RequestUtils';
+import {
+  addAsyncStorage,
+  removeAsyncStorage,
+} from '../Utils/AsyncStorageUtils';
+import submitPhone from '../Utils/FormUtils';
+import Toast from './Toast';
 
 const app = (now) => ({
   id: null,
@@ -13,18 +16,18 @@ const app = (now) => ({
         now({
           id: res.id,
           userInfo: res,
-        })
+        });
       })
       .catch((e) => {
         now({
           id: 0,
-        })
-        return Promise.reject(e)
-      })
+        });
+        return Promise.reject(e);
+      });
   },
   loginByPsd(phone, password) {
-    const { loading, warnning, success } = now(Toast)
-    loading()
+    const { loading, warnning, success } = now(Toast);
+    loading();
     return request
       .post('/auth/login', {
         data: {
@@ -34,29 +37,29 @@ const app = (now) => ({
         requestType: 'form',
       })
       .then((res) => {
-        return addAsyncStorage('token', res)
+        return addAsyncStorage('token', res);
       })
       .then(() => {
-        const { getUser } = now()
-        return getUser()
+        const { getUser } = now();
+        return getUser();
       })
       .then(() => {
-        success('登录成功')
+        success('登录成功');
       })
       .catch((e) => {
-        warnning(e.error)
-      })
+        warnning(e.error);
+      });
   },
   logout() {
-    const { loading, success } = now(Toast)
-    loading()
+    const { loading, success } = now(Toast);
+    loading();
     // 移除 token
     return removeAsyncStorage('token').then(() => {
       // 清除用户信息
-      now({ id: 0, userInfo: {} })
-      success('退出成功')
-    })
+      now({ id: 0, userInfo: {} });
+      success('退出成功');
+    });
   },
-})
+});
 
-export default app
+export default app;

+ 18 - 18
flooks/Words.js

@@ -1,31 +1,31 @@
-import * as Localization from 'expo-localization'
-import { i18n, keys } from '../language'
-import Toast from './Toast'
+import * as Localization from 'expo-localization';
+import { i18n, keys } from '../language';
+import Toast from './Toast';
 
 const wordsModel = (now) => ({
   local: '',
   wordsInit() {
-    const { local } = now()
+    const { local } = now();
     if (local) {
-      i18n.locale = local
+      i18n.locale = local;
     } else {
-      i18n.locale = Localization.locale
+      i18n.locale = Localization.locale;
     }
-    const wordsInfo = {}
+    const wordsInfo = {};
     keys.forEach((item) => {
-      wordsInfo[`T${item}`] = i18n.t(item)
-    })
-    now({ ...wordsInfo })
+      wordsInfo[`T${item}`] = i18n.t(item);
+    });
+    now({ ...wordsInfo });
 
-    const { clearLoading } = now(Toast)
-    clearLoading()
+    const { clearLoading } = now(Toast);
+    clearLoading();
   },
   setlocal(newLocal) {
-    const { loading } = now(Toast)
-    loading()
-    const { local } = now()
-    now({ local: newLocal || (local ? '' : 'th') })
+    const { loading } = now(Toast);
+    loading();
+    const { local } = now();
+    now({ local: newLocal || (local ? '' : 'th') });
   },
-})
+});
 
-export default wordsModel
+export default wordsModel;

+ 18 - 18
hooks/useCachedResources.js

@@ -1,50 +1,50 @@
 /* eslint-disable global-require */
-import { Ionicons } from '@expo/vector-icons'
-import useModel from 'flooks'
-import * as Font from 'expo-font'
-import * as SplashScreen from 'expo-splash-screen'
-import * as React from 'react'
-import Toast from '../flooks/Toast'
+import { Ionicons } from '@expo/vector-icons';
+import useModel from 'flooks';
+import * as Font from 'expo-font';
+import * as SplashScreen from 'expo-splash-screen';
+import * as React from 'react';
+import Toast from '../flooks/Toast';
 
 export default function useCachedResources() {
-  const [isLoadingComplete, setLoadingComplete] = React.useState(false)
+  const [isLoadingComplete, setLoadingComplete] = React.useState(false);
 
   // Load any resources or data that we need prior to rendering the app
   React.useEffect(() => {
     async function loadResourcesAndDataAsync() {
       try {
-        SplashScreen.preventAutoHideAsync()
+        SplashScreen.preventAutoHideAsync();
         // 初始化 Toast
-        useModel(Toast, [])
+        useModel(Toast, []);
         // Load fonts
 
         await Font.loadAsync(
           'antoutline',
           // eslint-disable-next-line
           require('@ant-design/icons-react-native/fonts/antoutline.ttf')
-        )
+        );
 
         await Font.loadAsync(
           'antfill',
           // eslint-disable-next-line
           require('@ant-design/icons-react-native/fonts/antfill.ttf')
-        )
+        );
         await Font.loadAsync({
           ...Ionicons.font,
           'space-mono': require('../assets/fonts/SpaceMono-Regular.ttf'),
-        })
+        });
       } catch (e) {
         // We might want to provide this error information to an error reporting service
         // eslint-disable-next-line no-console
-        console.warn(e)
+        console.warn(e);
       } finally {
-        setLoadingComplete(true)
-        SplashScreen.hideAsync()
+        setLoadingComplete(true);
+        SplashScreen.hideAsync();
       }
     }
 
-    loadResourcesAndDataAsync()
-  }, [])
+    loadResourcesAndDataAsync();
+  }, []);
 
-  return isLoadingComplete
+  return isLoadingComplete;
 }

+ 7 - 7
language/index.js

@@ -1,15 +1,15 @@
 // I18n.js
-import i18n from 'i18n-js'
-import th from './th'
-import zh from './zh'
+import i18n from 'i18n-js';
+import th from './th';
+import zh from './zh';
 
 // 支持转换的语言
 i18n.translations = {
   th,
   zh,
-}
-i18n.fallbacks = true
+};
+i18n.fallbacks = true;
 
-const keys = Object.keys(zh)
+const keys = Object.keys(zh);
 
-export { i18n, keys }
+export { i18n, keys };

+ 1 - 1
language/th.js

@@ -93,4 +93,4 @@ export default {
   selectTiltle1: '全部账单',
   selectTiltle2: '收入账单',
   selectTiltle3: '提现账单',
-}
+};

+ 1 - 1
language/zh.js

@@ -93,4 +93,4 @@ export default {
   selectTiltle1: '全部账单',
   selectTiltle2: '收入账单',
   selectTiltle3: '提现账单',
-}
+};

+ 4 - 4
navigation/BaseNavigator.jsx

@@ -1,6 +1,6 @@
-import * as React from 'react'
-import Login from '../screens/Login'
-import InitAppScreen from '../screens/InitAppScreen'
+import * as React from 'react';
+import Login from '../screens/Login';
+import InitAppScreen from '../screens/InitAppScreen';
 
 export default function BasicScreens(Screen) {
   return (
@@ -9,5 +9,5 @@ export default function BasicScreens(Screen) {
       {/* 登录路由 */}
       {Login(Screen)}
     </>
-  )
+  );
 }

+ 8 - 8
navigation/BottomTabNavigator.jsx

@@ -1,11 +1,11 @@
-import * as React from 'react'
-import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
-import HomeScreen from '../screens/Home/HomeScreen'
-import LinksScreen from '../screens/Home/LinksScreen'
-import Icon from '../components/SvgIcon'
-import Text from '../components/Text'
+import * as React from 'react';
+import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
+import HomeScreen from '../screens/Home/HomeScreen';
+import LinksScreen from '../screens/Home/LinksScreen';
+import Icon from '../components/SvgIcon';
+import Text from '../components/Text';
 
-const BottomTab = createBottomTabNavigator()
+const BottomTab = createBottomTabNavigator();
 
 export default function BottomTabNavigator() {
   return (
@@ -62,5 +62,5 @@ export default function BottomTabNavigator() {
         }}
       />
     </BottomTab.Navigator>
-  )
+  );
 }

+ 7 - 7
navigation/RootNavigation.js

@@ -1,21 +1,21 @@
 /* eslint-disable no-unused-expressions */
 // RootNavigation.js
-import * as React from 'react'
-import { CommonActions, StackActions } from '@react-navigation/native'
+import * as React from 'react';
+import { CommonActions, StackActions } from '@react-navigation/native';
 
-export const navigationRef = React.createRef()
+export const navigationRef = React.createRef();
 
 export function navigate(name, params) {
-  navigationRef.current?.navigate(name, params)
+  navigationRef.current?.navigate(name, params);
 }
 
 export function replace(name, params) {
-  navigationRef.current?.dispatch(StackActions.replace(name, params))
+  navigationRef.current?.dispatch(StackActions.replace(name, params));
 }
 
 export function goBack() {
   if (navigationRef.current.getRootState().index > 0) {
-    navigationRef.current?.goBack()
+    navigationRef.current?.goBack();
   }
 }
 
@@ -31,5 +31,5 @@ export function reset(name, params) {
         },
       ],
     })
-  )
+  );
 }

+ 20 - 13
screens/Home/HomeScreen.jsx

@@ -1,8 +1,13 @@
-import * as WebBrowser from 'expo-web-browser'
-import * as React from 'react'
-import { Platform, StyleSheet, View } from 'react-native'
-import { ScrollView } from 'react-native-gesture-handler'
-import { WhiteSpace, WingBlank, Carousel, Grid } from '@ant-design/react-native'
+import * as WebBrowser from 'expo-web-browser';
+import * as React from 'react';
+import { Platform, StyleSheet, View } from 'react-native';
+import { ScrollView } from 'react-native-gesture-handler';
+import {
+  WhiteSpace,
+  WingBlank,
+  Carousel,
+  Grid,
+} from '@ant-design/react-native';
 import {
   Paragraph,
   Menu,
@@ -10,10 +15,12 @@ import {
   Provider,
   Text,
   Card,
-} from 'react-native-paper'
-import Button from '../../components/Button'
-import Header from '../../components/HomeHeader'
-import Icon from '../../components/SvgIcon'
+} from 'react-native-paper';
+import Button from '../../components/Button';
+import Header from '../../components/HomeHeader';
+import Icon from '../../components/SvgIcon';
+
+const data = [];
 
 export default function HomeScreen() {
   return (
@@ -37,7 +44,7 @@ export default function HomeScreen() {
           <Card>
             <Card.Cover
               source={{ uri: 'https://picsum.photos/700' }}
-              resizeMode="center"9
+              resizeMode="center"
               borderRadius={0}
             />
           </Card>
@@ -57,11 +64,11 @@ export default function HomeScreen() {
         />
       </View>
     </ScrollView>
-  )
+  );
 }
 HomeScreen.navigationOptions = {
   header: null,
-}
+};
 
 const styles = StyleSheet.create({
   container: {
@@ -82,4 +89,4 @@ const styles = StyleSheet.create({
   wrapper: {
     height: 80,
   },
-})
+});

+ 5 - 5
screens/Home/LinksScreen.jsx

@@ -1,9 +1,9 @@
-import * as WebBrowser from 'expo-web-browser'
-import * as React from 'react'
-import { StyleSheet, View } from 'react-native'
+import * as WebBrowser from 'expo-web-browser';
+import * as React from 'react';
+import { StyleSheet, View } from 'react-native';
 
 export default function LinksScreen() {
-  return <View />
+  return <View />;
 }
 
-const styles = StyleSheet.create({})
+const styles = StyleSheet.create({});

+ 12 - 12
screens/InitAppScreen.jsx

@@ -1,22 +1,22 @@
-import * as WebBrowser from 'expo-web-browser'
-import * as React from 'react'
-import { Avatar } from 'react-native-paper'
-import { Flex } from '@ant-design/react-native'
-import useModel from 'flooks'
-import { useMount } from '@umijs/hooks'
-import user from '../flooks/User'
+import * as WebBrowser from 'expo-web-browser';
+import * as React from 'react';
+import { Avatar } from 'react-native-paper';
+import { Flex } from '@ant-design/react-native';
+import useModel from 'flooks';
+import { useMount } from '@umijs/hooks';
+import user from '../flooks/User';
 
-const splash = require('../assets/images/splash.png')
+const splash = require('../assets/images/splash.png');
 
 export default function LinksScreen() {
   //   const { data, error, loading } = useRequest('/user/my')
-  const { getUser } = useModel(user, [])
+  const { getUser } = useModel(user, []);
   useMount(() => {
-    getUser()
-  })
+    getUser();
+  });
   return (
     <Flex justify="center" style={{ flex: 1, backgroundColor: '#FFC21C' }}>
       <Avatar.Image size={80} source={splash} />
     </Flex>
-  )
+  );
 }

+ 14 - 14
screens/Login/BackPasswordScreen.jsx

@@ -1,16 +1,16 @@
-import * as WebBrowser from 'expo-web-browser'
-import * as React from 'react'
-import { StyleSheet, View } from 'react-native'
-import { WingBlank, InputItem } from '@ant-design/react-native'
-import { Caption, Paragraph } from 'react-native-paper'
-import Header from '../../components/Header'
-import Button from '../../components/Button'
+import * as WebBrowser from 'expo-web-browser';
+import * as React from 'react';
+import { StyleSheet, View } from 'react-native';
+import { WingBlank, InputItem } from '@ant-design/react-native';
+import { Caption, Paragraph } from 'react-native-paper';
+import Header from '../../components/Header';
+import Button from '../../components/Button';
 
 export default function BackPasswordScreen() {
-  const [phone, setphone] = React.useState()
-  const [code, setCode] = React.useState()
-  const [password, setPassword] = React.useState()
-  const [password2, setPassword2] = React.useState()
+  const [phone, setphone] = React.useState();
+  const [code, setCode] = React.useState();
+  const [password, setPassword] = React.useState();
+  const [password2, setPassword2] = React.useState();
 
   return (
     <>
@@ -38,7 +38,7 @@ export default function BackPasswordScreen() {
               maxLength={6}
               style={{ fontSize: 14 }}
               onExtraClick={() => {
-                console.log('发送验证码')
+                console.log('发送验证码');
               }}
             >
               <Paragraph>验证码</Paragraph>
@@ -73,7 +73,7 @@ export default function BackPasswordScreen() {
         </WingBlank>
       </View>
     </>
-  )
+  );
 }
 
 const styles = StyleSheet.create({
@@ -86,4 +86,4 @@ const styles = StyleSheet.create({
   btn: {
     marginTop: 40,
   },
-})
+});

+ 41 - 41
screens/Login/LoginScreen.jsx

@@ -1,18 +1,18 @@
-import * as WebBrowser from 'expo-web-browser'
-import * as React from 'react'
-import { StyleSheet, View, StatusBar, Platform, Image } from 'react-native'
-import { Flex, WingBlank, InputItem } from '@ant-design/react-native'
-import { Card, Paragraph, Caption } from 'react-native-paper'
-import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs'
-import useModel from 'flooks'
-import Toast from '../../flooks/Toast'
-import user from '../../flooks/User'
-import Button from '../../components/Button'
+import * as WebBrowser from 'expo-web-browser';
+import * as React from 'react';
+import { StyleSheet, View, StatusBar, Platform, Image } from 'react-native';
+import { Flex, WingBlank, InputItem } from '@ant-design/react-native';
+import { Card, Paragraph, Caption } from 'react-native-paper';
+import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
+import useModel from 'flooks';
+import Toast from '../../flooks/Toast';
+import user from '../../flooks/User';
+import Button from '../../components/Button';
 
-const Tab = createMaterialTopTabNavigator()
+const Tab = createMaterialTopTabNavigator();
 
 // const img = require('../../assets/images/loginImg.png')
-const img2 = require('../../assets/images/loginLogo.png')
+const img2 = require('../../assets/images/loginLogo.png');
 
 export default function LoginScreen({ navigation }) {
   const btnList = () => (
@@ -22,7 +22,7 @@ export default function LoginScreen({ navigation }) {
         size="small"
         type="info"
         onPress={() => {
-          navigation.navigate('BackPassword')
+          navigation.navigate('BackPassword');
         }}
       >
         忘记密码
@@ -31,7 +31,7 @@ export default function LoginScreen({ navigation }) {
         用户注册
       </Button>
     </View>
-  )
+  );
 
   return (
     <>
@@ -90,27 +90,27 @@ export default function LoginScreen({ navigation }) {
         </WingBlank>
       </View>
     </>
-  )
+  );
 }
 
 const LoginPassword = ({ route }) => {
-  const [phone, setphone] = React.useState()
-  const [password, setPassword] = React.useState()
+  const [phone, setphone] = React.useState();
+  const [password, setPassword] = React.useState();
 
-  const { warnning } = useModel(Toast, [])
-  const { loginByPsd } = useModel(user, [])
-  const { params } = route
-  const { btnList } = params || {}
+  const { warnning } = useModel(Toast, []);
+  const { loginByPsd } = useModel(user, []);
+  const { params } = route;
+  const { btnList } = params || {};
 
   const submit = () => {
     if (!phone) {
-      warnning('手机号不能为空')
+      warnning('手机号不能为空');
     } else if (!password) {
-      warnning('密码不能为空')
+      warnning('密码不能为空');
     } else {
-      loginByPsd(phone, password)
+      loginByPsd(phone, password);
     }
-  }
+  };
 
   return (
     <View style={styles.list}>
@@ -141,25 +141,25 @@ const LoginPassword = ({ route }) => {
         <Button onPress={submit}>登录</Button>
       </View>
     </View>
-  )
-}
+  );
+};
 
 const LoginCode = ({ route }) => {
-  const [phone, setphone] = React.useState()
-  const [code, setCode] = React.useState()
-  const { warnning } = useModel(Toast, [])
-  const { loginByPsd } = useModel(user, [])
-  const { params } = route
-  const { btnList } = params || {}
+  const [phone, setphone] = React.useState();
+  const [code, setCode] = React.useState();
+  const { warnning } = useModel(Toast, []);
+  const { loginByPsd } = useModel(user, []);
+  const { params } = route;
+  const { btnList } = params || {};
   const submit = () => {
     if (!phone) {
-      warnning('手机号不能为空')
+      warnning('手机号不能为空');
     } else if (!code) {
-      warnning('验证码')
+      warnning('验证码');
     } else {
-      loginByPsd(phone, code)
+      loginByPsd(phone, code);
     }
-  }
+  };
   return (
     <View style={styles.list}>
       <InputItem
@@ -182,7 +182,7 @@ const LoginCode = ({ route }) => {
         maxLength={6}
         style={{ fontSize: 14 }}
         onExtraClick={() => {
-          console.log('发送验证码')
+          console.log('发送验证码');
         }}
       >
         <Paragraph>验证码</Paragraph>
@@ -192,8 +192,8 @@ const LoginCode = ({ route }) => {
         <Button onPress={submit}>登录</Button>
       </View>
     </View>
-  )
-}
+  );
+};
 
 const styles = StyleSheet.create({
   container: { flex: 1, backgroundColor: '#FFF2C7' },
@@ -233,4 +233,4 @@ const styles = StyleSheet.create({
     marginTop: 10,
     marginLeft: 10,
   },
-})
+});

+ 5 - 5
screens/Login/index.js

@@ -1,7 +1,7 @@
-import * as WebBrowser from 'expo-web-browser'
-import * as React from 'react'
-import LoginScreen from './LoginScreen'
-import BackPasswordScreen from './BackPasswordScreen'
+import * as WebBrowser from 'expo-web-browser';
+import * as React from 'react';
+import LoginScreen from './LoginScreen';
+import BackPasswordScreen from './BackPasswordScreen';
 
 export default function Bank(Screen) {
   return (
@@ -9,5 +9,5 @@ export default function Bank(Screen) {
       <Screen name="Login" component={LoginScreen} />
       <Screen name="BackPassword" component={BackPasswordScreen} />
     </>
-  )
+  );
 }

部分文件因为文件数量过多而无法显示