mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 17:15:54 +00:00
5d6a89bc61
Summary: Finished adding support for justified text on iOS... just had to expose a prop value. Fixes #529 Closes https://github.com/facebook/react-native/pull/1486 Github Author: James Ide <ide@jameside.com> Test Plan: View the Text example in the UIExplorer and see that all but the last lines of text in the justified text example are justified and extend to the far right of the available space. Tested on iOS 8, iPhone 6 simulator. ![text](https://cloud.githubusercontent.com/assets/379606/7926252/a90d2e98-0884-11e5-9f12-5cbb27505a0b.png)
55 lines
1.7 KiB
JavaScript
55 lines
1.7 KiB
JavaScript
/**
|
|
* 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.
|
|
*
|
|
* @providesModule TextStylePropTypes
|
|
* @flow
|
|
*/
|
|
'use strict';
|
|
|
|
var ReactPropTypes = require('ReactPropTypes');
|
|
var ViewStylePropTypes = require('ViewStylePropTypes');
|
|
|
|
// TODO: use spread instead of Object.assign/create after #6560135 is fixed
|
|
var TextStylePropTypes = Object.assign(Object.create(ViewStylePropTypes), {
|
|
fontFamily: ReactPropTypes.string,
|
|
fontSize: ReactPropTypes.number,
|
|
fontWeight: ReactPropTypes.oneOf(
|
|
['normal' /*default*/, 'bold',
|
|
'100', '200', '300', '400', '500', '600', '700', '800', '900']
|
|
),
|
|
fontStyle: ReactPropTypes.oneOf(['normal', 'italic']),
|
|
lineHeight: ReactPropTypes.number,
|
|
color: ReactPropTypes.string,
|
|
containerBackgroundColor: ReactPropTypes.string,
|
|
// NOTE: "justify" is supported only on iOS
|
|
textAlign: ReactPropTypes.oneOf(
|
|
['auto' /*default*/, 'left', 'right', 'center', 'justify']
|
|
),
|
|
writingDirection: ReactPropTypes.oneOf(
|
|
['auto' /*default*/, 'ltr', 'rtl']
|
|
),
|
|
letterSpacing: ReactPropTypes.number,
|
|
});
|
|
|
|
// 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,
|
|
});
|
|
|
|
for (var ii = 0; ii < unsupportedProps.length; ii++) {
|
|
delete TextStylePropTypes[unsupportedProps[ii]];
|
|
}
|
|
|
|
module.exports = TextStylePropTypes;
|