2015-01-29 17:10:49 -08:00
|
|
|
/**
|
2015-03-23 15:07:33 -07:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-16 18:24:55 -08:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-01-29 17:10:49 -08:00
|
|
|
*
|
2018-05-10 19:06:46 -07:00
|
|
|
* @format
|
2015-03-24 09:26:16 -07:00
|
|
|
* @flow
|
2015-01-29 17:10:49 -08:00
|
|
|
*/
|
2018-05-10 19:06:46 -07:00
|
|
|
|
2015-01-29 17:10:49 -08:00
|
|
|
'use strict';
|
|
|
|
|
2016-11-10 08:48:42 -08:00
|
|
|
const ColorPropType = require('ColorPropType');
|
2017-06-12 15:59:06 -07:00
|
|
|
const ReactPropTypes = require('prop-types');
|
2016-11-10 08:48:42 -08:00
|
|
|
const ViewStylePropTypes = require('ViewStylePropTypes');
|
|
|
|
|
|
|
|
const TextStylePropTypes = {
|
|
|
|
...ViewStylePropTypes,
|
2015-01-29 17:10:49 -08:00
|
|
|
|
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.
|
|
|
|
*/
|
2018-05-10 19:06:46 -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',
|
2018-05-10 19:06:46 -07:00
|
|
|
]),
|
2016-01-01 09:32:59 -08:00
|
|
|
),
|
2018-05-10 19:06:46 -07:00
|
|
|
textShadowOffset: ReactPropTypes.shape({
|
|
|
|
width: ReactPropTypes.number,
|
|
|
|
height: ReactPropTypes.number,
|
|
|
|
}),
|
2016-01-01 09:32:59 -08:00
|
|
|
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
|
|
|
*/
|
2018-05-10 19:06:46 -07:00
|
|
|
textAlign: ReactPropTypes.oneOf([
|
|
|
|
'auto' /*default*/,
|
|
|
|
'left',
|
|
|
|
'right',
|
|
|
|
'center',
|
|
|
|
'justify',
|
|
|
|
]),
|
2016-01-21 11:07:50 -08:00
|
|
|
/**
|
|
|
|
* @platform android
|
|
|
|
*/
|
2018-05-10 19:06:46 -07:00
|
|
|
textAlignVertical: ReactPropTypes.oneOf([
|
|
|
|
'auto' /*default*/,
|
|
|
|
'top',
|
|
|
|
'bottom',
|
|
|
|
'center',
|
|
|
|
]),
|
2016-12-02 12:46:44 -08:00
|
|
|
/**
|
|
|
|
* Set to `false` to remove extra font padding intended to make space for certain ascenders / descenders.
|
|
|
|
* With some fonts, this padding can make text look slightly misaligned when centered vertically.
|
|
|
|
* For best results also set `textAlignVertical` to `center`. Default is true.
|
|
|
|
* @platform android
|
|
|
|
*/
|
|
|
|
includeFontPadding: ReactPropTypes.bool,
|
2018-05-10 19:06:46 -07:00
|
|
|
textDecorationLine: ReactPropTypes.oneOf([
|
|
|
|
'none' /*default*/,
|
|
|
|
'underline',
|
|
|
|
'line-through',
|
|
|
|
'underline line-through',
|
|
|
|
]),
|
2015-07-27 06:22:44 -07:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
2018-05-10 19:06:46 -07:00
|
|
|
textDecorationStyle: ReactPropTypes.oneOf([
|
|
|
|
'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,
|
2018-04-16 08:59:26 -07:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
2018-05-10 19:06:46 -07:00
|
|
|
textTransform: ReactPropTypes.oneOf([
|
|
|
|
'none' /*default*/,
|
|
|
|
'capitalize',
|
|
|
|
'uppercase',
|
|
|
|
'lowercase',
|
|
|
|
]),
|
2015-07-27 06:22:44 -07:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
2018-05-10 19:06:46 -07:00
|
|
|
writingDirection: ReactPropTypes.oneOf(['auto' /*default*/, 'ltr', 'rtl']),
|
2016-11-10 08:48:42 -08:00
|
|
|
};
|
2015-01-29 17:10:49 -08:00
|
|
|
|
|
|
|
module.exports = TextStylePropTypes;
|