-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Triggering Bubbled Component Events #2164
Comments
I really don't understand what you trying to do. There is a React way to handle changes of class Example extends React.Component {
state = { value: '' }
handleChange = (e, { value }) => {
// call any other actions
this.setState({ value })
}
render() {
const { value } = this.state
return <Input onChange={this.handleChange} value={value} />
}
} I don't see neither the logic, nor the value in your proposal now. Please make a valid code example where we will can see the usefulness of your proposal. |
You didn't understand what I described. What you do is to Handle User Input Changes. What I want to do is to Handle Programmatically Input Changes. And when you change a Component's properties programmatically, events are not naturally called. So if you're gonna change the input manually/programmatically: Naturally, there is a function called PS |
And I still don't understand your practical need in this. If it is so necessary, then use findDOMNode(). You will receive a DOM node and then you can call
I don't see issue there, there is a workaround with
It's one thing, React offers a one-way data flow, anything another is bad solution in most cases. setFoo() {
this.input.value = 'foo';
this.inputChange();
} The code above would never have gone through my code review because there is a direct DOM manipulation. It's the antipattern, possible you don't need React at all? |
... you know you're saying that because you're pissed right? And I can see it as well. Because there is not really any point of saying such thing for a productive discussion. Obviously, I have my reasons for using React and that's none of anyone's concerns.
This code obviously is code just to present my point fast. Not to demonstrate to anyone my coding skills. Obviously, behind this, I'm changing the component's state/or redux or whatever in your preference, which state is input's value, instead of changing directly the components property. But for the sake of simplicity, I've gone the short way of changing directly the Components value property. Like in this example:
Well, when
now it's triggered (without event or data though) but we have one problem, no bubble effect, therefore |
Having similar issue. My situation is that I'm building a number picker to feed into the control of the Semantic UI's Form field. After changing the internal state of my control using onKeyDown(), the value of input changes but the onChange is not fired. I need it to fire in order to pass the data to the parent component, which originally supplies the onChange function. Reminder that onChange callback has (event, data). |
I want to report for a:
HTML components have a built-in function that lets you dispatch an event.
As far as I searched, there isn't such feature in Semantic-UI components. Is there? Since I didn't find anything regarding such feature, I would suggest the creation of it.
For example, I want to trigger manually an event, but if I do it like this:
And I have a component in this shape:
It's gonna be buggy. Parent components, in this case, div's onChange, won't be triggered because the bubbling event is not there.
And as far as I know we can't achieve bubbling in Semantic-UI-React, can we? Excuse me if I'm wrong.
The text was updated successfully, but these errors were encountered: