如何获取系统 ringtones/sounds

How to get System ringtones/sounds

如何在 React Native 中获取系统铃声或存储列表 ringtones/sounds,例如铃声、通知音,以便我可以让用户选择将它们设置为通知音?

我搜索了一些图书馆,但没有用

如果您正在使用 Android,则可以使用此模块。 react-native-ringtone-manager

但它只使用 Android 而不是 ios

用法

import RingtoneManager from 'react-native-ringtone-manager';
...
getRings() {
 this.rings =  RingtoneManager.getRingtones(RingtoneManager.TYPE_ALL);
 if(this.rings != null) {this.rings = this.rings.map((data,index) =>{<Text>{data.title}</Text>})};
}

对于 iOS 我尝试了 react-native-notification-sounds npm pacakge .. 但它提供了声音文件夹中的所有声音 .. 所以你得到了一长串声音并且无法过滤哪个是通知或铃声。正在处理这个