13f7d35e1STomasz Sapeta // Copyright 2021-present 650 Industries. All rights reserved.
23f7d35e1STomasz Sapeta 
33f7d35e1STomasz Sapeta import CoreGraphics
43f7d35e1STomasz Sapeta import ExpoModulesCore
53f7d35e1STomasz Sapeta 
63f7d35e1STomasz Sapeta public class LinearGradientModule: Module {
definitionnull73f7d35e1STomasz Sapeta   public func definition() -> ModuleDefinition {
82c5ab579STomasz Sapeta     Name("ExpoLinearGradient")
93f7d35e1STomasz Sapeta 
10*229dd616SŁukasz Kosmaty     View(LinearGradientView.self) {
112c5ab579STomasz Sapeta       Prop("colors") { (view: LinearGradientView, colors: [CGColor]) in
123f7d35e1STomasz Sapeta         view.gradientLayer.setColors(colors)
133f7d35e1STomasz Sapeta       }
143f7d35e1STomasz Sapeta 
152c5ab579STomasz Sapeta       Prop("startPoint") { (view: LinearGradientView, startPoint: CGPoint?) in
163f7d35e1STomasz Sapeta         view.gradientLayer.setStartPoint(startPoint)
173f7d35e1STomasz Sapeta       }
183f7d35e1STomasz Sapeta 
192c5ab579STomasz Sapeta       Prop("endPoint") { (view: LinearGradientView, endPoint: CGPoint?) in
203f7d35e1STomasz Sapeta         view.gradientLayer.setEndPoint(endPoint)
213f7d35e1STomasz Sapeta       }
223f7d35e1STomasz Sapeta 
232c5ab579STomasz Sapeta       Prop("locations") { (view: LinearGradientView, locations: [CGFloat]?) in
243f7d35e1STomasz Sapeta         view.gradientLayer.setLocations(locations)
253f7d35e1STomasz Sapeta       }
263f7d35e1STomasz Sapeta     }
273f7d35e1STomasz Sapeta   }
283f7d35e1STomasz Sapeta }
29