我几乎完成了我的申请,但它仍然是一个主要问题:
当我使用navigator.pop时,我的ListView不会更新。
的ListView
<ListView
enableEmptySections={true}
style={styles.listView}
dataSource={this.state.dataSource}
renderRow={(data) => <Row {...data} navigator={this.props.navigator} />}
renderSeparator={(sectionId, rowId) => <View key={rowId} style={styles.separator} />}
/>
ListBillScreen.js
constructor(props) {
super(props);
var bdd = [];
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
dataSource: ds.cloneWithRows(bdd),
realm: this.props.billsbdd.realm,
db: bdd,
};
}
componentWillUpdate () {
this.setState = {
realm: this.props.billsbdd.realm
}
}
componentDidMount() {
BackHandler.addEventListener('backPress', () =>
this.popIfExists()
);
realms = this.state.realm;
if(realms == ""){
src = [];
}
else{
src = this.state.realm.objects('Bills');
}
this.setState({
dataSource: this.state.dataSource.cloneWithRows(src)
})
}
AddBillScreen.js
handlePressCreate() {
//TODO: Creation of a bill
let realms = this.state.realm;
realms.write(() => {
realms.create('Bills', {
id: uuid.v4(),
type: this.state.billType,
creditor: this.state.billCreditor,
month: this.state.billMonth,
year: this.state.billYear,
price: this.state.billPrice,
})
});
alert("Facture créée ! ");
this.props.navigator.pop();
}
我想,当我按下后退按钮时,我的ListView会使用新数据呈现自己。 我必须每次都返回并重新连接以查看我的ListView更新。 我在stackoverlflow上尝试了一些流行的解决方案,但对我来说都不容易...... 如果有人可以帮助我,那将是你的伟大!谢谢大家!
答案 0 :(得分:0)
我找到了答案!
我需要添加
Sub UnfilterWS()
Dim xWs As Worksheet
For Each Wks In ThisWorkbook.Worksheets
On Error Resume Next
If Wks.AutoFilterMode Then
Wks.AutoFilterMode = False
End If
Next Wks
End Sub
ListBillScreen.js 中的使其正常工作!