I have two buttons that both call the same onPress function. In the callback I want to be able to differentiate between which was pressed.
One solution is to pass that info as a parameter:
this._toggle(event, 'A')}
/>
The callback would then use that parameter
_toggle(event, buttonId) {
// Use buttonId
}
EDIT: Another solution is a parent component that always returns the title prop:
class RadioParent extends Component {
render() {
return (
this.props.onPress(event, this.props.title)}
/>
);
}
}