2.1.2 • Published 7 months ago

react-native-lifecycle v2.1.2

Weekly downloads
14
License
MIT
Repository
github
Last release
7 months ago

React Native Lifecycle

GitHub license Latest Version on NPM npm build status

简体中文

Install

yarn add react-native-lifecycle

Peer Dependencies

yarn add @react-navigation/native # >= 5.7.0 or >= 6.0.0

Support

package nameversionreact-native version
react-native-lifecycle2.0.0+0.65.0+
react-native-lifecycle1.2.4+0.59.0+

Usage

Example

Global Hooks
import { useAppActive, useAppInactive } from 'react-native-lifecycle';

export default function App() {
  // Called when the application switches from the background to the foreground
  useAppActive(() => {});

  // Called when the application switches from the foreground to background
  useAppInactive(() => {});
}
Page/Screen Hooks
import {
  useMount,
  useShow,
  useHide,
  useUnmount,
  useResize,
} from 'react-native-lifecycle';

export default function Page() {
  // Called when the component is mounted
  useMount(() => {});

  // Called when the page is displayed, or when the application switches from the background to the foreground
  useShow(() => {});

  // Called when the page is hidden, or when the application switches from the foreground to the background
  useHide(() => {});

  // Called when the component is unmounted
  useUnmount(() => {});

  // Called after the page window resize
  useResize(() => {});
}
2.1.2

7 months ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.4

2 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.1

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.0

4 years ago