Open josephmannis opened 3 years ago
Yes, the problem still persists and this turns the package unusable for many situations, which is unfortunate given its quality... I hope that this can get fixed!
@josephmannis @miguel-arrf
It's related to the id supplied into ACarousel
. Try using just strings your items and make id: \.self
and it should work
e.g
ACarousel(["1","2","3","4"], id: \.self, index: $currIndex,...){ ... }
e.g with struct
struct Item: Identifiable, Hashable {
let id = UUID()
let name: String
}
ACarousel([Item(name:"t"), Item(name:"e"), Item(name:"s"), Item(name:"t")], id: \.name, index: $currIndex,...){ ... }
For some reason, I haven't figured out yet using id: \.self
doesn't work even though the struct conforms to Identifiable
@josephmannis @miguel-arrf It's related to the id supplied into
ACarousel
. Try using just strings your items and makeid: \.self
and it should worke.g
ACarousel(["1","2","3","4"], id: \.self, index: $currIndex,...){ ... }
e.g with struct
struct Item: Identifiable, Hashable { let id = UUID() let name: String } ACarousel([Item(name:"t"), Item(name:"e"), Item(name:"s"), Item(name:"t")], id: \.name, index: $currIndex,...){ ... }
For some reason, I haven't figured out yet using
id: \.self
doesn't work even though the struct conforms to Identifiable
Using your code I get
ForEach<Array<Item>, Int, ModifiedContent<ModifiedContent<ModifiedContent<ZStack<TupleView<(ModifiedContent<_ShapeView<RoundedRectangle, Color>, _AppearanceActionModifier>, ModifiedContent<Text, _PaddingLayout>)>>, _FrameLayout>, _FrameLayout>, _ScaleEffect>>: the ID 7 occurs multiple times within the collection, this will give undefined results! ForEach<Array<Item>, Int, ModifiedContent<ModifiedContent<ModifiedContent<ZStack<TupleView<(ModifiedContent<_ShapeView<RoundedRectangle, Color>, _AppearanceActionModifier>, ModifiedContent<Text, _PaddingLayout>)>>, _FrameLayout>, _FrameLayout>, _ScaleEffect>>: the ID 0 occurs multiple times within the collection, this will give undefined results!
in the console, is this ok? I guess that's how wrap works in this library?
Example:
In this case, the animations will not occur properly. Demo:
https://drive.google.com/file/d/1asAYFM6B3ZREpgqhD4Kr3behYqe2bsy9/view?usp=sharing