2015-01-30 01:10:49 +00:00
|
|
|
/**
|
2015-03-23 22:07:33 +00:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-17 02:24:55 +00: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-30 01:10:49 +00:00
|
|
|
*
|
2018-05-11 02:06:46 +00:00
|
|
|
* @format
|
2015-03-24 16:26:16 +00:00
|
|
|
* @flow
|
2015-01-30 01:10:49 +00:00
|
|
|
*/
|
2018-05-11 02:06:46 +00:00
|
|
|
|
2015-01-30 01:10:49 +00:00
|
|
|
'use strict';
|
|
|
|
|
2016-11-10 16:48:42 +00:00
|
|
|
const ColorPropType = require('ColorPropType');
|
2017-06-12 22:59:06 +00:00
|
|
|
const ReactPropTypes = require('prop-types');
|
2016-11-10 16:48:42 +00:00
|
|
|
const ViewStylePropTypes = require('ViewStylePropTypes');
|
|
|
|
|
|
|
|
const TextStylePropTypes = {
|
|
|
|
...ViewStylePropTypes,
|
2015-01-30 01:10:49 +00:00
|
|
|
|
2015-12-23 03:29:01 +00:00
|
|
|
color: ColorPropType,
|
2015-03-21 17:07:45 +00:00
|
|
|
fontFamily: ReactPropTypes.string,
|
|
|
|
fontSize: ReactPropTypes.number,
|
2015-07-27 13:22:44 +00: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-11 02:06:46 +00:00
|
|
|
fontWeight: ReactPropTypes.oneOf([
|
|
|
|
'normal' /*default*/,
|
|
|
|
'bold',
|
|
|
|
'100',
|
|
|
|
'200',
|
|
|
|
'300',
|
|
|
|
'400',
|
|
|
|
'500',
|
|
|
|
'600',
|
|
|
|
'700',
|
|
|
|
'800',
|
|
|
|
'900',
|
|
|
|
]),
|
2016-08-25 23:01:32 +00:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
|
|
|
fontVariant: ReactPropTypes.arrayOf(
|
|
|
|
ReactPropTypes.oneOf([
|
|
|
|
'small-caps',
|
|
|
|
'oldstyle-nums',
|
|
|
|
'lining-nums',
|
|
|
|
'tabular-nums',
|
|
|
|
'proportional-nums',
|
2018-05-11 02:06:46 +00:00
|
|
|
]),
|
2016-01-01 17:32:59 +00:00
|
|
|
),
|
2018-05-11 02:06:46 +00:00
|
|
|
textShadowOffset: ReactPropTypes.shape({
|
|
|
|
width: ReactPropTypes.number,
|
|
|
|
height: ReactPropTypes.number,
|
|
|
|
}),
|
2016-01-01 17:32:59 +00:00
|
|
|
textShadowRadius: ReactPropTypes.number,
|
|
|
|
textShadowColor: ColorPropType,
|
2015-07-27 13:22:44 +00:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
|
|
|
letterSpacing: ReactPropTypes.number,
|
2015-03-21 17:07:45 +00:00
|
|
|
lineHeight: ReactPropTypes.number,
|
2015-07-27 13:22:44 +00:00
|
|
|
/**
|
2016-04-24 18:28:41 +00:00
|
|
|
* Specifies text alignment. The value 'justify' is only supported on iOS and
|
|
|
|
* fallbacks to `left` on Android.
|
2015-07-27 13:22:44 +00:00
|
|
|
*/
|
2018-05-11 02:06:46 +00:00
|
|
|
textAlign: ReactPropTypes.oneOf([
|
|
|
|
'auto' /*default*/,
|
|
|
|
'left',
|
|
|
|
'right',
|
|
|
|
'center',
|
|
|
|
'justify',
|
|
|
|
]),
|
2016-01-21 19:07:50 +00:00
|
|
|
/**
|
|
|
|
* @platform android
|
|
|
|
*/
|
2018-05-11 02:06:46 +00:00
|
|
|
textAlignVertical: ReactPropTypes.oneOf([
|
|
|
|
'auto' /*default*/,
|
|
|
|
'top',
|
|
|
|
'bottom',
|
|
|
|
'center',
|
|
|
|
]),
|
2016-12-02 20:46:44 +00: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-11 02:06:46 +00:00
|
|
|
textDecorationLine: ReactPropTypes.oneOf([
|
|
|
|
'none' /*default*/,
|
|
|
|
'underline',
|
|
|
|
'line-through',
|
|
|
|
'underline line-through',
|
|
|
|
]),
|
2015-07-27 13:22:44 +00:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
2018-05-11 02:06:46 +00:00
|
|
|
textDecorationStyle: ReactPropTypes.oneOf([
|
|
|
|
'solid' /*default*/,
|
|
|
|
'double',
|
|
|
|
'dotted',
|
|
|
|
'dashed',
|
|
|
|
]),
|
2015-07-27 13:22:44 +00:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
2015-12-23 03:29:01 +00:00
|
|
|
textDecorationColor: ColorPropType,
|
2018-04-16 15:59:26 +00:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
2018-05-11 02:06:46 +00:00
|
|
|
textTransform: ReactPropTypes.oneOf([
|
|
|
|
'none' /*default*/,
|
|
|
|
'capitalize',
|
|
|
|
'uppercase',
|
|
|
|
'lowercase',
|
|
|
|
]),
|
2015-07-27 13:22:44 +00:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
2018-05-11 02:06:46 +00:00
|
|
|
writingDirection: ReactPropTypes.oneOf(['auto' /*default*/, 'ltr', 'rtl']),
|
2016-11-10 16:48:42 +00:00
|
|
|
};
|
2015-01-30 01:10:49 +00:00
|
|
|
|
|
|
|
module.exports = TextStylePropTypes;
|