esoftplay 0.0.131-u → 0.0.131-w

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/bin/build.js CHANGED
@@ -297,6 +297,7 @@ export default UserIndex`;
297
297
  'react-native-gesture-handler',
298
298
  'react-native-awesome-gallery',
299
299
  'react-native-fast-image',
300
+ 'react-native-mmkv',
300
301
  'react-native-pan-pinch-view',
301
302
  'react-native-reanimated',
302
303
  'react-native-safe-area-context',
@@ -18,7 +18,7 @@ import { UserHook } from 'esoftplay/cache/user/hook/import';
18
18
  import { UserLoading } from 'esoftplay/cache/user/loading/import';
19
19
  import * as ErrorReport from 'esoftplay/error';
20
20
  import moment from 'esoftplay/moment';
21
- import * as Font from "expo-font";
21
+ import { useFonts } from 'expo-font';
22
22
  import React, { useLayoutEffect } from 'react';
23
23
  import { View } from 'react-native';
24
24
  import { GestureHandlerRootView } from 'react-native-gesture-handler';
@@ -30,8 +30,7 @@ export interface UserIndexProps {
30
30
  export interface UserIndexState {
31
31
  loading: boolean
32
32
  }
33
-
34
- function setFonts(): Promise<void> {
33
+ function getFontConfig() {
35
34
  let fonts: any = {}
36
35
  let fontsConfig = esp.config("fonts")
37
36
  if (fontsConfig) {
@@ -39,29 +38,31 @@ function setFonts(): Promise<void> {
39
38
  fonts[key] = esp.assets('fonts/' + fontsConfig[key])
40
39
  })
41
40
  }
42
- return new Promise((r, j) => {
43
- Font.loadAsync(fonts).then(() => r())
44
- })
41
+ return fonts
45
42
  }
46
43
 
47
44
 
48
45
  export default function m(props: UserIndexProps): any {
49
46
  moment().locale(LibLocale.state().get())
50
47
  const [loading, setLoading] = useSafeState(true)
48
+ const [fontLoaded] = useFonts(getFontConfig())
51
49
  //esoftplay-user-class-hook
52
50
  UseDeeplink()
53
51
 
54
52
  useLayoutEffect(() => {
55
- (async () => {
56
- await setFonts()
57
- UserClass.isLogin(() => {
58
- setLoading(false)
59
- })
60
- })()
61
53
  ErrorReport.getError()
62
54
  LibUpdaterProperty.check()
63
55
  LibVersion.check()
64
56
  }, [])
57
+
58
+ useLayoutEffect(() => {
59
+ if (fontLoaded) {
60
+ UserClass.isLogin(() => {
61
+ setLoading(false)
62
+ })
63
+ }
64
+ }, [fontLoaded])
65
+
65
66
 
66
67
  //esoftplay-chatting
67
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.131-u",
3
+ "version": "0.0.131-w",
4
4
  "description": "embedding data from esoftplay framework (web based) into mobile app",
5
5
  "main": "cache/index.js",
6
6
  "types": "../../index.d.ts",