amrlabib / React Native Appstate Hook
Licence: mit
React Native appSate hook
Stars: ✭ 73
Projects that are alternatives of or similar to React Native Appstate Hook
React Nprogress
⌛️ A React primitive for building slim progress bars.
Stars: ✭ 173 (+136.99%)
Mutual labels: hooks, component
React Use Clipboard
React hook that provides copy to clipboard functionality.
Stars: ✭ 149 (+104.11%)
Mutual labels: hooks, component
React Frame Component
Render your React app to an iFrame
Stars: ✭ 1,163 (+1493.15%)
Mutual labels: component
Vue Autonumeric
A Vue.js component that wraps the awesome autoNumeric input formatter library
Stars: ✭ 68 (-6.85%)
Mutual labels: component
Horsey
🐴 Progressive and customizable autocomplete component
Stars: ✭ 1,146 (+1469.86%)
Mutual labels: component
Security Guard
The Guard component brings many layers of authentication together, making it much easier to create complex authentication systems where you have total control.
Stars: ✭ 1,157 (+1484.93%)
Mutual labels: component
React Native X Bar
🎩 A flexible, lightweight bar component for common UI patterns in React Native
Stars: ✭ 68 (-6.85%)
Mutual labels: component
French Press Editor
☕ An offline-first rich text editor component.
Stars: ✭ 69 (-5.48%)
Mutual labels: component
Utils
🛠 Lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.
Stars: ✭ 1,158 (+1486.3%)
Mutual labels: component
Daggraph
Dagger dependency graph generator for Android Developers
Stars: ✭ 1,140 (+1461.64%)
Mutual labels: component
Rn Collapsing Tab Bar
Collapsing header with tabs for react native
Stars: ✭ 71 (-2.74%)
Mutual labels: component
Jsonapi React
A minimal JSON:API client and React hooks for fetching, updating, and caching remote data.
Stars: ✭ 65 (-10.96%)
Mutual labels: hooks
Security Http
Security provides an infrastructure for sophisticated authorization systems, which makes it possible to easily separate the actual authorization logic from so called user providers that hold the users credentials. It is inspired by the Java Spring framework.
Stars: ✭ 1,146 (+1469.86%)
Mutual labels: component
Prelodr
A simple Material preloader inspired by Google Inbox.
Stars: ✭ 68 (-6.85%)
Mutual labels: component
Config
Configure a system using EDN files and clojure.spec
Stars: ✭ 72 (-1.37%)
Mutual labels: component
react-native-appstate-hook
React Native appState hook is a custom react hook, built to handle iOS or Android appState
in your react component
Note:
React hooks is available from react version 16.8.0 and react native version 0.59.0
Setup
yarn add react-native-appstate-hook
OR
npm install --save react-native-appstate-hook
Example
import React from 'react';
import { Text, View } from 'react-native';
import useAppState from 'react-native-appstate-hook';
export default function App() {
const { appState } = useAppState({
onChange: (newAppState) => console.warn('App state changed to ', newAppState),
onForeground: () => console.warn('App went to Foreground'),
onBackground: () => console.warn('App went to background'),
});
return (
<View style={{textAlign: 'center', backgroundColor :'white', flex: 1, justifyContent: 'center'}}>
<Text>App State is: {appState}</Text>
</View>
);
}
Settings
key | Type | Required | Description |
---|---|---|---|
onChange | Function | No | callback function to be executed once appState is changed |
onForeground | Function | No | callback function to be executed once app go to foreground |
onBackground | Function | No | callback function to be executed once app go to background |
Values
key | Type | Description |
---|---|---|
appState | string | app state it can be one of the following values active , inactive , or background
|
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].