Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haptic feedback on long press, Fixes: #4649 #4688

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vaibhavs2
Copy link
Contributor

Fixes: #4649

src/webview/handleOutboundEvents.js Outdated Show resolved Hide resolved
flow-typed/npm/expo-haptics_vx.x.x.js Outdated Show resolved Hide resolved
@WesleyAC
Copy link
Contributor

@gnprice wrote in #4649:

On Android there's a specific haptic response that is standard for long-press, and we should be sure to use that. On iOS I'm not sure there's a single standard, but we should use something similar to other iOS apps, as standard as possible -- which empirically means it'll be pretty different from the Android standard. Ideally we can get both at once by using some library made for RN.

This doesn't do that, right? We should consider using a library like react-native-haptic-feedback instead of the expo thing, since that actually supports the long-press specific haptic feedback API.

@vaibhavs2
Copy link
Contributor Author

We should consider using a library like react-native-haptic-feedback

should we favour this "if Haptic is disabled in the Android system settings, allow ignoring the setting and trigger haptic feedback"?

Copy link
Contributor

@WesleyAC WesleyAC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes! Once you remove ignoreAndroidSystemSettings, this should be good to go.

android: 'longPress',
});
ReactNativeHapticFeedback.trigger(hapticTriggerType, {
ignoreAndroidSystemSettings: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't ignore the system settings here.

Copy link
Contributor Author

@vaibhavs2 vaibhavs2 Apr 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we favour this "if Haptic is disabled in the Android system settings, allow ignoring the setting and trigger haptic feedback"?

I asked about that before :)
well, I will remove that, should i remove and push -f or wait for the request that we did on upstream?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead and push with the fix. I don't see a reason to wait on upstream, since the helper function that you wrote gets around the problem.

*/
export const longPressHapticFeedback = () => {
const hapticTriggerType = Platform.select({
ios: 'selection',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI, this is the default that react-native-haptic-feedback will do on iOS if we do longPress — you can see that in the upstream code.

I think it's still reasonable to have this, just so if that changes, we can change this ourselves, but I don't think we really need this, strictly speaking.

Copy link
Contributor Author

@vaibhavs2 vaibhavs2 Apr 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at the next line upstream code there it do not have default for supportsHapticFor6SAnd6SPlus, that's why I explicitly provide the selection type

if we intend not to provide haptics in Iphone 6 then this would definetly of one line implementation.
As this module providing us that feature then Its good to implement

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, cool, that makes sense. Looking at this table, it seems like the 6s/6s Plus support iOS 14, which means we still support them.

It's probably worth filing a upstream bug about that, I'll go do that now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnprice
Copy link
Member

gnprice commented Apr 29, 2021

I posted some questions about this in the chat thread.

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.

Haptic feedback on long press
3 participants