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

the Form Item could not edit #9790

Closed
eruca opened this Issue Mar 23, 2018 · 9 comments

Comments

Projects
None yet
4 participants
@eruca

eruca commented Mar 23, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.3.1

Environment

macOS 10.13.3 Chrome 63

Reproduction link

Edit on CodeSandbox

Steps to reproduce

the Input can not input any value

What is expected?

can be edit

What is actually happening?

not

@benjycui

This comment has been minimized.

Contributor

benjycui commented Mar 26, 2018

Please make sure that your demo work.

image

@eruca

This comment has been minimized.

eruca commented Mar 26, 2018

sorry, I test it myself by adding something without deleting it. Now it can present the problem;

@benjycui

This comment has been minimized.

Contributor

benjycui commented Mar 27, 2018

BasicComponent haven't been re-rendered, you can try to simplify your demo and find out why.

@eruca

This comment has been minimized.

eruca commented Mar 27, 2018

the BasicComponent add

state = {
    value:''
}

and the WrappedComponent add onChange, will work, I change the demo in CodeSanbox;
exists another way without adding state; like

<Form>
{getFieldDecorator(id, option)(<Input />)
</Form>
@eruca

This comment has been minimized.

eruca commented Mar 27, 2018

I read the code, and found the pro.ant.design Login did not have a state for value, can you give some hint?

@eruca

This comment has been minimized.

eruca commented Apr 10, 2018

@afc163 can help?

@yesmeck

This comment has been minimized.

Member

yesmeck commented Apr 11, 2018

@eruca Your codesandbox seems works now, could you confirm that your issue still exists?

@eruca

This comment has been minimized.

eruca commented Apr 12, 2018

yes, but the solution is ugly. I need to add a state useless, just to control re-render, I read the pro.ant.design, there are no state in the BasicComponent, I want to ask why, how can i improve my code ?

@yesmeck

This comment has been minimized.

Member

yesmeck commented Apr 13, 2018

Because we considered Form is a pure component

shouldComponentUpdate(...args: any[]) {
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
}

If you want to use context, try the new React.createContext API.

@yesmeck yesmeck closed this Apr 13, 2018

yesmeck added a commit that referenced this issue Apr 13, 2018

Remove sCU from Form
Related #9790

Form and Form.Item are not considered as pure components

afc163 added a commit that referenced this issue Apr 19, 2018

Remove sCU from Form (#10029)
Related #9790

Form and Form.Item are not considered as pure components
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment