Add haptic feedback to likes and reposts

zio/stable
Paul Frazee 2022-12-14 15:46:21 -06:00
parent 4966b2152e
commit 9f27af6199
4 changed files with 23 additions and 1 deletions

View File

@ -320,6 +320,8 @@ PODS:
- TOCropViewController - TOCropViewController
- RNInAppBrowser (3.7.0): - RNInAppBrowser (3.7.0):
- React-Core - React-Core
- RNReactNativeHapticFeedback (1.14.0):
- React-Core
- RNReanimated (2.10.0): - RNReanimated (2.10.0):
- DoubleConversion - DoubleConversion
- FBLazyVector - FBLazyVector
@ -401,6 +403,7 @@ DEPENDENCIES:
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`) - RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNImageCropPicker (from `../node_modules/react-native-image-crop-picker`) - RNImageCropPicker (from `../node_modules/react-native-image-crop-picker`)
- RNInAppBrowser (from `../node_modules/react-native-inappbrowser-reborn`) - RNInAppBrowser (from `../node_modules/react-native-inappbrowser-reborn`)
- RNReactNativeHapticFeedback (from `../node_modules/react-native-haptic-feedback`)
- RNReanimated (from `../node_modules/react-native-reanimated`) - RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`) - RNScreens (from `../node_modules/react-native-screens`)
- RNSVG (from `../node_modules/react-native-svg`) - RNSVG (from `../node_modules/react-native-svg`)
@ -498,6 +501,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-image-crop-picker" :path: "../node_modules/react-native-image-crop-picker"
RNInAppBrowser: RNInAppBrowser:
:path: "../node_modules/react-native-inappbrowser-reborn" :path: "../node_modules/react-native-inappbrowser-reborn"
RNReactNativeHapticFeedback:
:path: "../node_modules/react-native-haptic-feedback"
RNReanimated: RNReanimated:
:path: "../node_modules/react-native-reanimated" :path: "../node_modules/react-native-reanimated"
RNScreens: RNScreens:
@ -552,6 +557,7 @@ SPEC CHECKSUMS:
RNGestureHandler: 28ad20bf02257791f7f137b31beef34b9549f54b RNGestureHandler: 28ad20bf02257791f7f137b31beef34b9549f54b
RNImageCropPicker: 648356d68fbf9911a1016b3e3723885d28373eda RNImageCropPicker: 648356d68fbf9911a1016b3e3723885d28373eda
RNInAppBrowser: e36d6935517101ccba0e875bac8ad7b0cb655364 RNInAppBrowser: e36d6935517101ccba0e875bac8ad7b0cb655364
RNReactNativeHapticFeedback: 1e3efeca9628ff9876ee7cdd9edec1b336913f8c
RNReanimated: 5bdcbcc3a72aedeee7bb099604262403aa75a1e5 RNReanimated: 5bdcbcc3a72aedeee7bb099604262403aa75a1e5
RNScreens: 0df01424e9e0ed7827200d6ed1087ddd06c493f9 RNScreens: 0df01424e9e0ed7827200d6ed1087ddd06c493f9
RNSVG: ecd661f380a07ba690c9c5929c475a44f432d674 RNSVG: ecd661f380a07ba690c9c5929c475a44f432d674

View File

@ -36,6 +36,7 @@
"react-native": "0.68.2", "react-native": "0.68.2",
"react-native-appstate-hook": "^1.0.6", "react-native-appstate-hook": "^1.0.6",
"react-native-gesture-handler": "^2.5.0", "react-native-gesture-handler": "^2.5.0",
"react-native-haptic-feedback": "^1.14.0",
"react-native-image-crop-picker": "^0.38.1", "react-native-image-crop-picker": "^0.38.1",
"react-native-inappbrowser-reborn": "^3.6.3", "react-native-inappbrowser-reborn": "^3.6.3",
"react-native-linear-gradient": "^2.6.2", "react-native-linear-gradient": "^2.6.2",

View File

@ -1,6 +1,14 @@
import React from 'react' import React from 'react'
import {Animated, StyleSheet, Text, TouchableOpacity, View} from 'react-native' import {
Animated,
StyleSheet,
Text,
TouchableOpacity,
View,
Vibration,
} from 'react-native'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import ReactNativeHapticFeedback from 'react-native-haptic-feedback'
import {UpIcon, UpIconSolid} from '../../lib/icons' import {UpIcon, UpIconSolid} from '../../lib/icons'
import {s, colors} from '../../lib/styles' import {s, colors} from '../../lib/styles'
import {useAnimatedValue} from '../../lib/useAnimatedValue' import {useAnimatedValue} from '../../lib/useAnimatedValue'
@ -56,6 +64,7 @@ export function PostCtrls(opts: PostCtrlsOpts) {
const onPressToggleRepostWrapper = () => { const onPressToggleRepostWrapper = () => {
if (!opts.isReposted) { if (!opts.isReposted) {
ReactNativeHapticFeedback.trigger('impactMedium')
Animated.sequence([ Animated.sequence([
Animated.timing(interp1, { Animated.timing(interp1, {
toValue: 1, toValue: 1,
@ -74,6 +83,7 @@ export function PostCtrls(opts: PostCtrlsOpts) {
} }
const onPressToggleUpvoteWrapper = () => { const onPressToggleUpvoteWrapper = () => {
if (!opts.isUpvoted) { if (!opts.isUpvoted) {
ReactNativeHapticFeedback.trigger('impactMedium')
Animated.sequence([ Animated.sequence([
Animated.timing(interp2, { Animated.timing(interp2, {
toValue: 1, toValue: 1,

View File

@ -10218,6 +10218,11 @@ react-native-gradle-plugin@^0.0.6:
resolved "https://registry.yarnpkg.com/react-native-gradle-plugin/-/react-native-gradle-plugin-0.0.6.tgz#b61a9234ad2f61430937911003cddd7e15c72b45" resolved "https://registry.yarnpkg.com/react-native-gradle-plugin/-/react-native-gradle-plugin-0.0.6.tgz#b61a9234ad2f61430937911003cddd7e15c72b45"
integrity sha512-eIlgtsmDp1jLC24dRn43hB3kEcZVqx6DUQbR0N1ABXGnMEafm9I3V3dUUeD1vh+Dy5WqijSoEwLNUPLgu5zDMg== integrity sha512-eIlgtsmDp1jLC24dRn43hB3kEcZVqx6DUQbR0N1ABXGnMEafm9I3V3dUUeD1vh+Dy5WqijSoEwLNUPLgu5zDMg==
react-native-haptic-feedback@^1.14.0:
version "1.14.0"
resolved "https://registry.yarnpkg.com/react-native-haptic-feedback/-/react-native-haptic-feedback-1.14.0.tgz#b50f49dedda4980b3c37c5780823f753cf3ee717"
integrity sha512-dSXZ6gAzl+W/L7BPjOpnT0bx0cgQiSr0sB3DjyDJbGIdVr4ISaktZC6gC9xYFTv2kMq0+KtbKi+dpd0WtxYZMw==
react-native-image-crop-picker@^0.38.1: react-native-image-crop-picker@^0.38.1:
version "0.38.1" version "0.38.1"
resolved "https://registry.yarnpkg.com/react-native-image-crop-picker/-/react-native-image-crop-picker-0.38.1.tgz#5973b4a8b55835b987e6be2064de411e849ac005" resolved "https://registry.yarnpkg.com/react-native-image-crop-picker/-/react-native-image-crop-picker-0.38.1.tgz#5973b4a8b55835b987e6be2064de411e849ac005"