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

I18n render prop causes controlled input to lose focus #302

Closed
alexanbj opened this issue Aug 30, 2018 · 2 comments
Closed

I18n render prop causes controlled input to lose focus #302

alexanbj opened this issue Aug 30, 2018 · 2 comments

Comments

@alexanbj
Copy link

Describe the bug
Wrapping inputs in the new I18n render prop component introduced in 2.5.0 causes the input to lose focus on every keystroke.

To Reproduce
Steps to reproduce the behavior, possibly with minimal code sample, e.g:

import React from 'react';
import { I18n } from '@lingui/react';

export default class extends React.Component {
  state = { value: '' };
  render() {
    return (
      <I18n>
        {({ i18n }) => (
          <input
            value={this.state.value}
            onChange={event => this.setState({ value: event.target.value })}
          />
        )}
      </I18n>
    );
  }
}

I've also reproduced this in the official examples here: https://github.com/alexanbj/js-lingui/blob/render-prop-bug/examples/webpack-react/src/RenderPropBug.js

Expected behavior
That the input remains focused as I type, even though it is wrapped in a render prop component.

@tricoder42
Copy link
Contributor

Hey @alexanbj,
I've just found the bug! Pushing a fix soon :)

Thanks for reporting! 👍

@tricoder42
Copy link
Contributor

Released in v2.6.0

Photonios pushed a commit to SectorLabs/js-lingui that referenced this issue Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants