1.0.9 • Published 9 months ago

@pachun/react-native-use-app-lifecycle v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

npm version cov

useAppLifecycle

A react native hook to run code when your app is launched, focused and blurred.

Install

yarn add @pachun/react-native-use-app-lifecycle

Usage

In your topmost-level component:

import useAppLifecycle from "@pachun/react-native-use-app-lifecycle"

const App = () => {
  useAppLifecycle({
    onLaunch: () => console.log("launch"),
    onFocus: () => console.log("focus"),
    onBlur: () => console.log("blur"),
  })

  return <></>
}

export default App

Motivation

I've been copying and pasting this code into all my RN projects for a long time. Usually, I use it to check for and download Over-The-Air (OTA) expo updates.

Contributing

PRs are exciting 🤟 Bump the version number in package.json and open some.

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago