Skip to content

Commit

Permalink
feat: support alt narrow currency symbol
Browse files Browse the repository at this point in the history
`FormattedCurrency` (and `getCurrencyFormatter`) support `symbolForm` option to allow usage of alt
narrow currency symbol

closes #34
  • Loading branch information
joshswan committed Feb 13, 2020
1 parent 61edc00 commit c8e9ea3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/FormattedCurrency.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface FormattedCurrencyProps extends Omit<NumberFormatterOptions, 'st
currency?: string;
numberStyle?: 'symbol' | 'accounting' | 'code' | 'name';
style?: TextStyle;
symbolForm?: 'narrow';
value: number;
}

Expand Down
14 changes: 14 additions & 0 deletions src/components/__tests__/FormattedCurrency.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,18 @@ describe('<FormattedCurrency />', () => {

expect(tree).toMatchSnapshot();
});

describe('symbolForm', () => {
test('supports symbolForm prop to use alt narrow currency symbol', () => {
const tree = createWithGlobalize((
<FormattedCurrency
currency="CAD"
symbolForm="narrow"
value={10}
/>
)).toJSON();

expect(tree).toMatchSnapshot();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ exports[`<FormattedCurrency /> renders correctly 1`] = `
$10.00
</Text>
`;

exports[`<FormattedCurrency /> symbolForm supports symbolForm prop to use alt narrow currency symbol 1`] = `
<Text
accessibilityLabel=""
accessible={true}
adjustsFontSizeToFit={false}
allowFontScaling={true}
>
$10.00
</Text>
`;

0 comments on commit c8e9ea3

Please sign in to comment.