I get Cannot read property 'callToPrayer' of undefined
import { adhaan } from './assets/audio.js'
export default class JustPrayClient extends Component {
constructor (props) {
super(props)
// this.props = props
this.playSound.bind(this)
}
playSound () {
// console.log(this.props.test)
this.props.callToPrayer.play() //why is props undefined here?
}
render () {
return (
<View style={styles.container}>
<Text onPress={this.playSound} style={styles.welcome}>
Welcome to React Native! {this.props.test}
</Text>
</View>
)
}
}
const Main = () => <JustPrayClient callToPrayer={adhaan} test='hello' />
Does this have something to do with the this context?
If so, I don't know where/how I should bind this...