Skip to content
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

Modal.<type>'s locale does not update until after the initial render. #5493

Closed
hargasinski opened this issue Mar 25, 2017 · 1 comment · Fixed by #5494
Closed

Modal.<type>'s locale does not update until after the initial render. #5493

hargasinski opened this issue Mar 25, 2017 · 1 comment · Fixed by #5494

Comments

@hargasinski
Copy link
Contributor

Environment(required)

  • antd version: 2.8.2

What did you do? Please provide steps to re-produce your problem.

  • Wrapped a component in LocaleProvider
  • called Modal.confirm in the component's componentDidMount as the modal should only be displayed on the initial render

Minimial reproducibe case: http://codepen.io/hargasinski/pen/OpbBRB?editors=0010

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import { Modal, LocaleProvider } from 'antd';
import enUS from 'antd/lib/locale-provider/en_US';

class TestComponent extends React.Component {
  componentDidMount() {
    Modal.confirm({
      title: 'Hello World!'
    });
  }

  render() {
    return null;
  }
}

class App extends React.Component {
  render() {
    return (
      <div>
        <LocaleProvider locale={enUS}>
          <TestComponent />
        </LocaleProvider>
      </div>
    );
  }
}

ReactDOM.render(<App />, document.getElementById('root'));

What do you expected?

The modal's buttons to be using the enUS locale.

What happened?

The modal's button are using the default locale.

modal_confirm_bug

Re-producible online demo

http://codepen.io/hargasinski/pen/OpbBRB?editors=0010

@lock
Copy link

lock bot commented May 1, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant