|
1 | 1 | import React, { PropTypes, Text } from 'react-native';
|
2 | 2 | import Intl from 'react-intl';
|
3 | 3 |
|
4 |
| -const FormattedNumber = props => ( |
5 |
| - <Intl.FormattedNumber {...props}> |
6 |
| - {localized => <Text style={props.style}>{localized}</Text>} |
7 |
| - </Intl.FormattedNumber> |
8 |
| -); |
| 4 | +const FormattedNumber = props => { |
| 5 | + const style = props.style; |
| 6 | + |
| 7 | + const formatOptions = { |
| 8 | + localeMatcher: props.localeMatcher, |
| 9 | + style: props.formatStyle, |
| 10 | + currency: props.currency, |
| 11 | + currencyDisplay: props.currencyDisplay, |
| 12 | + useGrouping: props.useGrouping, |
| 13 | + minimumIntegerDigits: props.minimumIntegerDigits, |
| 14 | + minimumFractionDigits: props.minimumFractionDigits, |
| 15 | + maximumFractionDigits: props.maximumFractionDigits, |
| 16 | + minimumSignificantDigits: props.minimumSignificantDigits, |
| 17 | + maximumSignificantDigits: props.maximumSignificantDigits, |
| 18 | + }; |
| 19 | + |
| 20 | + return ( |
| 21 | + <Intl.FormattedNumber {...formatOptions}> |
| 22 | + {localized => <Text style={style}>{localized}</Text>} |
| 23 | + </Intl.FormattedNumber> |
| 24 | + ); |
| 25 | +}; |
9 | 26 |
|
10 | 27 | FormattedNumber.propTypes = {
|
11 | 28 | style: PropTypes.any,
|
| 29 | + localeMatcher: PropTypes.any, |
| 30 | + formatStyle: PropTypes.any, |
| 31 | + currency: PropTypes.any, |
| 32 | + currencyDisplay: PropTypes.any, |
| 33 | + useGrouping: PropTypes.any, |
| 34 | + minimumIntegerDigits: PropTypes.any, |
| 35 | + minimumFractionDigits: PropTypes.any, |
| 36 | + maximumFractionDigits: PropTypes.any, |
| 37 | + minimumSignificantDigits: PropTypes.any, |
| 38 | + maximumSignificantDigits: PropTypes.any, |
12 | 39 | };
|
13 | 40 |
|
14 | 41 | export default FormattedNumber;
|
0 commit comments