I’m working on a React Native with version of 0.74.5 versión. Also I’m using react-native-sound library with the version 0.11.2
I pretty much have a blank project. I’m willing to play a mp3 file when pressing a TouchableOpacity component.
I’m receiving the following: ERROR TypeError: Cannot read property 'IsAndroid' of null, js engine: hermes on the console
My current App.tsx file look like this
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'
import Sound from 'react-native-sound'
export default function App() {
Sound.setCategory('Playback')
return (
<View style={styles.container}>
<TouchableOpacity
style={{ backgroundColor: 'lightblue', padding: 10, borderRadius: 10 }}
onPress={() => {
console.log('test')
}}
>
<Text>Test 1 - Sonido</Text>
</TouchableOpacity>
</View>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
})
react-native-sound
seems to be unmaintained, the last update was 3 years ago. I would suggest using other package, you could try these: