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;
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);
};
onFinish = async () => {
haptic.impact(Haptic.ImpactFeedbackStyle.Light);
const thought = await saveThought(this.state.thought);
this.props.navigation.push(FINISHED_SCREEN, {
thought,
});
};
onBackspace = () => {
haptic.impact(Haptic.ImpactFeedbackStyle.Medium);
this.setState(prevState => {
if (prevState.code.length === 0) {
return prevState;
}
return {
...prevState,
code: prevState.code.substring(0, prevState.code.length - 1),
};
});
};
onDelete = async () => {
const uuid = this.state.thought.uuid;
await deleteThought(uuid);
this.onNext();
haptic.impact(Haptic.ImpactFeedbackStyle.Heavy);
};