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';
|
|
|
|
|
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.
|
|
|
|
*/
|
2015-03-25 22:36:50 +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',
|
|
|
|
])
|
2016-08-09 15:42:58 +00:00
|
|
|
),
|
2016-01-01 17:32:59 +00:00
|
|
|
textShadowOffset: ReactPropTypes.shape(
|
|
|
|
{width: ReactPropTypes.number, height: ReactPropTypes.number}
|
|
|
|
),
|
|
|
|
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
|
|
|
*/
|
2015-03-21 17:07:45 +00:00
|
|
|
textAlign: ReactPropTypes.oneOf(
|
2015-06-15 19:00:18 +00:00
|
|
|
['auto' /*default*/, 'left', 'right', 'center', 'justify']
|
2015-03-21 17:07:45 +00:00
|
|
|
),
|
2016-01-21 19:07:50 +00:00
|
|
|
/**
|
|
|
|
* @platform android
|
|
|
|
*/
|
|
|
|
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,
|
2015-07-27 13:22:44 +00:00
|
|
|
textDecorationLine: ReactPropTypes.oneOf(
|
2015-07-07 13:03:56 +00:00
|
|
|
['none' /*default*/, 'underline', 'line-through', 'underline line-through']
|
|
|
|
),
|
2015-07-27 13:22:44 +00:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
|
|
|
textDecorationStyle: ReactPropTypes.oneOf(
|
2015-07-07 13:03:56 +00:00
|
|
|
['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,
|
2015-07-27 13:22:44 +00:00
|
|
|
/**
|
|
|
|
* @platform ios
|
|
|
|
*/
|
|
|
|
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;
|