Skip to content

Commit

Permalink
Revert "feat(#162): fabric support (#221)"
Browse files Browse the repository at this point in the history
This reverts commit b5dc9d0.
  • Loading branch information
brentvatne authored Apr 1, 2024
1 parent b5dc9d0 commit bfdf67d
Show file tree
Hide file tree
Showing 33 changed files with 2,360 additions and 3,771 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: '@react-native',
extends: ['@react-native-community'],
};
4 changes: 2 additions & 2 deletions RNCMaskedView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Pod::Spec.new do |s|
s.platforms = { :ios => "9.0", :tvos => "9.0" }

s.source = { :git => "https://github.com/react-native-masked-view/masked-view.git", :tag => "v#{s.version}" }
s.source_files = "ios/**/*.{h,m,mm}"
s.source_files = "ios/**/*.{h,m}"

install_modules_dependencies(s)
s.dependency 'React-Core'
end
20 changes: 4 additions & 16 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@ buildscript {
}
}

def isNewArchitectureEnabled() {
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}

apply plugin: 'com.android.library'
if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}

def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
def shouldUseNameSpace = agpVersion >= 7
Expand All @@ -46,25 +39,20 @@ manifestContent.replaceAll(" ", " ")
manifestOutFile.write(manifestContent)

android {
compileSdkVersion safeExtGet('compileSdkVersion', 33)
compileSdkVersion safeExtGet('compileSdkVersion', 28)

if(shouldUseNameSpace){
namespace = "org.reactnative.maskedview"
}

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 21)
targetSdkVersion safeExtGet('targetSdkVersion', 33)
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
}

