我想在一些事件有關的動態變化值陣營本土:如何改變<Text>值動態
事件:
BackgroundGeolocation.on('location', (location) => {
currentDistance = distance(previousLatitude,previousLongitude,latitude,longitude);
this.setState({
text: currentDistance
});
});
<Text>
Moving : {this.state.text}
</Text>
沒有人知道如何改變文本或任何其他方法來實現呢?
你到底想改變什麼?什麼事件? – Tikkes
'this.setState({text:'Another Text'})'http://facebook.github.io/react-native/releases/0.38/docs/state.html – Cherniv
我想更新在我的位置計算的距離事件 我有問題 更新,但它給我的錯誤稱爲: 不確定是不是一個函數(評估「this.setState({文字:currentDistance})」) –