0
今
import React from 'react';
import { View, ListView, StyleSheet, Text } from 'react-native';
import Row from './row'
import TimerMixin from 'react-timer-mixin';
const styles = StyleSheet.create({
container: {
flex: 1,
marginTop: 20,
},
});
class ListViewDemo extends React.Component {
updateState(){
console.log("stae updation")
}
componentDidMount() {
console.log("mount");
//timer.setTimeout(this, this.updateState, 1000);
}
componentWillUnmount() {
console.log("unmount");
//timer.clearTimeout(this);
}
constructor(props) {
super(props);
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
let data = [{
"name": {
"symbol": "Hello",
"tick": 1
}},
{
"name": {
"symbol": "World",
"tick": 0
}}]
this.state = {
dataSource: ds.cloneWithRows(data),
};
}
render() {
return (
<ListView
style={styles.container}
dataSource={this.state.dataSource}
renderRow={(data) => <Row {...data} />}
/>
);
}
}
export default ListViewDemo;
、私はタイマーの内側に1秒ごとにそれを増分することによって、行のティッカーのそれぞれを更新します。私が直面している問題のカップルは、状態を更新し、es6のために動作するmixinライブラリを得ることができる関数をバインドしています。助けてください。
こんにちはRandomGuy、下記のソリューションを試してみましたか?別のコンポーネントの行情報に問題が発生しましたか? –