Skip to content

Commit

Permalink
Add fabric on Android (#402)
Browse files Browse the repository at this point in the history
* Configure build.gradle

* Update libraryName on android

* Create ReactSlider shared implementation

* Split implementations into oldarch and newarch

* Dispatch events

* Cleanup eventDispatcher

* Make oldarch implementation use shared code

* Add defaults to js spec

* Clean up newarch ReactSliderManager

* Reorder props to fix disabled state

* Handle TestID setter

* Move ReactSliderShadowNode to shared implementation

* Share getExportedCustomDirectEventTypeConstants

* Remove comments, add empty line
  • Loading branch information
okwasniewski authored Aug 4, 2022
1 parent 533db3c commit 51bc969
Show file tree
Hide file tree
Showing 7 changed files with 566 additions and 264 deletions.
29 changes: 28 additions & 1 deletion package/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ buildscript {
}
}

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

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

def getExtOrDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeSlider_' + name]
}
Expand All @@ -19,7 +28,6 @@ def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['ReactNativeSlider_' + name]).toInteger()
}

apply plugin: 'com.android.library'

android {
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
Expand All @@ -28,6 +36,17 @@ android {
defaultConfig {
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
}

sourceSets {
main {
if (isNewArchitectureEnabled()) {
java.srcDirs += ['src/newarch']
} else {
java.srcDirs += ['src/oldarch']
}
}
}
}

Expand All @@ -40,3 +59,11 @@ dependencies {
//noinspection GradleDynamicVersion
api 'com.facebook.react:react-native:+'
}

if (isNewArchitectureEnabled()) {
react {
jsRootDir = file("../src")
libraryName = "ReactSlider"
codegenJavaPackageName = "com.reactnativecommunity.slider"
}
}

This file was deleted.

Loading

0 comments on commit 51bc969

Please sign in to comment.