2015-01-30 01:10:49 +00:00
|
|
|
/**
|
2015-03-23 22:07:33 +00:00
|
|
|
* 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.
|
2015-01-30 01:10:49 +00:00
|
|
|
*
|
|
|
|
* @providesModule TextStylePropTypes
|
2015-03-24 16:26:16 +00:00
|
|
|
* @flow
|
2015-01-30 01:10:49 +00:00
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var ReactPropTypes = require('ReactPropTypes');
|
|
|
|
var ViewStylePropTypes = require('ViewStylePropTypes');
|
|
|
|
|
2015-03-24 16:26:16 +00:00
|
|
|
// TODO: use spread instead of Object.assign/create after #6560135 is fixed
|
|
|
|
var TextStylePropTypes = Object.assign(Object.create(ViewStylePropTypes), {
|
2015-03-21 17:07:45 +00:00
|
|
|
fontFamily: ReactPropTypes.string,
|
|
|
|
fontSize: ReactPropTypes.number,
|
2015-03-25 22:36:50 +00:00
|
|
|
fontWeight: ReactPropTypes.oneOf(
|
|
|
|
['normal' /*default*/, 'bold',
|
|
|
|
'100', '200', '300', '400', '500', '600', '700', '800', '900']
|
|
|
|
),
|
2015-03-21 17:07:45 +00:00
|
|
|
fontStyle: ReactPropTypes.oneOf(['normal', 'italic']),
|
|
|
|
lineHeight: ReactPropTypes.number,
|
|
|
|
color: ReactPropTypes.string,
|
|
|
|
containerBackgroundColor: ReactPropTypes.string,
|
|
|
|
textAlign: ReactPropTypes.oneOf(
|
|
|
|
['auto' /*default*/, 'left', 'right', 'center']
|
|
|
|
),
|
|
|
|
writingDirection: ReactPropTypes.oneOf(
|
|
|
|
['auto' /*default*/, 'ltr', 'rtl']
|
|
|
|
),
|
2015-05-12 07:25:08 +00:00
|
|
|
letterSpacing: ReactPropTypes.number,
|
2015-03-24 16:26:16 +00:00
|
|
|
});
|
2015-01-30 01:10:49 +00:00
|
|
|
|
|
|
|
// Text doesn't support padding correctly (#4841912)
|
|
|
|
var unsupportedProps = Object.keys({
|
|
|
|
padding: null,
|
|
|
|
paddingTop: null,
|
|
|
|
paddingLeft: null,
|
|
|
|
paddingRight: null,
|
|
|
|
paddingBottom: null,
|
|
|
|
paddingVertical: null,
|
|
|
|
paddingHorizontal: null,
|
|
|
|
});
|
|
|
|
|
2015-03-24 16:26:16 +00:00
|
|
|
for (var ii = 0; ii < unsupportedProps.length; ii++) {
|
|
|
|
delete TextStylePropTypes[unsupportedProps[ii]];
|
2015-01-30 01:10:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = TextStylePropTypes;
|