-
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
Accept number for size prop in ActivityIndicator #8846
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,8 +113,8 @@ exports.examples = [ | |
return ( | ||
<ActivityIndicator | ||
style={[styles.centering, styles.gray]} | ||
color="white" | ||
size="large" | ||
color="white" | ||
/> | ||
); | ||
} | ||
|
@@ -151,12 +151,34 @@ exports.examples = [ | |
} | ||
}, | ||
{ | ||
title: 'Custom size', | ||
title: 'Custom size (size: 49)', | ||
render() { | ||
return ( | ||
<ActivityIndicator | ||
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. number This type is incompatible with string |
||
style={styles.centering} | ||
size={49} | ||
/> | ||
); | ||
} | ||
}, | ||
{ | ||
title: 'Custom size (size: 57)', | ||
render() { | ||
return ( | ||
<ActivityIndicator | ||
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. number This type is incompatible with 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. number This type is incompatible with string |
||
style={styles.centering} | ||
size={57} | ||
/> | ||
); | ||
} | ||
}, | ||
{ | ||
title: 'Custom size (size: 31, scale transform: 1.5)', | ||
render() { | ||
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. number This type is incompatible with string |
||
return ( | ||
<ActivityIndicator | ||
style={[styles.centering, {transform: [{scale: 1.5}]}]} | ||
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. number This type is incompatible with 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. number This type is incompatible with string |
||
size="large" | ||
size={31} | ||
/> | ||
); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* @providesModule IndicatorSizePropType | ||
*/ | ||
'use strict'; | ||
|
||
var ReactPropTypeLocationNames = require('react/lib/ReactPropTypeLocationNames'); | ||
|
||
var indicatorSizePropType = function(isRequired, props, propName, componentName, location, propFullName) { | ||
var size = props[propName]; | ||
|
||
if (size !== undefined && size !== null && typeof size !== 'number' && size !== 'small' && size !== 'large') { | ||
var locationName = ReactPropTypeLocationNames[location]; | ||
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. no-unused-vars: 'locationName' is defined but never used |
||
return new Error( | ||
'Invalid ' + ReactPropTypeLocationNames[location] + ' `' + (propFullName || propName) + | ||
'` supplied to `' + componentName + '`: ' + size + '\n' + | ||
`Valid size formats are | ||
- 'small' | ||
- 'large' | ||
- positive number | ||
`); | ||
} | ||
|
||
if (typeof size === 'number') { | ||
if (size <= 0) { | ||
return new Error( | ||
'Size number has to be greater than 0. Default size will be used' | ||
); | ||
} | ||
} | ||
|
||
}; | ||
|
||
var IndicatorSizePropType = indicatorSizePropType.bind(null, false); | ||
module.exports = IndicatorSizePropType; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
id: indicatorSize | ||
title: Indicator Size | ||
layout: docs | ||
category: Guides | ||
permalink: docs/indicator-size.html | ||
next: images | ||
previous: integration-with-existing-apps | ||
--- | ||
|
||
The following formats are supported: | ||
|
||
- `'small'` (size: 20) | ||
- `'large'` (size: 36) | ||
- `positive number` |
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.
number This type is incompatible with string