Skip to content

Commit

Permalink
feat: add haptic-feedback to deps
Browse files Browse the repository at this point in the history
  • Loading branch information
osdnk committed Sep 17, 2020
1 parent 45d77b8 commit cd92295
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Example/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
'react-native-gesture-handler':
'./node_modules/react-native-gesture-handler',
'react-native-haptic-feedback':
'./node_modules/react-native-haptic-feedback',
'../node_modules/react-native-haptic-feedback',
'react-native-reanimated': './node_modules/react-native-reanimated',
'react-native-svg': './node_modules/react-native-svg',
},
Expand Down
6 changes: 0 additions & 6 deletions Example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,6 @@ PODS:
- React-jsi (= 0.63.2)
- RNGestureHandler (1.7.0):
- React
- RNReactNativeHapticFeedback (1.10.0):
- React
- RNReanimated (2.0.0-alpha.6):
- DoubleConversion
- FBLazyVector
Expand Down Expand Up @@ -386,7 +384,6 @@ DEPENDENCIES:
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNReactNativeHapticFeedback (from `../node_modules/react-native-haptic-feedback`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNSVG (from `../node_modules/react-native-svg`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
Expand Down Expand Up @@ -461,8 +458,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon"
RNGestureHandler:
:path: "../node_modules/react-native-gesture-handler"
RNReactNativeHapticFeedback:
:path: "../node_modules/react-native-haptic-feedback"
RNReanimated:
:path: "../node_modules/react-native-reanimated"
RNSVG:
Expand Down Expand Up @@ -509,7 +504,6 @@ SPEC CHECKSUMS:
React-RCTVibration: 4d2e726957f4087449739b595f107c0d4b6c2d2d
ReactCommon: a0a1edbebcac5e91338371b72ffc66aa822792ce
RNGestureHandler: b6b359bb800ae399a9c8b27032bdbf7c18f08a08
RNReactNativeHapticFeedback: 22c5ecf474428766c6b148f96f2ff6155cd7225e
RNReanimated: 6bd3347e383cee6eb879a1a7d6c748934a015a05
RNSVG: ce9d996113475209013317e48b05c21ee988d42e
Yoga: 7740b94929bbacbddda59bf115b5317e9a161598
Expand Down
1 change: 0 additions & 1 deletion Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"react-coin-icon": "^0.1.19",
"react-native": "0.63.2",
"react-native-gesture-handler": "^1.7.0",
"react-native-haptic-feedback": "^1.10.0",
"react-native-reanimated": "^2.0.0-alpha.6",
"react-native-redash": "^14.2.4",
"react-native-shadow-stack": "^0.0.5",
Expand Down
5 changes: 0 additions & 5 deletions Example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5555,11 +5555,6 @@ react-native-gesture-handler@^1.7.0:
invariant "^2.2.4"
prop-types "^15.7.2"

react-native-haptic-feedback@^1.10.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/react-native-haptic-feedback/-/react-native-haptic-feedback-1.10.0.tgz#869d2e7179a17226becf43173c6f6495038524a0"
integrity sha512-2aEXYTLrQq2N3phaGJ23V0x6qsIz4j1vhTck9A7geTfW7J54mOfk1Pr4Y1WEMMKptFA9p78kZHBb31IIE+g37w==

react-native-reanimated@^2.0.0-alpha.6:
version "2.0.0-alpha.6"
resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-2.0.0-alpha.6.tgz#d3b55127e8202a12b9073c97086dfe85283c9e08"
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ I'm still not sure if it's a good move so we can decide to move some props from
yarn add @rainbow-me/animated-charts
npm i @rainbow-me/animated-charts
```
3. If you want to use haptic feedback on the press in / out, install
```bash
yarn add react-native-haptic-feedback
npm i react-native-haptic-feedback
```

The library is verified on `2.0.0-alpha.6` version of reanimated.

Expand Down Expand Up @@ -116,7 +111,7 @@ The whole chart's structure has to be wrapped with `ChartProvider`. It's respons
| Prop name | type | default / obligatory | description |
|-----------------|------------|------------------------|-------------|
| `softMargin` | `number` | `0` | While scrubbing the chart touching edges of the screen you may want make points on the edges more accessible. With `softMargin` it's possible to access points on edges doubling the speed of scrubbing beyond this margin. |
| `enableHaptics` | `boolean` | `false` | On pressing in/out on the chart it might be expected to make haptic feedback. It will happen with `enableHaptics` set to `true` and `react-native-haptic-feedback` installed |
| `enableHaptics` | `boolean` | `false` | On pressing in/out on the chart it might be expected to make haptic feedback. It will happen with `enableHaptics` set to `true`. |
| `data` | <code>{ points: [Point], nativePoints: [Point], smoothingStrategy?: 'bezier'&#124;'simple'&#124;'complex', smoothingFactor }<code/> | obligatory | Object containing data structure and way to display them. Each of the properties is explained below. |
| `springConfig` | object | `{damping: 15, mass: 1, stiffness: 600}` | Object [defining the spring animation](https://docs.swmansion.com/react-native-reanimated/docs/next/animations). This spring is used for a dot's scale.
| `timingFeedbackConfig` | object | `{duration: 80}` | Object [defining the timing animation](https://docs.swmansion.com/react-native-reanimated/docs/next/animations). `timingFeedbackConfig` is used for a path's opacity and width.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"@babel/runtime": "^7.11.2",
"react-native-gesture-handler": "^1.7.0",
"react-native-reanimated": "^2.0.0-alpha.5",
"react-native-svg": "^12.1.0"
"react-native-svg": "^12.1.0",
"react-native-haptic-feedback": "^1.10.0"
},
"peerDependencies": {
"react": "*",
Expand Down
5 changes: 2 additions & 3 deletions src/charts/linear/ChartPathProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import {
withTiming,
// eslint-disable-next-line import/no-unresolved
} from 'react-native-reanimated';
import hapticFeedback from 'react-native-haptic-feedback'
import ChartContext from '../../helpers/ChartContext';
import { findYExtremes } from '../../helpers/extremesHelpers';
import useReactiveSharedValue from '../../helpers/useReactiveSharedValue';

function impactHeavy() {
// eslint-disable-next-line import/no-extraneous-dependencies
const ReactNativeHapticFeedback = require('react-native-haptic-feedback');
ReactNativeHapticFeedback.default.trigger('impactHeavy');
hapticFeedback.trigger('impactHeavy');
}

const android = Platform.OS === 'android';
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2282,6 +2282,11 @@ react-native-gesture-handler@^1.7.0:
invariant "^2.2.4"
prop-types "^15.7.2"

react-native-haptic-feedback@^1.10.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/react-native-haptic-feedback/-/react-native-haptic-feedback-1.10.0.tgz#869d2e7179a17226becf43173c6f6495038524a0"
integrity sha512-2aEXYTLrQq2N3phaGJ23V0x6qsIz4j1vhTck9A7geTfW7J54mOfk1Pr4Y1WEMMKptFA9p78kZHBb31IIE+g37w==

react-native-reanimated@^2.0.0-alpha.5:
version "2.0.0-alpha.5"
resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-2.0.0-alpha.5.tgz#ecbb934b9842bd60f74cc28bd5ad181fc34b1ce2"
Expand Down

0 comments on commit cd92295

Please sign in to comment.