Giter VIP home page Giter VIP logo

react-native-lifecycle's Introduction

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 name version react-native version
react-native-lifecycle 2.0.0+ 0.65.0+
react-native-lifecycle 1.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 page or 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 page or component is unmounted
  useUnmount(() => {});

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

react-native-lifecycle's People

Contributors

chooin avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

react-native-lifecycle's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update jest monorepo to v29 (major) (@types/jest, jest, ts-jest)
  • chore(deps): update node.js to v18
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/test.yml
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • @microsoft/api-extractor ^7.34.0
  • @react-navigation/native ^6.0.8
  • @testing-library/react-hooks ^8.0.0
  • @types/jest ^27.5.1
  • @types/react ^18.0.9
  • @types/react-native ^0.67.7
  • babel-jest ^29.4.1
  • husky ^7.0.2
  • jest ^28.1.0
  • prettier ^2.6.1
  • pretty-quick ^3.1.1
  • react ^18.1.0
  • react-native ^0.68.2
  • react-test-renderer ^18.1.0
  • ts-jest ^28.0.2
  • typescript ^4.6.3
  • zx ^6.0.7
  • @react-navigation/native >= 5.7.0
  • react-native >= 0.65.0
nvm
.nvmrc
  • node 16

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.