sourceSets {
main {
if (isNewArchitectureEnabled()) {
java.srcDirs += ['src/newarch/java', "${project.buildDir}/generated/source/codegen/java"]
} else {
java.srcDirs += ['src/oldarch/java']
}
java.srcDirs = ['src/main/java']
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@
import android.graphics.PorterDuffXfermode;
import android.view.View;

import androidx.annotation.NonNull;

import com.facebook.react.views.view.ReactViewGroup;

public class RNCMaskedView extends ReactViewGroup {
private static final String TAG = "RNCMaskedView";

private Bitmap mBitmapMask = null;
private boolean mBitmapMaskInvalidated = false;
private final Paint mPaint;
private final PorterDuffXfermode mPorterDuffXferMode;
private Paint mPaint;
private PorterDuffXfermode mPorterDuffXferMode;

public RNCMaskedView(Context context) {
super(context);
Expand Down Expand Up @@ -50,7 +48,7 @@ protected void dispatchDraw(Canvas canvas) {
}

@Override
public void onDescendantInvalidated(@NonNull View child, @NonNull View target) {
public void onDescendantInvalidated(View child, View target) {
super.onDescendantInvalidated(child, target);

if (!mBitmapMaskInvalidated) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
package org.reactnative.maskedview;

import androidx.annotation.NonNull;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.Nullable;

import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.uimanager.SimpleViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewManagerDelegate;
import com.facebook.react.uimanager.ViewGroupManager;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.viewmanagers.RNCMaskedViewManagerInterface;
import com.facebook.react.views.view.ReactViewGroup;
import com.facebook.react.views.view.ReactViewManager;

public class RNCMaskedViewManager extends ReactViewManager implements RNCMaskedViewManagerInterface<RNCMaskedView> {
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class RNCMaskedViewManager extends ViewGroupManager<RNCMaskedView> {
private static final String REACT_CLASS = "RNCMaskedView";

@NonNull
@Override
public String getName() {
return REACT_CLASS;
}

@Override
public ViewManagerDelegate<ReactViewGroup> getDelegate() {
// ReactViewManager is not generic, so it doesn't let to pass any view, that extends ReactViewGroup
// However, ReactViewManager does not use any delegate, so we can skip it and handle props here
return null;
}

@NonNull
@Override
public RNCMaskedView createViewInstance(ThemedReactContext themedReactContext) {
protected RNCMaskedView createViewInstance(ThemedReactContext themedReactContext) {
return new RNCMaskedView(themedReactContext);
}

@Override
@ReactProp(name = "androidRenderingMode")
public void setAndroidRenderingMode(RNCMaskedView view, @Nullable String renderingMode) {
if (renderingMode != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,25 @@
package org.reactnative.maskedview;

import androidx.annotation.Nullable;

import com.facebook.react.TurboReactPackage;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.module.model.ReactModuleInfo;
import com.facebook.react.module.model.ReactModuleInfoProvider;
import com.facebook.react.uimanager.ViewManager;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public class RNCMaskedViewPackage extends TurboReactPackage {
@Override
@Nullable
public NativeModule getModule(String name, ReactApplicationContext reactContext) {
return null;
}

public class RNCMaskedViewPackage implements ReactPackage {
@Override
public ReactModuleInfoProvider getReactModuleInfoProvider() {
final Map<String, ReactModuleInfo> reactModuleInfoMap = new HashMap<>();
return new ReactModuleInfoProvider() {
@Override
public Map<String, ReactModuleInfo> getReactModuleInfos() {
return reactModuleInfoMap;
}
};
public List<NativeModule> createNativeModules(ReactApplicationContext reactApplicationContext) {
return Collections.emptyList();
}

@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactApplicationContext) {
return Arrays.<ViewManager>asList(
new RNCMaskedViewManager()
);
return Arrays.<ViewManager>asList(
new RNCMaskedViewManager()
);
}
}

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
.xcode.env
Pods/
build/
dist/*
!dist/.gitignore
dist/
local.properties
msbuild.binlog
node_modules/
23 changes: 3 additions & 20 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
buildscript {
apply(from: {
def searchDir = rootDir.toPath()
do {
def p = searchDir.resolve("node_modules/react-native-test-app/android/dependencies.gradle")
if (p.toFile().exists()) {
return p.toRealPath().toString()
}
} while (searchDir = searchDir.getParent())
throw new GradleException("Could not find `react-native-test-app`");
}())
def androidTestAppDir = "../node_modules/react-native-test-app/android"
apply(from: "${androidTestAppDir}/dependencies.gradle")

repositories {
mavenCentral()
Expand All @@ -26,16 +18,7 @@ allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url({
def searchDir = rootDir.toPath()
do {
def p = searchDir.resolve("node_modules/react-native/android")
if (p.toFile().exists()) {
return p.toRealPath().toString()
}
} while (searchDir = searchDir.getParent())
throw new GradleException("Could not find `react-native`");
}())
url("${rootDir}/../node_modules/react-native/android")
}
mavenCentral()
google()
Expand Down
31 changes: 12 additions & 19 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,20 @@ org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryEr
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Jetifier randomly fails on these libraries
android.jetifier.ignorelist=hermes-android

# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
# ./gradlew <task> -PreactNativeArchitectures=x86_64
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64

# Use this property to enable support to the new architecture.
# This will allow you to use TurboModules and the Fabric render in
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.

# Version of Flipper to use with React Native. Default value is whatever React
# Native defaults to. To disable Flipper, set it to `false`.
#FLIPPER_VERSION=0.182.0

# Enable Fabric at runtime.
#USE_FABRIC=1

# Enable new architecture, i.e. Fabric + TurboModule - implies USE_FABRIC=1.
# Note that this is incompatible with web debugging.
#newArchEnabled=true

# Uncomment the line below to build React Native from source.
#react.buildFromSource=true

# Version of Android NDK to build against.
#ANDROID_NDK_VERSION=26.1.10909125
# Uncomment the line below if building react-native from source
#ANDROID_NDK_VERSION=23.1.7779620

# Version of Kotlin to build against.
#KOTLIN_VERSION=1.8.22
#KOTLIN_VERSION=1.7.22
Binary file modified example/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit bfdf67d

Please sign in to comment.