FormidableLabs / freactal

Clean and robust state management for React and React-like libs.
MIT License
1.65k stars 46 forks source link

Use Softupdate edit Textfield, cursor jumps to the end of textfeild #57

Closed lxy305859844 closed 7 years ago

lxy305859844 commented 7 years ago

Hi There, I face a issue when I use softupdate method to edit Textfield. I use react@15.5.4 and material-ui@0.18.1.

I try to use softupdate to reset my state value, however, when I try to insert a word within old value. I only could add the first character and then the cursor just jumps to the end.

for example, if I want add "World" before string "University". what I got is "Wuniveristyorld". since after type "W", the cursor jumps to end of textfield.

initialState: () => ({streetNameNumber: ''})

in effects object setTextValue: softUpdate((state, key, value) => ( {[key]: value })),

in render

<TextField floatingLabelText="Street Number/Name" name="streetNameNumber" id="streetNameNumber" value={state.streetNameNumber} onChange={e => effects.setTextValue(e.target.name, e.target.value)}/>

Anyone know what is going on?

very appreciate.

divmain commented 7 years ago

Hey @lxy305859844, I'm sorry I left this unattended for so long. Lots going on right now! Did you get this resolved? If not, would it be possible for you to provide a repro in the form of a gist or small repo?