webscopeio / react-textarea-autocomplete

📝 React component implements configurable GitHub's like textarea autocomplete.
MIT License
454 stars 80 forks source link

update textarea content #141

Closed dragon-15 closed 5 years ago

dragon-15 commented 5 years ago

Cant figure out how to update the value of textarea from function.

jukben commented 5 years ago

Hey, check it out the playground implementation

Live: https://874-94480675-gh.circle-artifacts.com/0/example/index.html Code: https://raw.githubusercontent.com/webscopeio/react-textarea-autocomplete/master/example/App.jsx

For example check it out an implementation of "Change value to ":troph". Is it clear?

If not can you please specify more what are you trying to do and maybe create some Codepen with steps to reproduce?

dragon-15 commented 5 years ago

Not working for me, I've updated the codepen provided by you in demo.

https://codepen.io/anon/pen/LaZVWP

jukben commented 5 years ago

The demo is wrong, it has to be inside of React's life cycle using setState for example. As you can see in the example I provided.

dragon-15 commented 5 years ago

I've updated the demo and used setstate. But the issue is still not resolved

https://codepen.io/anon/pen/LaZVWP

jukben commented 5 years ago

Hey, I need some additional context @dragon-15. How are you using this component - as UMD module? Check it out this https://codesandbox.io/s/k34153yp0v. It seems to work there.

EDIT: I was able to run the code also as UDM here - https://codepen.io/jukben/pen/QoMwaO

Closing for now, I guess there is an issue in your code but I don't have a time to debug it right now.

EDIT2: Did the debugging for you, there was a bug in the React version (16.2), upgrade should solve it :(