How to use the expo-haptics.impactAsync 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 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 RocketChat / Rocket.Chat.ReactNative / app / views / RoomView / index.js View on Github external
onReactionLongPress = (message) => {
		this.setState({ selectedMessage: message, reactionsModalVisible: true });
		Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
	}
github Flaque / quirk / src / haptic.ts View on Github external
impact: type => {
    if (Platform.OS !== "ios") {
      return;
    }

    Haptic.impactAsync(type);
  },
};
github thomaswang / react-native-gradient-buttons / src / index.js View on Github external
onPress={disabled ? null : () => {
          if (Platform.OS === "ios" && impact === true) {
            Haptics.impactAsync(Haptics.ImpactFeedbackStyle[impactStyle]);
          }
          if (onPressAction) {
            return onPressAction();
          }
        }}
      >
github RocketChat / Rocket.Chat.ReactNative / app / containers / MessageActions.js View on Github external
setTimeout(() => {
			this.showActionSheet();
			Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
		});
	}
github mirshko / unleaded / src / components / TouchableHaptic / index.js View on Github external
onPress={() => {
      onPress();
      Haptic.impactAsync(Haptic.ImpactFeedbackStyle[impact]);
    }}
  >
github keybase / client / shared / actions / platform-specific / index.native.tsx View on Github external
const onEnableAudioRecording = async (
  state: Container.TypedState,
  action: Chat2Gen.EnableAudioRecordingPayload,
  logger: Saga.SagaLogger
) => {
  const conversationIDKey = action.payload.conversationIDKey
  const audio = state.chat2.audioRecording.get(conversationIDKey)
  if (!audio || ChatConstants.isCancelledAudioRecording(audio)) {
    logger.info('enableAudioRecording: no recording info set, bailing')
    return false
  }

  if (isIOS) {
    Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light)
  } else {
    Vibration.vibrate(50)
  }
  const outboxID = ChatConstants.generateOutboxID()
  const audioPath = await RPCChatTypes.localGetUploadTempFileRpcPromise({filename: 'audio.m4a', outboxID})
  AudioRecorder.prepareRecordingAtPath(audioPath, {
    AudioEncoding: 'aac',
    AudioEncodingBitRate: 32000,
    AudioQuality: 'Low',
    Channels: 1,
    MeteringEnabled: true,
    SampleRate: 22050,
  })
  AudioRecorder.onProgress = null
  AudioRecorder.onFinished = () => {
    logger.info('onEnableAudioRecording: recording finished')

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