mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 21:01:31 +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
|
// Components
|
||||||
|
|
||||||
// Styles
|
// Styles
|
||||||
// eslint-disable-next-line
|
|
||||||
import styles from './toggleSwitchStyles';
|
import styles from './toggleSwitchStyles';
|
||||||
|
|
||||||
class ToggleSwitchView extends PureComponent {
|
class ToggleSwitchView extends PureComponent {
|
||||||
@ -24,7 +23,7 @@ class ToggleSwitchView extends PureComponent {
|
|||||||
circleWidth: 28,
|
circleWidth: 28,
|
||||||
circleHeight: 28,
|
circleHeight: 28,
|
||||||
translateX: 36,
|
translateX: 36,
|
||||||
isOn: false || props.isOn,
|
isOn: props.isOn || false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,15 +69,12 @@ class ToggleSwitchView extends PureComponent {
|
|||||||
_onToggle = () => {
|
_onToggle = () => {
|
||||||
const { onToggle } = this.props;
|
const { onToggle } = this.props;
|
||||||
const { isOn } = this.state;
|
const { isOn } = this.state;
|
||||||
|
this.setState({ isOn: !isOn });
|
||||||
|
|
||||||
this.setState(
|
// For debounce
|
||||||
{
|
setTimeout(() => {
|
||||||
isOn: !isOn,
|
if (onToggle) onToggle(!isOn);
|
||||||
},
|
}, 300);
|
||||||
() => {
|
|
||||||
onToggle && onToggle(!isOn);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
Loading…
Reference in New Issue
Block a user