Bug Fixes
Enhancements
React Native
React Native is now officially supported by leveraging a simple, clever approach thought-up by @steida and implemented by @mschipperheyn. The major issue with React Native support is that the React Intl components must render an element, which defaults to <span>
. In React Native, this needs to be <Text>
.
To get around this issue, <IntlProvider>
now accepts a textComponent
prop (which defaults to "span"
. In a React Native environment, this can be set to Text
:
import React from 'react';
import {View, Text} from 'react-native';
import {IntlProvider, FormattedDate} from 'react-intl':
const now = Date.now();
export default () => (
<IntlProvider
locale='en'
textComponent={Text}
>
<View>
<Text>Today is: <FormattedDate value={now}/></Text>
</View>
</IntlProvider>
);
(#600, #739, @steida, @mschipperheyn)
Note on Testing
If you're manually mocking context.intl
in your tests, you'll need to be sure to add a textComponent
prop which React Intl now relies on.
const mockedIntlContext = {
intl: {
textComponent: 'span'
}
};
Ideally you shouldn't need to muck context.intl
manually, see the docs on Testing with React Intl.
Other Enhancements
- Ported examples to use
create-react-app
(#669, #673, @iswanj) - Added Jest snapshot testing example (#683, @zouxuoz)
- Removed
propTypes
from production builds to reduce file size (#701, @mbrevda) - Updated Travis config, remove Node 0.12 and 5, add Node 7. Testing Node: 4.2, 6, and 7 (#713)
- Switched to Jest for running tests (#713)