-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StatusBar: Remove PropTypes #21293
Closed
Closed
StatusBar: Remove PropTypes #21293
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,6 @@ | |
'use strict'; | ||
|
||
const React = require('React'); | ||
const PropTypes = require('prop-types'); | ||
const ColorPropType = require('ColorPropType'); | ||
const Platform = require('Platform'); | ||
|
||
const processColor = require('processColor'); | ||
|
@@ -55,9 +53,47 @@ export type StatusBarAnimation = $Enum<{ | |
slide: string, | ||
}>; | ||
|
||
type DefaultProps = { | ||
animated: boolean, | ||
}; | ||
type StatusBarProps = $ReadOnly<{| | ||
/** | ||
* 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, | ||
/** | ||
* The background color of the status bar. | ||
* @platform android | ||
*/ | ||
backgroundColor?: ?string, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When there are a bunch of Props that are supported on different platforms, I like doing this pattern:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And also re-organized these |
||
/** | ||
* 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, | ||
/** | ||
* Sets the color of the status bar text. | ||
*/ | ||
barStyle?: ?('default' | 'light-content' | 'dark-content'), | ||
/** | ||
* 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'), | ||
|}>; | ||
|
||
/** | ||
* Merges the prop stack with the default values. | ||
|
@@ -148,15 +184,7 @@ function createStackEntry(props: any): any { | |
* | ||
* `currentHeight` (Android only) The height of the status bar. | ||
*/ | ||
class StatusBar extends React.Component<{ | ||
hidden?: boolean, | ||
animated?: boolean, | ||
backgroundColor?: string, | ||
translucent?: boolean, | ||
barStyle?: 'default' | 'light-content' | 'dark-content', | ||
networkActivityIndicatorVisible?: boolean, | ||
showHideTransition?: 'fade' | 'slide', | ||
}> { | ||
class StatusBar extends React.Component<StatusBarProps> { | ||
static _propsStack = []; | ||
|
||
static _defaultProps = createStackEntry({ | ||
|
@@ -261,48 +289,6 @@ class StatusBar extends React.Component<{ | |
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 = { | ||
animated: false, | ||
showHideTransition: 'fade', | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer if you just named these types
Props
. I believe that is consistent with all the other filesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed it