React-native: [Accessibility] Touchable components need "Touch Sounds" for more native feeling.

Created on 27 Feb 2016  路  28Comments  路  Source: facebook/react-native

Hello,

Touchable components must have a native android touch sound for more native feeling.
It feels unnatural to me since there is no tap/touch sound at all.

I did not test it on iOS.

Locked Discussion Enhancement

Most helpful comment

Created a PR. https://github.com/facebook/react-native/pull/6825
I moved the code into the Touchable.Mixin so that other touchable components are affected.
Also added a prop soundEffectsEnabled which defaults to true.

All 28 comments

@christopherdro could you please label this as android.

I was thinking about this myself the other day.
This would be something custom since it's currently not available through React Native.

Going to leave this open for both platforms.

I don't know for iOS, but these touch sounds are default on Android native apps. When you just add a simple Button component, it has touch sounds by default.

And the priority of React Native is the "native feeling". So this feature is a must.

@bcalik - did you try TouchableNativeFeedback?

@jesseruder - are you familiar with how this should work out of the box on Android? I guess it's related to HapticFeedback

@brentvatne Yes I have been using TouchableNativeFeedback in my app.

@bcalik - and does that work as you expect?

@brentvatne No, that's why I am reporting this issue.

@bcalik - OK. If you would like to submit a pull request to fix this, we can discuss there. I created a ProductPains issue to track this, it is the tool that we use to prioritize features from open source, please go ahead and upvote there: https://productpains.com/post/react-native/touchable-components-need-touch-sounds-for-more-native-feeling/

Anyone else interested should also upvote on ProductPains :)

Thanks for the report!

Looks like Android play click sound effect while using OnClickListener, but not for OnTouchListener.
To implement sound effect for OnTouchListener, you have to play it yourself like:

public boolean onTouch(View v, MotionEvent event)
{
    if(event.getAction() == MotionEvent.ACTION_DOWN)
    {
        v.playSoundEffect(SoundEffectConstants.CLICK);
    }
    return true;
}

I hope this may help someone to implement this to React-Native.

I am trying to implement this, but this is my first ReactNative PR. Help would be welcome :)
https://github.com/mikemonteith/react-native/tree/android-click-sounds

I'm adding a new command to UIManager#dispatchViewManagerCommand that plays the click sound when a TouchableNativeFeedback component is pressed.

Reopening this because there seems to be more interest :)

I don't have time to work on this unfortunately, maybe @satya164 or @janicduplessis can help you out @mikemonteith!

@mikemonteith Looks good, you should submit a PR with that and I'll check it out!

Should we make it work for other types of touchables or just this TouchableNative?

Also I double checked and there are no sounds on iOS so we don't have to worry about that.

It also would be better if there is a prop to enable and disable sounds.

Agreed :)

Created a PR. https://github.com/facebook/react-native/pull/6825
I moved the code into the Touchable.Mixin so that other touchable components are affected.
Also added a prop soundEffectsEnabled which defaults to true.

Closing since the linked PR has been closed

@lacker But the issue still exists. So this should stay open until someone fixes the issue.

The PR was not merged because of inactivity, if someone wants to pick it up and do the requested changes it would be great.

I hope this can be implemented soon. It really needs it for that native feel, Android app kinda feels naked without it.

Actually the lack of this sounds is the only way I have to distinguish an native app from a react-native app (which is bad)

This is a feature request that proably belongs on product pains, unless somebody wants to submit a PR for it.

Can somebody tell me any workaround ?

I've added this into ProductPains / Canny

Please upvote to give it more attention:
https://react-native.canny.io/feature-requests/p/touchable-component-sounds-android

Hi all, this "issue" has been resolved? I notice that the PR #6825 has been closed but I don't understand if the code of that PS has been merged or not...

Hey guys, any update on this? Like @bcalik said, this is an absolutely essential feature that seems to be missing. Is there any way to achieve this?

it's been more than 2 years and you guys still haven't added this very simple feature...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vikeri picture vikeri  路  3Comments

josev55 picture josev55  路  3Comments

axelg12 picture axelg12  路  3Comments

oney picture oney  路  3Comments

lazywei picture lazywei  路  3Comments