Commit 0d9493de authored by Matthew Taylor's avatar Matthew Taylor

Remove `option` warning in console

`option` throws an error in React if it’s not a string. `FormattedMessage` returns a `span` around strings, so any time this function was loaded/called, it was throwing >100 warnings in the console. use `intl` to return a string instead.
parent 6d5bb4f8
......@@ -27,9 +27,14 @@ var Tooltip = require('../../components/tooltip/tooltip.jsx');
require('./steps.scss');
var DEFAULT_COUNTRY = 'us';
var getCountryOptions = function (defaultCountry) {
var getCountryOptions = function (defaultCountry, intl) {
if (typeof intl === 'undefined') {
intl = defaultCountry;
defaultCountry = undefined;
}
var options = countryData.countryOptions.concat({
label: <intl.FormattedMessage id="registration.selectCountry" />,
label: intl.formatMessage({id: 'registration.selectCountry'}),
disabled: true,
selected: true
});
......@@ -347,7 +352,7 @@ module.exports = {
</div>
<Select label={formatMessage({id: 'general.country'})}
name="user.country"
options={getCountryOptions(DEFAULT_COUNTRY)}
options={getCountryOptions(DEFAULT_COUNTRY, this.props.intl)}
required />
<Checkbox className="demographics-checkbox-is-robot"
label="I'm a robot!"
......@@ -660,7 +665,7 @@ module.exports = {
<Form onValidSubmit={this.onValidSubmit}>
<Select label={formatMessage({id: 'general.country'})}
name="address.country"
options={getCountryOptions()}
options={getCountryOptions(this.props.intl)}
value={this.props.defaultCountry}
onChange={this.onChangeCountry}
required />
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment