2015-01-29 17:10:49 -08:00
|
|
|
/**
|
2015-03-23 15:07:33 -07: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-29 17:10:49 -08:00
|
|
|
*
|
|
|
|
* @providesModule TextStylePropTypes
|
2015-03-24 09:26:16 -07:00
|
|
|
* @flow
|
2015-01-29 17:10:49 -08:00
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2016-10-14 18:50:17 -07:00
|
|
|
var ReactPropTypes = require('React').PropTypes;
|
2015-12-22 19:29:01 -08:00
|
|
|
var ColorPropType = require('ColorPropType');
|
2015-01-29 17:10:49 -08:00
|
|
|
var ViewStylePropTypes = require('ViewStylePropTypes');
|
|
|
|
|
2015-03-24 09:26:16 -07:00
|
|
|
// TODO: use spread instead of Object.assign/create after #6560135 is fixed
|
|
|
|
var TextStylePropTypes = Object.assign(Object.create(ViewStylePropTypes), {
|
2015-12-22 19:29:01 -08:00
|
|
|
color: ColorPropType,
|
2015-03-21 10:07:45 -07:00
|
|
|
fontFamily: ReactPropTypes.string,
|
|
|
|
fontSize: ReactPropTypes.number,
|
2015-07-27 06:22:44 -07:00
|
|
|
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.
|
|
|
|
*/
|
2015-03-25 15:36:50 -07:00
|
|
|
fontWeight: ReactPropTypes.oneOf(
|
|
|
|
['normal' /*default*/, 'bold',
|
|
|
|
'100', '200', '300', '400', '500', '600', '700', '800', '900']
|
|
|
|
),
|
2016-08-25 16:01:32 -07:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
|
|
|
fontVariant: ReactPropTypes.arrayOf(
|
|
|
|
ReactPropTypes.oneOf([
|
|
|
|
'small-caps',
|
|
|
|
'oldstyle-nums',
|
|
|
|
'lining-nums',
|
|
|
|
'tabular-nums',
|
|
|
|
'proportional-nums',
|
|
|
|
])
|
2016-08-09 08:42:58 -07:00
|
|
|
),
|
2016-01-01 09:32:59 -08:00
|
|
|
textShadowOffset: ReactPropTypes.shape(
|
|
|
|
{width: ReactPropTypes.number, height: ReactPropTypes.number}
|
|
|
|
),
|
|
|
|
textShadowRadius: ReactPropTypes.number,
|
|
|
|
textShadowColor: ColorPropType,
|
2015-07-27 06:22:44 -07:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
|
|
|
letterSpacing: ReactPropTypes.number,
|
2015-03-21 10:07:45 -07:00
|
|
|
lineHeight: ReactPropTypes.number,
|
2015-07-27 06:22:44 -07:00
|
|
|
/**
|
2016-04-24 11:28:41 -07:00
|
|
|
* Specifies text alignment. The value 'justify' is only supported on iOS and
|
|
|
|
* fallbacks to `left` on Android.
|
2015-07-27 06:22:44 -07:00
|
|
|
*/
|
2015-03-21 10:07:45 -07:00
|
|
|
textAlign: ReactPropTypes.oneOf(
|
2015-06-15 12:00:18 -07:00
|
|
|
['auto' /*default*/, 'left', 'right', 'center', 'justify']
|
2015-03-21 10:07:45 -07:00
|
|
|
),
|
2016-01-21 11:07:50 -08:00
|
|
|
/**
|
|
|
|
* @platform android
|
|
|
|
*/
|
|
|
|
textAlignVertical: ReactPropTypes.oneOf(
|
|
|
|
['auto' /*default*/, 'top', 'bottom', 'center']
|
|
|
|
),
|
2015-07-27 06:22:44 -07:00
|
|
|
textDecorationLine: ReactPropTypes.oneOf(
|
2015-07-07 06:03:56 -07:00
|
|
|
['none' /*default*/, 'underline', 'line-through', 'underline line-through']
|
|
|
|
),
|
2015-07-27 06:22:44 -07:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
|
|
|
textDecorationStyle: ReactPropTypes.oneOf(
|
2015-07-07 06:03:56 -07:00
|
|
|
['solid' /*default*/, 'double', 'dotted','dashed']
|
|
|
|
),
|
2015-07-27 06:22:44 -07:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
2015-12-22 19:29:01 -08:00
|
|
|
textDecorationColor: ColorPropType,
|
2015-07-27 06:22:44 -07:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
|
|
|
writingDirection: ReactPropTypes.oneOf(
|
|
|
|
['auto' /*default*/, 'ltr', 'rtl']
|
|
|
|
),
|
2015-03-24 09:26:16 -07:00
|
|
|
});
|
2015-01-29 17:10:49 -08:00
|
|
|
|
|
|
|
module.exports = TextStylePropTypes;
|