Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onNext = () => {
haptic.impact(Haptic.ImpactFeedbackStyle.Light);
// Title screen => Article Screen
if (this.state.index === -1) {
setTimeout(() => this.setState({ articleTopBarPose: "visible" }), 100);
}
// Article screen => Finish
if (this.state.index >= this.props.pages.length - 1) {
haptic.notification(Haptic.NotificationFeedbackType.Success);
this.props.onFinish();
return;
}
this.setState(prevState => {
if (prevState.index + 1 >= this.props.pages.length) {
return prevState;
onItemDelete = (thought: SavedThought) => {
// Ignore the typescript error here, Expo's v31 has a bug
// Upgrade to 32 when it's released to fix
universalHaptic.notification(Haptic.NotificationFeedbackType.Success);
deleteThought(thought.uuid).then(() => this.loadExercises());
};
onNext = () => {
haptic.impact(Haptic.ImpactFeedbackStyle.Light);
// Title screen => Article Screen
if (this.state.index === -1) {
setTimeout(() => this.setState({ articleTopBarPose: "visible" }), 100);
}
// Article screen => Finish
if (this.state.index >= this.props.pages.length - 1) {
haptic.notification(Haptic.NotificationFeedbackType.Success);
this.props.onFinish();
return;
}
this.setState(prevState => {
if (prevState.index + 1 >= this.props.pages.length) {
return prevState;
}
return {
...prevState,
rightFlasherPose: "hidden",
index: prevState.index + 1,
};
});
clearInterval(this._rightFlicker);
onRepeat = async () => {
haptic.impact(Haptic.ImpactFeedbackStyle.Heavy);
userRepeatedThought();
const thought = newThought();
thought.automaticThought = this.state.thought.automaticThought;
this.props.navigation.navigate(AUTOMATIC_THOUGHT_SCREEN, {
thought,
});
};
onFinish = async () => {
haptic.impact(Haptic.ImpactFeedbackStyle.Light);
const thought = await saveThought(this.state.thought);
this.props.navigation.push(FINISHED_SCREEN, {
thought,
});
};
onNext = async () => {
haptic.impact(Haptic.ImpactFeedbackStyle.Light);
stats.thoughtRecorded();
const thought = await saveThought(this.state.thought);
this.props.navigation.push(DISTORTION_SCREEN, {
thought,
});
};
onFinish = async () => {
haptic.impact(Haptic.ImpactFeedbackStyle.Light);
};
if (!this.permissions['mute-user']) {
return;
}
const { room } = this.state;
const { muted } = room;
this.actionSheetOptions = [I18n.t('Cancel')];
const userIsMuted = !!(muted || []).find(m => m === user.username);
user.muted = userIsMuted;
if (userIsMuted) {
this.actionSheetOptions.push(I18n.t('Unmute'));
} else {
this.actionSheetOptions.push(I18n.t('Mute'));
}
this.setState({ userLongPressed: user });
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
this.showActionSheet();
}
onFinish = async () => {
haptic.impact(Haptic.ImpactFeedbackStyle.Light);
const thought = await saveThought(this.state.thought);
this.props.navigation.push(FINISHED_SCREEN, {
thought,
});
};