Skip to content

Switch is not working with Redux #12

@mvsiva4u

Description

@mvsiva4u

We used switch where the initial state set in Redux. but when entered the data and saving in local , If i'm fetching back the details it is not behaving as expected. Below is the code we have written.
<Switch
value={this.state.address.sameas.value === 'N' ? false : true}
switchWidth={50}
switchHeight={25}
buttonWidth={25}
buttonHeight={25}
switchBorderColor={'rgba(0, 0, 0, 1)'}
activeBackgroundColor={'#009669'}
inactiveBackgroundColor={'#888888'}
buttonBorderColor={'rgba(0, 0, 0, 1)'}
buttonBorderWidth={1}
padding={false}
onChangeValue={sameas => {
address.sameas.value = sameas ? 'Y' : 'N';
this.setState({ address});
}}
/>

below is the way setting the state in redux.

sameas: {
value: 'N',
error: '',
enable: true
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions