In LiveView-Native, I’m trying to dynamically set a SwiftUI modifier based on props from the socket. I’ve tried a few different approaches, but everything fails:
<VStack style={@style}>
where @style = "background(.red)"
< VStack class={@class}>
where @class = "color-red"
< VStack class={"color-#{@color}"}>
where @color = "red"
<VStack style='background(attr("color"))' color={@color} />
where @color=".red"
I’ve seen some dynamic modifier examples in the documentation, but it fails when it pulls the value from the socket.
So, I’m at a loss for what to do when I need to, for example, set a color based on user input.
Any suggestions?