Skip to content

Instantly share code, notes, and snippets.

@tsapeta
Created January 8, 2021 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsapeta/74af62f7a76309437f78ef5fceb83e92 to your computer and use it in GitHub Desktop.
Save tsapeta/74af62f7a76309437f78ef5fceb83e92 to your computer and use it in GitHub Desktop.
Example of SwiftUI component for React Native
import SwiftUI
final class RSUIShadow: RSUIView {
func render(props: RSUIProps) -> some View {
let radius = props.cgFloat("radius", 0.0)
let offsetX = props.cgFloat("offsetX", 0.0)
let offsetY = props.cgFloat("offsetY", 0.0)
let color = props.color("color", Color.black)
let opacity = props.double("opacity", 0.33)
return Children(self)
.shadow(
color: color.opacity(opacity),
radius: radius,
x: offsetX,
y: offsetY
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment