Skip to content
Merged
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
34 changes: 10 additions & 24 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
buildscript {
ext.getExtOrDefault = {name ->
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RNRefiner_' + name]
}

ext.getExtOrDefaultWithFallback = {name, fallback ->
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['RNRefiner_' + name] ?: fallback)
}
ext.getExtOrDefault = {name ->
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RNRefiner_' + name]
}

repositories {
maven {
url("$rootDir/../node_modules/react-native/android")
}
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefaultWithFallback('kotlinVersion', '2.0.21')}"
}
ext.getExtOrDefaultWithFallback = {name, fallback ->
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['RNRefiner_' + name] ?: fallback)
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.kotlin.android'

apply plugin: "com.facebook.react"

Expand Down Expand Up @@ -66,7 +52,7 @@ def isNewArchitectureEnabled() {
return false
}

def kotlin_version = getExtOrDefaultWithFallback("kotlinVersion", "2.0.21")
def kotlin_version = getExtOrDefaultWithFallback("kotlinVersion", "2.1.20")

android {
namespace "io.refiner.rn"
Expand Down Expand Up @@ -94,7 +80,7 @@ android {
}
}

lintOptions {
lint {
disable "GradleCompatible"
abortOnError false
}
Expand Down Expand Up @@ -124,9 +110,9 @@ repositories {

dependencies {
implementation "com.facebook.react:react-android:+"
implementation 'io.refiner:refiner:1.7.0'
implementation 'io.refiner:refiner:1.7.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1"
}

react {
Expand Down
4 changes: 2 additions & 2 deletions example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type SectionProps = PropsWithChildren<{
title: string;
}>;

function Section({children, title}: SectionProps): JSX.Element {
function Section({children, title}: SectionProps): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
return (
<View style={styles.sectionContainer}>
Expand All @@ -84,7 +84,7 @@ function Section({children, title}: SectionProps): JSX.Element {
);
}

function App(): JSX.Element {
function App(): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
const [isModuleLoaded, setIsModuleLoaded] = useState(false);

Expand Down
10 changes: 3 additions & 7 deletions example/__tests__/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ import 'react-native';
import React from 'react';
import App from '../App';

// Note: import explicitly to use the types shiped with jest.
import {it} from '@jest/globals';
import {it, expect} from '@jest/globals';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

it('renders correctly', () => {
renderer.create(<App />);
it('App component is defined', () => {
expect(App).toBeDefined();
});
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

/**
Expand Down Expand Up @@ -45,7 +46,6 @@ react {

/* Hermes Commands */
// The hermes compiler command to run. By default it is 'hermesc'
hermesCommand = "../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}

Expand All @@ -57,10 +55,7 @@ public ReactNativeHost getReactNativeHost() {

@Override
public ReactHost getReactHost() {
return DefaultReactHost.getDefaultReactHost(
getApplicationContext(),
getReactNativeHost()
);
return DefaultReactHost.getDefaultReactHost(this, getReactNativeHost(), null);
}

@Override
Expand All @@ -72,8 +67,7 @@ public void onCreate() {
throw new RuntimeException(e);
}
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
DefaultNewArchitectureEntryPoint.load();
}
}
}
}
15 changes: 13 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ buildscript {
buildToolsVersion = "35.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 34
kotlinVersion = "2.0.21"
targetSdkVersion = 35
kotlinVersion = "2.1.20"

ndkVersion = "27.2.12479018"
}
Expand All @@ -21,6 +21,17 @@ buildscript {
}
}

allprojects {
configurations.all {
// RN 0.79 ships Kotlin 2.0.21 but the native SDK requires 2.1.20
resolutionStrategy {
force "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlinVersion}"
force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${rootProject.ext.kotlinVersion}"
force "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${rootProject.ext.kotlinVersion}"
}
}
}

repositories {
google()
}
2 changes: 1 addition & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
android.enableJetifier=false

# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
Expand Down
Loading
Loading