Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ReactNativeART.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/react-native-community/art.git", :tag => "v#{s.version}" }
s.source_files = "ios/**/*.{h,m}"

s.dependency "React"
s.dependency "React-Core"
end
2 changes: 2 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ ReactNativeART_buildToolsVersion=28.0.3
ReactNativeART_targetSdkVersion=27
ReactNativeART_minSdkVersion=16
ReactNativeART_supportLibVersion=28.0.0
android.useAndroidX=true
android.enableJetifier=true
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@

package com.reactnativecommunity.art;

import javax.annotation.Nullable;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Region;

import androidx.annotation.Nullable;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.ReactShadowNodeImpl;

/**
* Shadow node for virtual ARTGroup view
Expand Down Expand Up @@ -53,7 +50,7 @@ public void draw(Canvas canvas, Paint paint, float opacity) {
mClipping.top * mScale,
mClipping.right * mScale,
mClipping.bottom * mScale,
Region.Op.REPLACE);
Region.Op.REPLACE);
}

for (int i = 0; i < getChildCount(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void draw(Canvas canvas, Paint paint, float opacity) {
}

/**
* Sets up {@link #mPaint} according to the props set on a shadow view. Returns {@code true}
* Sets up {@param #paint} according to the props set on a shadow view. Returns {@code true}
* if the stroke should be drawn, {@code false} if not.
*/
protected boolean setupStrokePaint(Paint paint, float opacity) {
Expand Down Expand Up @@ -174,7 +174,7 @@ protected boolean setupStrokePaint(Paint paint, float opacity) {
}

/**
* Sets up {@link #mPaint} according to the props set on a shadow view. Returns {@code true}
* Sets up {@param #paint} according to the props set on a shadow view. Returns {@code true}
* if the fill should be drawn, {@code false} if not.
*/
protected boolean setupFillPaint(Paint paint, float opacity) {
Expand Down
3 changes: 3 additions & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=true

5 changes: 4 additions & 1 deletion ios/ARTNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#import "ARTNode.h"

#import "ARTContainer.h"
#import "RCTConvert+ART.h"

@implementation ARTNode

Expand Down Expand Up @@ -79,7 +80,9 @@ - (void)renderContentTo:(CGContextRef)context {
CGContextSaveGState(context);
CGContextConcatCTM(context, self.transform);
CGContextSetAlpha(context, self.opacity);
CGContextSetShadowWithColor(context, self.shadow.offset, self.shadow.blur, self.shadow.color.CGColor);
UIColor *color = [UIColor colorWithCGColor:[RCTConvert CGColor:@(self.shadow.color)]];
color = [color colorWithAlphaComponent:self.shadow.alpha];
CGContextSetShadowWithColor(context, self.shadow.offset, self.shadow.blur, color.CGColor);
}

- (void)renderLayerTo:(CGContextRef)context
Expand Down
3 changes: 2 additions & 1 deletion ios/ARTShadow.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
typedef struct {
CGSize offset;
CGFloat blur;
UIColor* color;
CGFloat alpha;
CGFloat color;
} ARTShadow;
7 changes: 2 additions & 5 deletions ios/RCTConvert+ART.m
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,9 @@ + (ARTBrush *)ARTBrush:(id)json
+ (ARTShadow)ARTShadow:(id)json
{
NSArray *arr = [self NSArray:json];

UIColor *color = [UIColor colorWithCGColor:[self CGColor:[arr objectAtIndex:0]]];
color = [color colorWithAlphaComponent:[[arr objectAtIndex:1] floatValue]];

return (ARTShadow){
.color = color,
.color = [[arr objectAtIndex:0] doubleValue],
.alpha = [[arr objectAtIndex:1] floatValue],
.blur = [[arr objectAtIndex:2] floatValue],
.offset = (CGSize){
.width = [[arr objectAtIndex:3] floatValue],
Expand Down
Loading