์๋ ํ์ธ์ ์ฌ๋ฌ๋ถ,
์ํ ๊ฐ์ฒด์ ๋ณ๊ฒฝ์์ ์ด๋ฏธ์ง ์์ค๋ฅผ ๋ณ๊ฒฝํ๋ ค๊ณ ํ์ง๋ง ๋ณ๊ฒฝ๋์ง ์๋ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
๊ฐ์ ๊ธฐ๋กํ๋๋ฐ ๋ณ๊ฒฝ๋์ง๋ง ์ด๋ฏธ์ง๋ ๋ณ๊ฒฝ๋์ง ์์ต๋๋ค.
๋ค์์ ์ฌ์ฉํ๋ ์ฝ๋์ ๋๋ค.
render() {
var images = {
playcircle: require('image!playcircle'),
pausecircle: require('image!pausecircle')
}
return (
<View style={[styles.container, {width: this.props.width - 10}]}>
<TouchableOpacity onPress={this._playAudio.bind(this)}>
<Image source={images[this.state.playImage]} style={styles.img} />
</TouchableOpacity>
<View style={styles.textWrapper}>
<Text style={styles.txt}>{this.props.podTitle}</Text>
</View>
</View>
);
}
_playAudio() {
var blockThis = this;
debugger;
if (!this.state.isPlaying) {
JSAudioPlayer.play(this.props.url, true, function(error){
if (error) {
alert(error);
} else {
blockThis.setState({
isPlaying: true,
playImage: 'pausecircle'
})
}
});
} else {
JSAudioPlayer.pauseCurrent();
blockThis.setState({
isPlaying: false,
playImage: 'playcircle'
});
}
}
๋์์ ์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค.
๋ฏธ๋ฆฌ ๊ฐ์ฌ๋๋ฆฝ๋๋ค
@josev55
์ผ๋ง ์ ์ ๋น์ทํ ๊ฒ์ ์ป์์ต๋๋ค. <Image key={images[this.state.playImage].uri} ... />
์ ๊ฐ์ ์ด๋ฏธ์ง ํ๊ทธ์ ํค ์์ฑ์ ์ถ๊ฐํด ๋ณด์ธ์. ์ด๊ฒ์ https://github.com/facebook/react-native/issues/3471 ์ ๊ฒฝ์ฐ ์ ์๊ฒ ํจ๊ณผ์ ์ด์์ต๋๋ค.
@facebook-github-bot ์คํ ์ค๋ฒํ๋ก
์๋ ํ์ธ์ @josev55 ์ ๋๋ค. ๊ฒ์ํด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค! @cosmith ๋ ์ด ๋ฌธ์ ๊ฐ StackOverflow ์์ ๊ฐ์ฅ ์ ๋ฌผ์ด๋ณผ ์ ์๋ ์ง๋ฌธ์ฒ๋ผ ๋ณด์ธ๋ค๊ณ ๋งํฉ๋๋ค. StackOverflow๋ Q&A์ ํ์ํฉ๋๋ค. ํํ ์์คํ , ํฌํ, ์ง๋ฌธ์ ๋ต๋ณ์ผ๋ก ํ์ํ๋ ๊ธฐ๋ฅ์ด ์์ต๋๋ค. ํํ ์์คํ ๋๋ฌธ์ ์ปค๋ฎค๋ํฐ์์ ๊ทํ์ ์ง๋ฌธ์ ๋ณด๊ณ ๋ต๋ณํ ๊ฐ๋ฅ์ฑ์ด ๋์ต๋๋ค. ์ด๊ฒ์ ๋ํ ๋ฒ๊ทธ์ ๋ํด์๋ง GitHub ๋ฒ๊ทธ ์ถ์ ๊ธฐ๋ฅผ ์ฌ์ฉํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค. ์ด๊ฒ์ ์ค์ ๋ก SO์ ๋ํด ๋ฌผ์ด๋ด์ผ ํ๋ ์ง๋ฌธ์ด๋ฏ๋ก ๋ซ์ต๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ผ๋ง ์ ์ ๋น์ทํ ๊ฒ์ ์ป์์ต๋๋ค.
<Image key={images[this.state.playImage].uri} ... />
์ ๊ฐ์ ์ด๋ฏธ์ง ํ๊ทธ์ ํค ์์ฑ์ ์ถ๊ฐํด ๋ณด์ธ์. ์ด๊ฒ์ https://github.com/facebook/react-native/issues/3471 ์ ๊ฒฝ์ฐ ์ ์๊ฒ ํจ๊ณผ์ ์ด์์ต๋๋ค.