How to use the expo-haptics.NotificationFeedbackType function in expo-haptics

To help you get started, we’ve selected a few expo-haptics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Flaque / quirk / src / list / CBTListScreen.tsx View on Github external
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());
  };
github Flaque / quirk / src / articles / MarkdownArticle.tsx View on Github external
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);
github Flaque / quirk / src / main / ShareSuccessScreen.tsx View on Github external
this.setState(prevState => {
      return {
        ...prevState,
        feelingGoodFolks: prevState.feelingGoodFolks + 1,
      };
    });

    await scheduleHappyFolksNotification(
      dayjs()
        .add(1, "day")
        .toISOString()
    );

    stats.userSharedSuccess();

    haptic.notification(Haptic.NotificationFeedbackType.Success);
    setTimeout(() => {
      this.props.navigation.navigate(FINISHED_SCREEN, {
        thought: this.state.thought,
      });
    }, 100);
  };
github Flaque / quirk / src / main / predictions / PredictionSummaryScreen.tsx View on Github external
onFinish = async () => {
    haptic.notification(Haptic.NotificationFeedbackType.Success);
    resetNavigationTo(this.props.navigation, THOUGHT_SCREEN);
  };
github Flaque / quirk / src / main / FinishedScreen.tsx View on Github external
onNext = async () => {
    if (followUpState(this.state.thought) === "ready") {
      const oldThought = this.state.thought;
      oldThought.followUpCompleted = true;
      await saveThought(oldThought);
    }

    if (await this.shouldSendToAndroidReview()) {
      this.props.navigation.navigate(FEEDBACK_SCREEN);
      return;
    }

    resetNavigationTo(this.props.navigation, THOUGHT_SCREEN);
    haptic.notification(Haptic.NotificationFeedbackType.Success);
  };
github expo / expo / apps / native-component-list / src / screens / HapticsScreen.tsx View on Github external
import Button from '../components/Button';
import Colors from '../constants/Colors';
import MonoText from '../components/MonoText';

const sections = [
  {
    methodName: 'notificationAsync',
    method: Haptics.notificationAsync,
    data: [
      {
        accessor: 'Haptics.NotificationFeedbackType.Success',
        value: Haptics.NotificationFeedbackType.Success,
      },
      {
        accessor: 'Haptics.NotificationFeedbackType.Warning',
        value: Haptics.NotificationFeedbackType.Warning,
      },
      {
        accessor: 'Haptics.NotificationFeedbackType.Error',
        value: Haptics.NotificationFeedbackType.Error,
      },
    ],
  },
  {
    methodName: 'impactAsync',
    method: Haptics.impactAsync,
    data: [
      {
        accessor: 'Haptics.ImpactFeedbackStyle.Light',
        value: Haptics.ImpactFeedbackStyle.Light,
      },
      {
github Flaque / quirk / src / checkups / HowYaDoinScreen.tsx View on Github external
onNext = async () => {
    if (this.state.checkup.currentMood === "unselected") {
      return;
    }
    haptic.notification(Haptic.NotificationFeedbackType.Success);
    await saveCheckup(this.state.checkup);

    await scheduleBoost(COMPLETE_CHECKUP);
    if (this.state.checkup.currentMood === "good") {
      await scheduleBoost(FELT_BETTER);
    }

    const nextCheckupDate = dayjs()
      .add(1, "week")
      .toISOString();
    await saveNextCheckupDate(nextCheckupDate);
    scheduleNotification(nextCheckupDate, CHECKUP_ONESIGNAL_TEMPLATE);
    userFinishedCheckup(this.state.checkup.currentMood);

    if (this.state.checkup.currentMood === "bad") {
      this.props.navigation.navigate(CHECKUP_REDIRECT_SCREEN);
github Flaque / quirk / src / alerter / index.tsx View on Github external
setTimeout(() => {
      this.setState({ view: "peak" });
      universalHaptic.notification(Haptic.NotificationFeedbackType.Success);
    }, 350);
  }

expo-haptics

Provides access to the system's haptics engine on iOS and vibration effects on Android.

MIT
Latest version published 2 months ago

Package Health Score

95 / 100
Full package analysis