react-intl-native
react-intl
convinience components for React Native
While react-intl
allows us to use formatMessage
or passing in a function, this becomes tiresome if you have to do this for each. This module does the latter and wraps it all in a Text
component allowing you to pass in style
to provide custom styling.
Installation
$ npm install react-intl-native
Usage
Wrap your main component inside react-intl
s IntlProvider
like you would in your web application:
;
<IntlProvider ="en"> <MainView /></IntlProvider>
FormattedDate
<FormattedDate ="long" = = />
More information on date formatting options: https://github.com/yahoo/react-intl/wiki/Components#date-formatting-components
FormattedHTMLMessage
<FormattedHTMLMessage ="Hello there" = />
FormattedMessage
<FormattedMessage ="Hello there" = />
FormattedNumber
This is the only component that differs slightly from the original component. For the formatting style you need to use formatStyle
instead of style
. style
is being reserved for the component styling.
<FormattedNumber ="currency" = = />
More information on number formatting options: https://github.com/yahoo/react-intl/wiki/Components#formattednumber
FormattedPlural
<FormattedPlural = ="message" ="messages" = />
More information on plural formatting options: https://github.com/yahoo/react-intl/wiki/Components#formattedplural
FormattedRelative
<FormattedRelative = = />
More information on date formatting options: https://github.com/yahoo/react-intl/wiki/Components#date-formatting-components
FormattedTime
<FormattedTime = ="numeric" = />
More information on date formatting options: https://github.com/yahoo/react-intl/wiki/Components#date-formatting-components
For more information, take a look the react-intl
documentation: https://github.com/yahoo/react-intl/wiki/Components
License
MIT