简体   繁体   English

如何使用 React-Native 播放原生 ios 键盘触摸声音?

[英]How can I play a native ios Keyboard Touch sound with React-Native?

The Question问题

I have a custom keyboard set up (it's a score tracker for a dart game app).我设置了一个自定义键盘(它是 dart 游戏应用程序的分数跟踪器)。 What I'm missing is how can I play the iOS sounds like when you write a message in iMessages for example?我缺少的是如何播放 iOS 听起来就像你在 iMessages 中写消息时一样?

I could not find any help for this question what so ever.我无法为这个问题找到任何帮助。 Not in the docs.不在文档中。

Do I really have to use this "early alpha" package "react-native-sounds" => Download this touch sound somewhere and play that sound onPress?我真的必须使用这个“早期 alpha”package“react-native-sounds”=> 在某处下载这个触摸声音并在按下时播放那个声音吗? Does react-native not provide this, or am I missing something? react-native不提供这个,还是我遗漏了什么?

You are correct, react native doesn't provide such feature out of the box.你是对的,React Native 没有提供这种开箱即用的功能。 You'll have to use react-native-sound or react-native-audio-toolkit .您必须使用react-native-soundreact-native-audio-toolkit I would go with the first one, it should do just fine for your use case我会用第一个 go ,它应该适合您的用例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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