Skip to content

Conversation

@anhquan291
Copy link

Hi @oblador,
A huge thanks of this creating this repo with Nitro. I’m currently using it in my application, and it’s been fantastic.
In my app, I have a ruler picker component, and I wanted to provide a really light haptic feedback for better user experience. To achieve this, I’ve added the impactWithIntensity method to the Haptics API.

By the way, Happy new year!!!

Description
This pull request introduces the impactWithIntensity method to the Haptics API. This new method allows for haptic feedback with a configurable intensity value, ranging from 0 to 1. The intensity parameter is provided as a NSNumber type, ensuring better compatibility with APIs that expect NSNumber objects.

Key Changes:
Added impactWithIntensity(style: ImpactFeedbackStyle, intensity: Double) to the Haptics API.

Notes:
This method is currently unsupported on Android.
The intensity value is expected to be a number between 0 and 1, inclusive.

@oblador
Copy link
Owner

oblador commented Feb 26, 2025

Thank you for this PR! I've been thinking about potentially exposing generators as a hybrid object instead for people that want to do specifics like this, but meanwhile don't you think this makes more sense as an optional argument to the impact method rather than a new method?

@anhquan291
Copy link
Author

anhquan291 commented Feb 26, 2025

Thank you for this PR! I've been thinking about potentially exposing generators as a hybrid object instead for people that want to do specifics like this, but meanwhile don't you think this makes more sense as an optional argument to the impact method rather than a new method?

Hi @oblador, you're absolutely right - using an optional intensity parameter in the existing impact method makes more sense than creating a separate method. I'll create a PR with this approach.

I'm also interested in your idea about exposing generators as hybrid objects. I would love to dive deep into this when I find time!

@rklf
Copy link

rklf commented Aug 7, 2025

Thanks for this @anhquan291 ! Can you have a look @anhquan291 please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants