mirror of
https://github.com/status-im/react-native.git
synced 2025-02-22 22:28:09 +00:00
StatusBar: Remove PropTypes (#21293)
Summary: Part of: https://github.com/react-native-community/discussions-and-proposals/issues/29 This PR removes the remaining PropTypes from `StatusBar` and moves its flowtypes to its own definition. Pull Request resolved: https://github.com/facebook/react-native/pull/21293 Differential Revision: D10012963 Pulled By: TheSavior fbshipit-source-id: 7fb4e416eb49e7860809a3e2aaf157590908687d
This commit is contained in:
parent
031037f491
commit
cd1d3ceffe
@ -11,8 +11,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const React = require('React');
|
const React = require('React');
|
||||||
const PropTypes = require('prop-types');
|
|
||||||
const ColorPropType = require('ColorPropType');
|
|
||||||
const Platform = require('Platform');
|
const Platform = require('Platform');
|
||||||
|
|
||||||
const processColor = require('processColor');
|
const processColor = require('processColor');
|
||||||
@ -55,9 +53,55 @@ export type StatusBarAnimation = $Enum<{
|
|||||||
slide: string,
|
slide: string,
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
type DefaultProps = {
|
type AndroidProps = $ReadOnly<{|
|
||||||
animated: boolean,
|
/**
|
||||||
};
|
* The background color of the status bar.
|
||||||
|
* @platform android
|
||||||
|
*/
|
||||||
|
backgroundColor?: ?string,
|
||||||
|
/**
|
||||||
|
* If the status bar is translucent.
|
||||||
|
* When translucent is set to true, the app will draw under the status bar.
|
||||||
|
* This is useful when using a semi transparent status bar color.
|
||||||
|
*
|
||||||
|
* @platform android
|
||||||
|
*/
|
||||||
|
translucent?: ?boolean,
|
||||||
|
|}>;
|
||||||
|
|
||||||
|
type IOSProps = $ReadOnly<{|
|
||||||
|
/**
|
||||||
|
* If the network activity indicator should be visible.
|
||||||
|
*
|
||||||
|
* @platform ios
|
||||||
|
*/
|
||||||
|
networkActivityIndicatorVisible?: ?boolean,
|
||||||
|
/**
|
||||||
|
* The transition effect when showing and hiding the status bar using the `hidden`
|
||||||
|
* prop. Defaults to 'fade'.
|
||||||
|
*
|
||||||
|
* @platform ios
|
||||||
|
*/
|
||||||
|
showHideTransition?: ?('fade' | 'slide'),
|
||||||
|
|}>;
|
||||||
|
|
||||||
|
type Props = $ReadOnly<{|
|
||||||
|
...AndroidProps,
|
||||||
|
...IOSProps,
|
||||||
|
/**
|
||||||
|
* If the status bar is hidden.
|
||||||
|
*/
|
||||||
|
hidden?: ?boolean,
|
||||||
|
/**
|
||||||
|
* If the transition between status bar property changes should be animated.
|
||||||
|
* Supported for backgroundColor, barStyle and hidden.
|
||||||
|
*/
|
||||||
|
animated?: ?boolean,
|
||||||
|
/**
|
||||||
|
* Sets the color of the status bar text.
|
||||||
|
*/
|
||||||
|
barStyle?: ?('default' | 'light-content' | 'dark-content'),
|
||||||
|
|}>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merges the prop stack with the default values.
|
* Merges the prop stack with the default values.
|
||||||
@ -148,15 +192,7 @@ function createStackEntry(props: any): any {
|
|||||||
*
|
*
|
||||||
* `currentHeight` (Android only) The height of the status bar.
|
* `currentHeight` (Android only) The height of the status bar.
|
||||||
*/
|
*/
|
||||||
class StatusBar extends React.Component<{
|
class StatusBar extends React.Component<Props> {
|
||||||
hidden?: boolean,
|
|
||||||
animated?: boolean,
|
|
||||||
backgroundColor?: string,
|
|
||||||
translucent?: boolean,
|
|
||||||
barStyle?: 'default' | 'light-content' | 'dark-content',
|
|
||||||
networkActivityIndicatorVisible?: boolean,
|
|
||||||
showHideTransition?: 'fade' | 'slide',
|
|
||||||
}> {
|
|
||||||
static _propsStack = [];
|
static _propsStack = [];
|
||||||
|
|
||||||
static _defaultProps = createStackEntry({
|
static _defaultProps = createStackEntry({
|
||||||
@ -261,48 +297,6 @@ class StatusBar extends React.Component<{
|
|||||||
StatusBarManager.setTranslucent(translucent);
|
StatusBarManager.setTranslucent(translucent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
|
||||||
/**
|
|
||||||
* If the status bar is hidden.
|
|
||||||
*/
|
|
||||||
hidden: PropTypes.bool,
|
|
||||||
/**
|
|
||||||
* If the transition between status bar property changes should be animated.
|
|
||||||
* Supported for backgroundColor, barStyle and hidden.
|
|
||||||
*/
|
|
||||||
animated: PropTypes.bool,
|
|
||||||
/**
|
|
||||||
* The background color of the status bar.
|
|
||||||
* @platform android
|
|
||||||
*/
|
|
||||||
backgroundColor: ColorPropType,
|
|
||||||
/**
|
|
||||||
* If the status bar is translucent.
|
|
||||||
* When translucent is set to true, the app will draw under the status bar.
|
|
||||||
* This is useful when using a semi transparent status bar color.
|
|
||||||
*
|
|
||||||
* @platform android
|
|
||||||
*/
|
|
||||||
translucent: PropTypes.bool,
|
|
||||||
/**
|
|
||||||
* Sets the color of the status bar text.
|
|
||||||
*/
|
|
||||||
barStyle: PropTypes.oneOf(['default', 'light-content', 'dark-content']),
|
|
||||||
/**
|
|
||||||
* If the network activity indicator should be visible.
|
|
||||||
*
|
|
||||||
* @platform ios
|
|
||||||
*/
|
|
||||||
networkActivityIndicatorVisible: PropTypes.bool,
|
|
||||||
/**
|
|
||||||
* The transition effect when showing and hiding the status bar using the `hidden`
|
|
||||||
* prop. Defaults to 'fade'.
|
|
||||||
*
|
|
||||||
* @platform ios
|
|
||||||
*/
|
|
||||||
showHideTransition: PropTypes.oneOf(['fade', 'slide']),
|
|
||||||
};
|
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
animated: false,
|
animated: false,
|
||||||
showHideTransition: 'fade',
|
showHideTransition: 'fade',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user