mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 12:51:42 +03:00
fixed #287
This commit is contained in:
parent
ed721942fa
commit
929130ba3a
@ -6,7 +6,6 @@ import { View, TouchableOpacity, Animated } from 'react-native';
|
||||
// Components
|
||||
|
||||
// Styles
|
||||
// eslint-disable-next-line
|
||||
import styles from './toggleSwitchStyles';
|
||||
|
||||
class ToggleSwitchView extends PureComponent {
|
||||
@ -24,7 +23,7 @@ class ToggleSwitchView extends PureComponent {
|
||||
circleWidth: 28,
|
||||
circleHeight: 28,
|
||||
translateX: 36,
|
||||
isOn: false || props.isOn,
|
||||
isOn: props.isOn || false,
|
||||
};
|
||||
}
|
||||
|
||||
@ -70,15 +69,12 @@ class ToggleSwitchView extends PureComponent {
|
||||
_onToggle = () => {
|
||||
const { onToggle } = this.props;
|
||||
const { isOn } = this.state;
|
||||
this.setState({ isOn: !isOn });
|
||||
|
||||
this.setState(
|
||||
{
|
||||
isOn: !isOn,
|
||||
},
|
||||
() => {
|
||||
onToggle && onToggle(!isOn);
|
||||
},
|
||||
);
|
||||
// For debounce
|
||||
setTimeout(() => {
|
||||
if (onToggle) onToggle(!isOn);
|
||||
}, 300);
|
||||
};
|
||||
|
||||
render() {
|
||||
|
Loading…
Reference in New Issue
Block a user