Fix the website build
Summary:
118e88393e
broke autodoc generation because autodoc isn't smart enough to understand some patterns.
I'm working around it by using the same trick as this file was using previously: reassigning the class variable.
Similarly, using a property initializer produces bad output so I had to remove it:
<img width="146" alt="screen shot 2017-02-20 at 19 00 36" src="https://cloud.githubusercontent.com/assets/810438/23138561/09ebb476-f7a0-11e6-8fad-92c5a01503c3.png">
cc ericnakagawa mkonicek for review
Closes https://github.com/facebook/react-native/pull/12479
Differential Revision: D4591285
Pulled By: gaearon
fbshipit-source-id: 5884620a08874298b1b2c810e8fb769eba4e1199
This commit is contained in:
parent
e361ce8673
commit
a5ea974948
|
@ -26,9 +26,6 @@ const invariant = require('fbjs/lib/invariant');
|
||||||
* AppState is frequently used to determine the intent and proper behavior when
|
* AppState is frequently used to determine the intent and proper behavior when
|
||||||
* handling push notifications.
|
* handling push notifications.
|
||||||
*
|
*
|
||||||
* This module depends on the native RCTAppState module. If you don't include it,
|
|
||||||
* `AppState.isAvailable` will return `false`, and any method calls will throw.
|
|
||||||
*
|
|
||||||
* ### App States
|
* ### App States
|
||||||
*
|
*
|
||||||
* - `active` - The app is running in the foreground
|
* - `active` - The app is running in the foreground
|
||||||
|
@ -90,11 +87,12 @@ class AppState extends NativeEventEmitter {
|
||||||
|
|
||||||
_eventHandlers: Object;
|
_eventHandlers: Object;
|
||||||
currentState: ?string;
|
currentState: ?string;
|
||||||
isAvailable: boolean = true;
|
isAvailable: boolean;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(RCTAppState);
|
super(RCTAppState);
|
||||||
|
|
||||||
|
this.isAvailable = true;
|
||||||
this._eventHandlers = {
|
this._eventHandlers = {
|
||||||
change: new Map(),
|
change: new Map(),
|
||||||
memoryWarning: new Map(),
|
memoryWarning: new Map(),
|
||||||
|
@ -213,10 +211,13 @@ class MissingNativeAppStateShim extends EventEmitter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Guard against missing native module by throwing on first method call.
|
// This module depends on the native `RCTAppState` module. If you don't include it,
|
||||||
// Keep the API the same so Flow doesn't complain.
|
// `AppState.isAvailable` will return `false`, and any method calls will throw.
|
||||||
const appState = RCTAppState
|
// We reassign the class variable to keep the autodoc generator happy.
|
||||||
? new AppState()
|
if (RCTAppState) {
|
||||||
: new MissingNativeAppStateShim();
|
AppState = new AppState();
|
||||||
|
} else {
|
||||||
|
AppState = new MissingNativeAppStateShim();
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = appState;
|
module.exports = AppState;
|
||||||
|
|
Loading…
Reference in New Issue