mirror of
https://github.com/status-im/react-native.git
synced 2025-01-24 16:29:01 +00:00
642c13e3e3
- Fixed sticky section headers in ListView | Nick Lockwood - [ReactNative] AppState cleanup, remove Subscribable, add in OSS examples | Eric Vicenti - [react-packager] package.json cleanup (seperate packager into it's own package) | Amjad Masad - [ReactNative] Move PushNotificationIOS to oss | Tadeu Zagallo - [ReactNative] Fix shake gesture after RedBox is dismissed | Alex Kotliarskyi - [catlyst|madman] fix prop type warning | Jiajie Zhu - [ReactNative] Remove Subscribable from TextInput | Eric Vicenti - Unforked ExceptionsManager, AlertManager and AppState | Nick Lockwood - [ReactNative|MAdMan] Notification Subscribable | Eric Vicenti - [ReactNative] OSS AsyncStorage with example | Spencer Ahrens
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
/**
|
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
|
*
|
|
* @providesModule AppState
|
|
*/
|
|
'use strict';
|
|
|
|
var NativeModules = require('NativeModulesDeprecated');
|
|
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
|
var RKAppState = NativeModules.RKAppState;
|
|
var RKReachability = NativeModules.RKReachability;
|
|
var Subscribable = require('Subscribable');
|
|
|
|
var keyMirror = require('keyMirror');
|
|
|
|
var AppState = {
|
|
|
|
setApplicationIconBadgeNumber: function(number) {
|
|
RKAppState.setApplicationIconBadgeNumber(number);
|
|
},
|
|
|
|
getApplicationIconBadgeNumber: function(callback) {
|
|
RKAppState.getApplicationIconBadgeNumber(callback);
|
|
},
|
|
|
|
};
|
|
|
|
// This check avoids redboxing if native RKReachability library isn't included in app
|
|
// TODO: Move reachability API into separate JS module to prevent need for this
|
|
if (RKReachability) {
|
|
AppState.networkReachability = new Subscribable(
|
|
RCTDeviceEventEmitter,
|
|
'reachabilityDidChange',
|
|
(resp) => resp.network_reachability,
|
|
RKReachability.getCurrentReachability
|
|
);
|
|
}
|
|
|
|
AppState.NetworkReachability = keyMirror({
|
|
wifi: true,
|
|
cell: true,
|
|
none: true,
|
|
unknown: true,
|
|
});
|
|
|
|
module.exports = AppState;
|