Created
January 8, 2021 11:19
-
-
Save tsapeta/74af62f7a76309437f78ef5fceb83e92 to your computer and use it in GitHub Desktop.
Example of SwiftUI component for React Native
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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