Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentWillMount() {
RNShake.addEventListener('ShakeEvent', () => {
if (this.state.note !== '') {
Alert.alert(
'Create disappearing IPFS note',
'Cannot be undone.',
[
{
text: 'Cancel',
style: 'cancel'
},
{text: 'Confirm', onPress: () => {
this.props.publicNote(this.state.note)
}}
],
{cancelable: true}
)
}
componentDidMount() {
let timeout = null;
if (this.props.type === 'home') {
RNShake.addEventListener('ShakeEvent', () => {
if (!timeout) {
this.props.settingsUpdated({
incognito: !this.props.incognitoMode,
});
timeout = setTimeout(() => {
timeout = false;
}, 1000);
}
});
}
this.initialFadeIn();
}
componentWillUnmount() {//eslint-disable-line
constructor({ maxDelay, eventsRequired, action }) {
this.count = 0;
this.timer = null;
this.maxDelay = maxDelay || 4000;
this.action = action;
this.eventsRequired = eventsRequired || 2;
RNShake.addEventListener('ShakeEvent', this.onShake);
}
componentWillUnmount() {
RNShake.removeEventListener('ShakeEvent')
}
componentWillUnmount() {//eslint-disable-line
RNShake.removeEventListener('ShakeEvent');
}
stopListening() {
RNShake.removeEventListener('ShakeEvent');
}
}