forked from aparoksha/adwaita-swift
Fix modifier wrapper overwriting previous state
This commit is contained in:
parent
a851dbc1cd
commit
de2379a1bf
@ -45,7 +45,8 @@ struct ModifierWrapper: AdwaitaWidget {
|
|||||||
/// - type: The view render data type.
|
/// - type: The view render data type.
|
||||||
/// - Returns: The view storage.
|
/// - Returns: The view storage.
|
||||||
func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
func container<Data>(data: WidgetData, type: Data.Type) -> ViewStorage where Data: ViewRenderData {
|
||||||
let storage = content.storage(data: data, type: type)
|
let content = content.storage(data: data, type: type)
|
||||||
|
let storage = ViewStorage(content.pointer, content: [.mainContent: [content]])
|
||||||
update(storage, data: data, updateProperties: true, type: type)
|
update(storage, data: data, updateProperties: true, type: type)
|
||||||
return storage
|
return storage
|
||||||
}
|
}
|
||||||
@ -62,7 +63,9 @@ struct ModifierWrapper: AdwaitaWidget {
|
|||||||
updateProperties: Bool,
|
updateProperties: Bool,
|
||||||
type: Data.Type
|
type: Data.Type
|
||||||
) where Data: ViewRenderData {
|
) where Data: ViewRenderData {
|
||||||
content.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
|
if let storage = storage.content[.mainContent]?.first {
|
||||||
|
content.updateStorage(storage, data: data, updateProperties: updateProperties, type: type)
|
||||||
|
}
|
||||||
guard updateProperties else {
|
guard updateProperties else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user