Summary:
**Description:**
Jest tests that use that StatusBar failing because the status bar functions aren't mocked.
Errors I ran into:
`TypeError: StatusBarManager. setNetworkActivityIndicatorVisible is not a function`
`TypeError: StatusBarManager. setHidden is not a function`
`TypeError: StatusBarManager. setStyle is not a function`
**Fix:**
Added mocks for all the functions that the StatusBar offers according to the docs: https://facebook.github.io/react-native/docs/statusbar.html
**Test plan (required)**
Verify that the tests using StatusBar and its functions succeed.
Closes https://github.com/facebook/react-native/pull/11322
Differential Revision: D4284536
Pulled By: cpojer
fbshipit-source-id: b67be8c0595d91ee9aca4784f457c0959d7e45d5
Summary:
Fix an issue when running Jest unit tests due to a missing mock for StatusBarManger.
**More info:**
In one of my files I have:
```
export const STATUS_BAR_HEIGHT = (StatusBar.currentHeight || 0);
```
When I run the tests it gives this error, which seems to be because StatusBarManager is undefined (https://github.com/facebook/react-native/blob/master/Libraries/Components/StatusBar/StatusBar.js#L20)
```
TypeError: Cannot read property 'HEIGHT' of undefined
at Object.<anonymous> (node_modules/react-native/Libraries/Components/StatusBar/StatusBar.js:395:1823)
at Object.StatusBar (node_modules/react-native/Libraries/react-native/react-native.js:55:24)
```
**Test plan (required)**
Verify that with this change tests that use StatusBar pass.
Closes https://github.com/facebook/react-native/pull/11198
Differential Revision: D4246367
Pulled By: cpojer
fbshipit-source-id: ee9406d2566688d235a11cab8f24b0583698e93a
Summary:
**Description**
In the same vein as https://github.com/facebook/react-native/pull/11198, this adds a mock for the native module `AppState`.
**Test plan**
Create a component that uses `AppState`, e.g.
```jsx
import React, { Component } from 'react';
import { AppState } from 'react-native';
class TestComponent extends Component {
componentDidMount() {
AppState.addEventListener('change', this.stateChangeListener);
}
}
```
Closes https://github.com/facebook/react-native/pull/11199
Differential Revision: D4246668
Pulled By: cpojer
fbshipit-source-id: e3a73a98963a0e152a70aba78ef3461b86da0f6c
Summary:
Fixes warnings such as `Warning: Native component for "RCTView" does not exist` when you don't mock the native view class on `UIManager`.
**Test plan (required)**
Run `npm test` with it and without it, notice that warnings are gone and results are the same.
cc cpojer
Closes https://github.com/facebook/react-native/pull/10486
Differential Revision: D4063500
Pulled By: cpojer
fbshipit-source-id: f6bdda1fdd1ad87958f435071d353684cb812af4