How to use expo-haptics - 10 common examples

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 / 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;
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 / FinishedScreen.tsx View on Github external
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,
    });
  };
github Flaque / quirk / src / main / DistortionScreen.tsx View on Github external
onFinish = async () => {
    haptic.impact(Haptic.ImpactFeedbackStyle.Light);
    const thought = await saveThought(this.state.thought);
    this.props.navigation.push(FINISHED_SCREEN, {
      thought,
    });
  };
github Flaque / quirk / src / main / AutomaticThoughtScreen.tsx View on Github external
onNext = async () => {
    haptic.impact(Haptic.ImpactFeedbackStyle.Light);
    stats.thoughtRecorded();
    const thought = await saveThought(this.state.thought);
    this.props.navigation.push(DISTORTION_SCREEN, {
      thought,
    });
  };
github Flaque / quirk / src / main / survey / SurveyScreen.tsx View on Github external
onFinish = async () => {
    haptic.impact(Haptic.ImpactFeedbackStyle.Light);
  };
github RocketChat / Rocket.Chat.ReactNative / app / views / RoomMembersView / index.js View on Github external
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();
	}
github Flaque / quirk / src / main / ChallengeScreen.tsx View on Github external
onFinish = async () => {
    haptic.impact(Haptic.ImpactFeedbackStyle.Light);
    const thought = await saveThought(this.state.thought);
    this.props.navigation.push(FINISHED_SCREEN, {
      thought,
    });
  };

expo-haptics

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

MIT
Latest version published 7 months ago

Package Health Score

85 / 100
Full package analysis