[ReactNative] Text docs

Summary:
In preparation for open sourcing React Native for Android, document which Text props are platform-specific.
This commit is contained in:
Martin Konicek 2015-07-27 06:22:44 -07:00
parent aca76c75dd
commit f69e33e6a8
2 changed files with 44 additions and 23 deletions

View File

@ -74,19 +74,24 @@ var Text = React.createClass({
propTypes: {
/**
* Used to truncate the text with an elipsis after computing the text
* layout, including line wrapping, such that the total number of lines does
* not exceed this number.
* layout, including line wrapping, such that the total number of lines
* does not exceed this number.
*/
numberOfLines: React.PropTypes.number,
/**
* This function is called on press. Text intrinsically supports press
* handling with a default highlight state (which can be disabled with
* `suppressHighlighting`).
* Invoked on mount and layout changes with
*
* `{nativeEvent: {layout: {x, y, width, height}}}`
*/
onLayout: React.PropTypes.func,
/**
* This function is called on press.
*/
onPress: React.PropTypes.func,
/**
* When true, no visual change is made when text is pressed down. By
* When true, no visual change is made when text is pressed down. By
* default, a gray oval highlights the text on press down.
* @platform ios
*/
suppressHighlighting: React.PropTypes.bool,
style: stylePropType,
@ -94,12 +99,6 @@ var Text = React.createClass({
* Used to locate this view in end-to-end tests.
*/
testID: React.PropTypes.string,
/**
* Invoked on mount and layout changes with
*
* {nativeEvent: {layout: {x, y, width, height}}}.
*/
onLayout: React.PropTypes.func,
},
viewConfig: viewConfig,

View File

@ -16,30 +16,52 @@ var ViewStylePropTypes = require('ViewStylePropTypes');
// TODO: use spread instead of Object.assign/create after #6560135 is fixed
var TextStylePropTypes = Object.assign(Object.create(ViewStylePropTypes), {
color: ReactPropTypes.string,
fontFamily: ReactPropTypes.string,
fontSize: ReactPropTypes.number,
fontStyle: ReactPropTypes.oneOf(['normal', 'italic']),
/**
* Specifies font weight. The values 'normal' and 'bold' are supported for
* most fonts. Not all fonts have a variant for each of the numeric values,
* in that case the closest one is chosen.
*/
fontWeight: ReactPropTypes.oneOf(
['normal' /*default*/, 'bold',
'100', '200', '300', '400', '500', '600', '700', '800', '900']
),
fontStyle: ReactPropTypes.oneOf(['normal', 'italic']),
/**
* @platform ios
*/
letterSpacing: ReactPropTypes.number,
lineHeight: ReactPropTypes.number,
color: ReactPropTypes.string,
// NOTE: 'justify is supported only on iOS
/**
* Specifies text alignment. The value 'justify' is only supported on iOS.
*/
textAlign: ReactPropTypes.oneOf(
['auto' /*default*/, 'left', 'right', 'center', 'justify']
),
/**
* @platform ios
*/
textDecorationLine: ReactPropTypes.oneOf(
['none' /*default*/, 'underline', 'line-through', 'underline line-through']
),
/**
* @platform ios
*/
textDecorationStyle: ReactPropTypes.oneOf(
['solid' /*default*/, 'double', 'dotted','dashed']
),
/**
* @platform ios
*/
textDecorationColor: ReactPropTypes.string,
/**
* @platform ios
*/
writingDirection: ReactPropTypes.oneOf(
['auto' /*default*/, 'ltr', 'rtl']
),
letterSpacing: ReactPropTypes.number,
textDecorationLine:ReactPropTypes.oneOf(
['none' /*default*/, 'underline', 'line-through', 'underline line-through']
),
textDecorationStyle:ReactPropTypes.oneOf(
['solid' /*default*/, 'double', 'dotted','dashed']
),
textDecorationColor: ReactPropTypes.string,
});
// Text doesn't support padding correctly (#4841912)