ReactNative / Switch Component: onValueChange
<p>I've trying to set up a change event if someone modifies a switch component. The approach is to design a view that contains multiple switches and allows the user to set the state per each notification that will end up in a POST api-call. Futher, I'd like to load the initial values from a api-call.</p>

<p>How can I access the state (weather it's checked / unchecked) in my onChangeFunction? And how can I get an element using their ID or name? (same as in HTML/CSS with #mySwitch.setValue(true)?</p>

<p>Given code:</p>

<pre><code>class Settings extends Component {    
    onChangeFunction(type, props) {
        Alert.alert("changed", "==&gt; " + props.state)
    }    

    render() {
        return (
            &lt;View style={styles.container}&gt;
                &lt;Switch onValueChange={this.onChangeFunction.bind(this, "TASK_CREATED", this.props)} value={this.state} /&gt;
            &lt;/View&gt;
        );
    }
}
</code></pre>