I use https://github.com/zmxv/react-native-sound to play sounds in my iOS (and Android) application and I try to include sound files through the React Native asset system, but when I call:
var sound = require('./sound.mp3');
I get an error message:
Unable to resolve module. /sound.mp3 from [project] /index.ios.js: Invalid [project] /sound.mp3 directory
I have an MP3 file in the correct (root) directory of my project, the same path to the file that the error prints. I tried putting it in other directories.
According to this stream , it looks like the sound files can also be packed using the require () function?
Just run the test, requiring the image to work fine: var image = require('./image.png');
source share