#import "BVLinearGradient.h" #import "RCTConvert.h" #import #import @implementation BVLinearGradient + (Class)layerClass { return [CAGradientLayer class]; } - (CAGradientLayer *)gradientLayer { return (CAGradientLayer *)self.layer; } - (void)setColors:(NSArray *)colorStrings { NSMutableArray *colors = [NSMutableArray arrayWithCapacity:colorStrings.count]; for (NSString *colorString in colorStrings) { [colors addObject:(id)[RCTConvert UIColor:colorString].CGColor]; } self.gradientLayer.colors = colors; } - (void)setStart:(CGPoint)start { self.gradientLayer.startPoint = start; } - (void)setEnd:(CGPoint)end { self.gradientLayer.endPoint = end; } - (void)setLocations:(NSArray *)locations { self.gradientLayer.locations = locations; } @end