React Native + Redux: Why does Switch immediately turns back to false after being switched to true?
<p>In iOS React Native + Redux, I am using the following Switch component (<a href="https://facebook.github.io/react-native/docs/switch.html" rel="noreferrer">https://facebook.github.io/react-native/docs/switch.html</a>). It is first set as off, but then when switched on, it immediately switches off by itself. What may be the issue? </p>

<p>This is my set up:</p>

<pre><code>&lt;Switch
  onValueChange={this._handleSwitch}
  value={switch.currentValue}
/&gt;
</code></pre>

<p>And the action triggered is:</p>

<pre><code>  _handleSwitch(value) {
    this.props.actions.triggerSwitch(value)
  }
</code></pre>

<p>And the action is: </p>

<pre><code>export function triggerSwitch(value) {
  return {
    type: TRIGGER_SWITCH,
    currentValue: value
  }
}
</code></pre>

<p>And in the reducer: </p>

<pre><code>const initialState = {
  currentValue: false
}

function switchReducer(switch = initialState, action) {
  switch(action.type) {
    case TRIGGER_SWITCH:
      return {
        currentValue: action.currentValue
      }

     default:
       return switch
  }
}

export default switchReducer
</code></pre>

<p>Thank you!</p>