File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
ios/RNSketchCanvas/RNSketchCanvas Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -74,16 +74,19 @@ - (UIView *)view
7474
7575RCT_EXPORT_METHOD (addPath:(nonnull NSNumber *)reactTag pathId: (int ) pathId strokeColor: (UIColor*) strokeColor strokeWidth: (int ) strokeWidth points: (NSArray *) points)
7676{
77- NSMutableArray *cgPoints = [[NSMutableArray alloc ] initWithCapacity: points.count];
77+ NSMutableArray *cgPoints = [[NSMutableArray alloc ] initWithCapacity: points.count];
78+
7879 for (NSString *coor in points) {
7980 @autoreleasepool {
80- NSArray *coorInNumber = [coor componentsSeparatedByString: @" ," ];
81- [cgPoints addObject: [NSValue valueWithCGPoint: CGPointMake ([coorInNumber[0 ] floatValue ], [coorInNumber[1 ] floatValue ])]];
82- [self runCanvas: reactTag block: ^(RNSketchCanvas *canvas) {
83- [canvas addPath: pathId strokeColor: strokeColor strokeWidth: strokeWidth points: cgPoints];
84- }];
81+ NSArray *coorInNumber = [coor componentsSeparatedByString: @" ," ];
82+ CGPoint point = CGPointMake ([coorInNumber[0 ] floatValue ], [coorInNumber[1 ] floatValue ]);
83+ [cgPoints addObject: [NSValue valueWithCGPoint: point]];
8584 }
8685 }
86+
87+ [self runCanvas: reactTag block: ^(RNSketchCanvas *canvas) {
88+ [canvas addPath: pathId strokeColor: strokeColor strokeWidth: strokeWidth points: cgPoints];
89+ }];
8790}
8891
8992RCT_EXPORT_METHOD (newPath:(nonnull NSNumber *)reactTag pathId: (int ) pathId strokeColor: (UIColor*) strokeColor strokeWidth: (int ) strokeWidth)
You can’t perform that action at this time.
0 commit comments