简体   繁体   中英

React Native - how to disable touchable opacity voice

i'm trying to create an app and i'm using touchable opacity instead of button. i just wanna disable voice that on press touchable opacity component.

<TouchableOpacity activeOpacity={1} touchSoundDisabled={true} onPress={this._onPress}>
    ...
</TouchableOpacity>

i tried to touchSoundDisabled={true} but not working

I'm not sure which version of react native are you using, but I'm guessing what you are looking for is android_disableSound prop rather than touchSoundDisabled

You can use Pressable in place of TouchableOpacity,

Just add <Pressable android_disableSound={true} ></Pressable>

one drawback is you cant get onTouch animations, but pressable is powerful

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM