How to use the expo-haptics.notificationAsync 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 keybase / client / shared / actions / platform-specific / index.native.tsx View on Github external
const audio = state.chat2.audioRecording.get(conversationIDKey)
  if (!audio) {
    logger.info('stopAudioRecording: no audio record, not sending')
    return false
  }
  if (
    audio.status === Types.AudioRecordingStatus.CANCELLED ||
    action.payload.stopType === Types.AudioStopType.CANCEL
  ) {
    logger.info('stopAudioRecording: recording cancelled, bailing out')
    await RPCChatTypes.localCancelUploadTempFileRpcPromise({outboxID: audio.outboxID})
    return false
  }
  if (ChatConstants.audioRecordingDuration(audio) < 500 || audio.path.length === 0) {
    logger.info('stopAudioRecording: recording too short, skipping')
    Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error)
    return Chat2Gen.createStopAudioRecording({conversationIDKey, stopType: Types.AudioStopType.CANCEL})
  }

  if (audio.status === Types.AudioRecordingStatus.STAGED) {
    logger.info('stopAudioRecording: in staged mode, not sending')
    return false
  }
  return Chat2Gen.createSendAudioRecording({conversationIDKey, fromStaged: false, info: audio})
}
github keybase / client / shared / actions / platform-specific / index.native.tsx View on Github external
const onSendAudioRecording = (action: Chat2Gen.SendAudioRecordingPayload) => {
  if (!action.payload.fromStaged) {
    if (isIOS) {
      Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success)
    } else {
      Vibration.vibrate(50)
    }
  }
}
github Flaque / quirk / src / haptic.ts View on Github external
notification: type => {
    if (Platform.OS !== "ios") {
      return;
    }

    Haptic.notificationAsync(type);
  },
  selection: () => {

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