-
Notifications
You must be signed in to change notification settings - Fork 20
Make it work with react native 0.51 #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
17d7808
92bc57f
1eaf3f6
91e0b28
08ab8a4
cc56db0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
"name": "react-intl-native", | ||
"version": "2.1.1", | ||
"description": "Convenience components for react-intl's `format*` API in React Native", | ||
"main": "dist/react-intl-native.js", | ||
"jsnext:main": "dist/react-intl-native.es2015.js", | ||
"main": "src/index.js", | ||
"jsnext:main": "src/index.js", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"scripts": { | ||
"prebuild": "rimraf dist", | ||
"build": "rollup-babel-lib-bundler -f cjs,es6 src/index.js", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it's directly referencing the source, we don't need the rollup builds any more. I'm not sure if it's in the scope of the pull request though. |
||
|
@@ -55,6 +55,7 @@ | |
}, | ||
"homepage": "https://github.com/frostney/react-intl-native#readme", | ||
"dependencies": { | ||
"prop-types": "^15.6.0", | ||
"react-intl": "^2.1.2" | ||
}, | ||
"devDependencies": { | ||
|
@@ -77,9 +78,9 @@ | |
"in-publish": "^2.0.0", | ||
"jsdom": "^9.12.0", | ||
"nyc": "^6.4.0", | ||
"react": "^0.14.8", | ||
"react": "^0.14.9", | ||
"react-addons-test-utils": "^0.14.8", | ||
"react-dom": "^0.14.8", | ||
"react-dom": "^0.14.9", | ||
"react-native": "^0.25.1", | ||
"rimraf": "^2.5.2", | ||
"rollup-babel-lib-bundler": "^2.5.5" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import React, { PropTypes } from 'react'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Text } from 'react-native'; | ||
import Intl from 'react-intl'; | ||
import * as Intl from 'react-intl'; | ||
|
||
const FormattedDate = props => ( | ||
<Intl.FormattedDate {...props}> | ||
|
@@ -10,6 +11,21 @@ const FormattedDate = props => ( | |
|
||
FormattedDate.propTypes = { | ||
style: PropTypes.any, | ||
localeMatcher: PropTypes.oneOf(['best fit', 'lookup']), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 for writing all of these up |
||
formatMatcher: PropTypes.oneOf(['basic', 'best fit']), | ||
|
||
timeZone: PropTypes.string, | ||
hour12: PropTypes.bool, | ||
|
||
weekday: PropTypes.oneOf(['narrow', 'short', 'long']), | ||
era: PropTypes.oneOf(['narrow', 'short', 'long']), | ||
year: PropTypes.oneOf(['numeric', '2-digit']), | ||
month: PropTypes.oneOf(['numeric', '2-digit', 'narrow', 'short', 'long']), | ||
day: PropTypes.oneOf(['numeric', '2-digit']), | ||
hour: PropTypes.oneOf(['numeric', '2-digit']), | ||
minute: PropTypes.oneOf(['numeric', '2-digit']), | ||
second: PropTypes.oneOf(['numeric', '2-digit']), | ||
timeZoneName: PropTypes.oneOf(['short', 'long']), | ||
}; | ||
|
||
export default FormattedDate; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,33 @@ | ||
import React, { PropTypes } from 'react'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Text } from 'react-native'; | ||
import Intl from 'react-intl'; | ||
import * as Intl from 'react-intl'; | ||
|
||
const FormattedPlural = props => ( | ||
<Intl.FormattedPlural {...props}> | ||
const FormattedPlural = props => { | ||
let propsCopy = {...props} | ||
delete propsCopy.style | ||
|
||
if ("formatStyle" in props) { | ||
propsCopy.style = props.formatStyle | ||
} | ||
|
||
return ( | ||
<Intl.FormattedPlural {...propsCopy}> | ||
{localized => <Text style={props.style}>{localized}</Text>} | ||
</Intl.FormattedPlural> | ||
); | ||
)}; | ||
|
||
FormattedPlural.propTypes = { | ||
formatStyle: PropTypes.oneOf(['cardinal', 'ordinal']), | ||
style: PropTypes.any, | ||
value: PropTypes.any.isRequired, | ||
other: PropTypes.node.isRequired, | ||
zero: PropTypes.node, | ||
one: PropTypes.node, | ||
two: PropTypes.node, | ||
few: PropTypes.node, | ||
many: PropTypes.node, | ||
children: PropTypes.func, | ||
}; | ||
|
||
export default FormattedPlural; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
import React, { PropTypes } from 'react'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Text } from 'react-native'; | ||
import Intl from 'react-intl'; | ||
import * as Intl from 'react-intl'; | ||
|
||
const FormattedRelative = props => ( | ||
<Intl.FormattedRelative {...props}> | ||
{localized => <Text style={props.style}>{localized}</Text>} | ||
</Intl.FormattedRelative> | ||
); | ||
const FormattedRelative = props => { | ||
let propsCopy = {...props} | ||
delete propsCopy.style | ||
|
||
if ("formatStyle" in props) { | ||
propsCopy.style = props.formatStyle | ||
} | ||
|
||
return ( | ||
<Intl.FormattedRelative {...propsCopy}> | ||
{localized => <Text style={props.style}>{localized}</Text>} | ||
</Intl.FormattedRelative> | ||
) | ||
}; | ||
|
||
FormattedRelative.propTypes = { | ||
style: PropTypes.any, | ||
formatStyle: PropTypes.oneOf(['best fit', 'numeric']), | ||
units: PropTypes.oneOf(['second', 'minute', 'hour', 'day', 'month', 'year']), | ||
value: PropTypes.any.isRequired, | ||
format: PropTypes.string, | ||
updateInterval: PropTypes.number, | ||
initialNow: PropTypes.any, | ||
children: PropTypes.func, | ||
}; | ||
|
||
export default FormattedRelative; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