From fbfac78d24567119328f779e66b18a4b209c3ac0 Mon Sep 17 00:00:00 2001 From: Devin Date: Mon, 21 Feb 2022 00:08:56 +0800 Subject: [PATCH] chore(2.0.3): 2.0.3 --- package.json | 4 ++-- src/useAppActive.ts | 2 +- src/useAppInactive.ts | 2 +- src/useHide.ts | 3 +-- src/useLoad.ts | 2 +- src/useResize.ts | 2 +- src/useShow.ts | 3 +-- src/useUnload.ts | 2 +- 8 files changed, 9 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 0364b1b..4116a8c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-lifecycle", - "version": "2.0.2", + "version": "2.0.3", "description": "React Native Lifecycle", "main": "dist/index.js", "repository": "git@github.com:chooin/react-native-lifecycle.git", @@ -20,7 +20,7 @@ }, "scripts": { "prepare": "husky install", - "build": "tsc" + "build": "tsc && api-extractor run" }, "files": [ "dist", diff --git a/src/useAppActive.ts b/src/useAppActive.ts index 5e59e48..a3ebfd4 100644 --- a/src/useAppActive.ts +++ b/src/useAppActive.ts @@ -2,7 +2,7 @@ import { useEffect } from 'react'; import { AppState, AppStateStatus } from 'react-native'; /** - * App 从后台变为前台时执行 + * Called when the application from background to foreground * @public */ export function useAppActive(fn: () => void): void { diff --git a/src/useAppInactive.ts b/src/useAppInactive.ts index 83e5a23..a0c7cff 100644 --- a/src/useAppInactive.ts +++ b/src/useAppInactive.ts @@ -2,7 +2,7 @@ import { useEffect } from 'react'; import { AppState, AppStateStatus, Platform } from 'react-native'; /** - * App 从前台变为后台时执行 + * Called when the application from foreground to background * @public */ export function useAppInactive(fn: () => void): void { diff --git a/src/useHide.ts b/src/useHide.ts index ae89413..b059f84 100644 --- a/src/useHide.ts +++ b/src/useHide.ts @@ -8,14 +8,13 @@ import { import { useNavigation } from '@react-navigation/native'; /** - * 页面从前台变为后台时执行 + * Called when the page is hidden or in the application from foreground to background * @public */ export function useHide(fn: () => void): void { const navigation = useNavigation(); const AppStateRef = useRef(null); - // ? App 从前台变为后台时执行 const onChange = (state: AppStateStatus) => { if ( state === diff --git a/src/useLoad.ts b/src/useLoad.ts index 66619a6..b567d22 100644 --- a/src/useLoad.ts +++ b/src/useLoad.ts @@ -1,7 +1,7 @@ import { useEffect } from 'react'; /** - * 页面创建时执行 + * Called when the page load * @public */ export function useLoad(fn: () => void): void { diff --git a/src/useResize.ts b/src/useResize.ts index c200a9c..253da22 100644 --- a/src/useResize.ts +++ b/src/useResize.ts @@ -2,7 +2,7 @@ import { useEffect } from 'react'; import { Dimensions } from 'react-native'; /** - * 页面尺寸变化时执行 + * Called after the page window resize * @public */ export function useResize(fn: () => void): void { diff --git a/src/useShow.ts b/src/useShow.ts index efbc95d..88823cc 100644 --- a/src/useShow.ts +++ b/src/useShow.ts @@ -8,7 +8,7 @@ import { import { useNavigation } from '@react-navigation/native'; /** - * 页面出现在前台时执行 + * Called when the page is displayed or in the application from background to foreground * @public */ export function useShow(fn: () => void): void { @@ -16,7 +16,6 @@ export function useShow(fn: () => void): void { const AppStateRef = useRef(null); const isAppStateChangeRef = useRef(false); - // ? App 从后台变为前台时执行 const onChange = (state: AppStateStatus) => { if (isAppStateChangeRef.current) { if (state === 'active') { diff --git a/src/useUnload.ts b/src/useUnload.ts index 11c4b23..6082985 100644 --- a/src/useUnload.ts +++ b/src/useUnload.ts @@ -1,7 +1,7 @@ import { useEffect } from 'react'; /** - * 页面销毁时执行 + * Called when the page is unloaded * @public */ export function useUnload(fn: () => void): void {