diff --git a/README.md b/README.md index 5106157..09b6f65 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,14 @@ Notification haptics provide feedback about the outcome of a task or action, suc Selection haptics provide feedback while the values of a UI element are changing, see [HIG for visualization](https://developer.apple.com/design/human-interface-guidelines/playing-haptics#Selection). +### `Haptics.impactWithIntensity(style: 'light' | 'medium' | 'heavy' | 'soft' | 'rigid', intensity: number)` + +**This function is not supported on Android** + +The `impactWithIntensity` provides haptic feedback with a customizable intensity level. This allows to adjust the strength of the haptic feedback based on the needs of the application, offering a more refined and dynamic user experience. + +`intensity`: A number between `0.0` and `1` that determines the strength of the haptic feedback, see [Triggers impact feedback with a specific intensity](https://developer.apple.com/documentation/uikit/uiimpactfeedbackgenerator/impactoccurred(intensity:)) + ## License MIT diff --git a/android/src/main/java/com/margelo/nitro/nitrohaptics/HybridHaptics.kt b/android/src/main/java/com/margelo/nitro/nitrohaptics/HybridHaptics.kt index a3f099f..b5ae60e 100644 --- a/android/src/main/java/com/margelo/nitro/nitrohaptics/HybridHaptics.kt +++ b/android/src/main/java/com/margelo/nitro/nitrohaptics/HybridHaptics.kt @@ -105,6 +105,12 @@ class HybridHaptics: HybridHapticsSpec() { vibrate(selectionType) } + @DoNotStrip + @Keep + override fun impactWithIntensity(style: ImpactFeedbackStyle, intensity: Double): Unit { + Log.e("Haptics", "impactWithIntensity is unsupported on Android") + } + override val memorySize: Long get() = 0L diff --git a/example/App.tsx b/example/App.tsx index 9fa0d23..12a1cbb 100644 --- a/example/App.tsx +++ b/example/App.tsx @@ -47,6 +47,10 @@ function App(): React.JSX.Element { onPress={() => Haptics.notification('warning')} />