Skip to content

Commit f046cae

Browse files
committed
Refactor everything without react-intl-rawformat
1 parent 843dc8a commit f046cae

8 files changed

+78
-29
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
"homepage": "https://github.com/frostney/react-intl-native#readme",
5555
"dependencies": {
5656
"react-intl": "^2.0.0-rc-1",
57-
"react-intl-rawformat": "^1.0.2",
5857
"react-native": "^0.22.2"
5958
},
6059
"devDependencies": {
@@ -65,6 +64,7 @@
6564
"babel-polyfill": "^6.7.4",
6665
"babel-preset-es2015-loose": "^7.0.0",
6766
"babel-preset-es2015-loose-rollup": "^7.0.0",
67+
"babel-preset-react": "^6.5.0",
6868
"babel-register": "^6.7.2",
6969
"codecov": "^1.0.1",
7070
"enzyme": "^2.2.0",

src/FormattedDate.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
import React, { Text } from 'react-native';
2-
import { RawFormattedDate } from 'react-intl-rawformat';
1+
import React, { PropTypes, Text } from 'react-native';
2+
import Intl from 'react-intl';
33

4-
const FormattedDate = props =>
5-
<RawFormattedDate component={Text} {...props} />;
4+
const FormattedDate = props => (
5+
<Intl.FormattedDate {...props}>
6+
{localized => <Text style={props.style}>{localized}</Text>}
7+
</Intl.FormattedDate>
8+
);
9+
10+
FormattedDate.propTypes = {
11+
style: PropTypes.any,
12+
};
613

714
export default FormattedDate;

src/FormattedHTMLMessage.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
import React, { Text } from 'react-native';
2-
import { RawFormattedHTMLMessage } from 'react-intl-rawformat';
1+
import React, { PropTypes, Text } from 'react-native';
2+
import Intl from 'react-intl';
33

4-
const FormattedHTMLMessage = props =>
5-
<RawFormattedHTMLMessage component={Text} {...props} />;
4+
const FormattedHTMLMessage = props => (
5+
<Intl.FormattedHTMLMessage {...props}>
6+
{localized => <Text style={props.style}>{localized}</Text>}
7+
</Intl.FormattedHTMLMessage>
8+
);
9+
10+
FormattedHTMLMessage.propTypes = {
11+
style: PropTypes.any,
12+
};
613

714
export default FormattedHTMLMessage;

src/FormattedMessage.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
import React, { Text } from 'react-native';
2-
import { RawFormattedMessage } from 'react-intl-rawformat';
1+
import React, { PropTypes, Text } from 'react-native';
2+
import Intl from 'react-intl';
33

4-
const FormattedMessage = props =>
5-
<RawFormattedMessage component={Text} {...props} />;
4+
const FormattedMessage = props => (
5+
<Intl.FormattedMessage {...props}>
6+
{localized => <Text style={props.style}>{localized}</Text>}
7+
</Intl.FormattedMessage>
8+
);
9+
10+
FormattedMessage.propTypes = {
11+
style: PropTypes.any,
12+
};
613

714
export default FormattedMessage;

src/FormattedNumber.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
import React, { Text } from 'react-native';
2-
import { RawFormattedNumber } from 'react-intl-rawformat';
1+
import React, { PropTypes, Text } from 'react-native';
2+
import Intl from 'react-intl';
33

4-
const FormattedNumber = props =>
5-
<RawFormattedNumber component={Text} {...props} />;
4+
const FormattedNumber = props => (
5+
<Intl.FormattedNumber {...props}>
6+
{localized => <Text style={props.style}>{localized}</Text>}
7+
</Intl.FormattedNumber>
8+
);
9+
10+
FormattedNumber.propTypes = {
11+
style: PropTypes.any,
12+
};
613

714
export default FormattedNumber;

src/FormattedPlural.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
import React, { Text } from 'react-native';
2-
import { RawFormattedPlural } from 'react-intl-rawformat';
1+
import React, { PropTypes, Text } from 'react-native';
2+
import Intl from 'react-intl';
33

4-
const FormattedPlural = props =>
5-
<RawFormattedPlural component={Text} {...props} />;
4+
const FormattedPlural = props => (
5+
<Intl.FormattedPlural {...props}>
6+
{localized => <Text style={props.style}>{localized}</Text>}
7+
</Intl.FormattedPlural>
8+
);
9+
10+
FormattedPlural.propTypes = {
11+
style: PropTypes.any,
12+
};
613

714
export default FormattedPlural;

src/FormattedRelative.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
import React, { Text } from 'react-native';
2-
import { RawFormattedRelative } from 'react-intl-rawformat';
1+
import React, { PropTypes, Text } from 'react-native';
2+
import Intl from 'react-intl';
33

4-
const FormattedRelative = props =>
5-
<RawFormattedRelative component={Text} {...props} />;
4+
const FormattedRelative = props => (
5+
<Intl.FormattedRelative {...props}>
6+
{localized => <Text style={props.style}>{localized}</Text>}
7+
</Intl.FormattedRelative>
8+
);
9+
10+
FormattedRelative.propTypes = {
11+
style: PropTypes.any,
12+
};
613

714
export default FormattedRelative;

src/FormattedTime.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
import React, { Text } from 'react-native';
2-
import { RawFormattedTime } from 'react-intl-rawformat';
1+
import React, { PropTypes, Text } from 'react-native';
2+
import Intl from 'react-intl';
33

4-
const FormattedTime = props =>
5-
<RawFormattedTime component={Text} {...props} />;
4+
const FormattedTime = props => (
5+
<Intl.FormattedTime {...props}>
6+
{localized => <Text style={props.style}>{localized}</Text>}
7+
</Intl.FormattedTime>
8+
);
9+
10+
FormattedTime.propTypes = {
11+
style: PropTypes.any,
12+
};
613

714
export default FormattedTime;

0 commit comments

Comments
 (0)