Take a RenderContext in ListState's build item callback

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Nathan Sobo 2022-05-26 18:23:44 -06:00
parent 2ea085b178
commit 8dd82fdce1
4 changed files with 80 additions and 47 deletions

View file

@ -75,9 +75,9 @@ impl ChatPanel {
})
});
let mut message_list = ListState::new(0, Orientation::Bottom, 1000., {
let mut message_list = ListState::new(0, Orientation::Bottom, 1000., cx, {
let this = cx.weak_handle();
move |ix, cx| {
move |_, ix, cx| {
let this = this.upgrade(cx).unwrap().read(cx);
let message = this.active_channel.as_ref().unwrap().0.read(cx).message(ix);
this.render_message(message, cx)