diff --git a/.gitignore b/.gitignore
index 949baa1..d390055 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,10 @@
._*
Pods
.DS_Store
+node_modules/
+*.lock
+build/
+*.log
+.gradle/
+local.properties
+_codeql_detected_source_root
diff --git a/NativeChart/NativeChart.podspec b/NativeChart/NativeChart.podspec
index 45c23bd..2db6eb3 100644
--- a/NativeChart/NativeChart.podspec
+++ b/NativeChart/NativeChart.podspec
@@ -13,14 +13,14 @@ Pod::Spec.new do |s|
s.license = "MIT"
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
s.authors = { "Yiheng Quan" => "development.henryquan@gmail.com" }
- s.platforms = { :ios => "9.0" }
+ s.platforms = { :ios => "15.0" }
s.source = { :git => "https://github.com/HenryQuan/native-chart-experiment.git", :tag => "#{s.version}" }
s.source_files = "ios/**/*.{h,m,swift}"
s.requires_arc = true
- s.swift_version = '5.0'
- s.dependency "React"
+ s.swift_version = '6.0'
+ s.dependency "React-Core"
s.dependency "Charts"
end
diff --git a/NativeChart/README.md b/NativeChart/README.md
index a81d63b..1579f59 100644
--- a/NativeChart/README.md
+++ b/NativeChart/README.md
@@ -1,18 +1,26 @@
# Native Chart Experiment
Please use [react-native-charts-wrapper](https://github.com/wuxudong/react-native-charts-wrapper) whenever possible. This is only meant to use with my app, [WoWs Info](https://github.com/HenryQuan/WoWs-Info-Re).
+## Requirements
+
+- React Native 0.80+ (with new architecture support)
+- iOS 15.0+
+- Swift 6.0+
+- Android SDK 24+ (Android 7.0+)
+- Kotlin 2.1+
+
## Getting started
-`$ npm install react-native-native-chart --save`
+`$ npm install native-chart-experiment --save`
-### Mostly automatic installation
+### Automatic installation
-`$ react-native link react-native-native-chart`
+With React Native 0.60+, the module is automatically linked. No manual linking is required.
-This is not needed for React Native 0.60+. **Please create a swift file inside your main IOS project in order to have a bridging header.**
+**For iOS**: Run `pod install` in the `ios` directory after installation.
# API
-Comming soon...
+Coming soon...
# Screenshots
diff --git a/NativeChart/android/build.gradle b/NativeChart/android/build.gradle
deleted file mode 100644
index 29028d4..0000000
--- a/NativeChart/android/build.gradle
+++ /dev/null
@@ -1,125 +0,0 @@
-// android/build.gradle
-
-// based on:
-//
-// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle
-// original location:
-// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle
-//
-// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle
-// original location:
-// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
-
-def DEFAULT_COMPILE_SDK_VERSION = 28
-def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
-def DEFAULT_MIN_SDK_VERSION = 16
-def DEFAULT_TARGET_SDK_VERSION = 28
-
-def safeExtGet(prop, fallback) {
- rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
-}
-
-apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-apply plugin: 'maven'
-
-buildscript {
- ext.kotlin_version = '1.3.61'
- // The Android Gradle plugin is only required when opening the android folder stand-alone.
- // This avoids unnecessary downloads and potential conflicts when the library is included as a
- // module dependency in an application project.
- // ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
- if (project == rootProject) {
- repositories {
- google()
- jcenter()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:3.4.1'
- }
- }
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- }
-}
-
-apply plugin: 'com.android.library'
-apply plugin: 'maven'
-
-android {
- compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
- buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
- defaultConfig {
- minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
- targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
- versionCode 1
- versionName "1.0"
- }
- lintOptions {
- abortOnError false
- }
-}
-
-repositories {
- // ref: https://www.baeldung.com/maven-local-repository
- mavenLocal()
- maven {
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
- url "$rootDir/../node_modules/react-native/android"
- }
- maven {
- // Android JSC is installed from npm
- url "$rootDir/../node_modules/jsc-android/dist"
- }
- google()
- jcenter()
- maven { url "https://jitpack.io" }
-}
-
-dependencies {
- //noinspection GradleDynamicVersion
- implementation 'com.facebook.react:react-native:+'
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" // From node_modules
- implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
-}
-
-afterEvaluate { project ->
- // some Gradle build hooks ref:
- // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
- task androidJavadoc(type: Javadoc) {
- source = android.sourceSets.main.java.srcDirs
- classpath += files(android.bootClasspath)
- classpath += files(project.getConfigurations().getByName('compile').asList())
- include '**/*.java'
- }
-
- task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
- classifier = 'javadoc'
- from androidJavadoc.destinationDir
- }
-
- task androidSourcesJar(type: Jar) {
- classifier = 'sources'
- from android.sourceSets.main.java.srcDirs
- include '**/*.java'
- }
-
- android.libraryVariants.all { variant ->
- def name = variant.name.capitalize()
- def javaCompileTask = variant.javaCompileProvider.get()
-
- task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
- from javaCompileTask.destinationDir
- }
- }
-
- artifacts {
- archives androidSourcesJar
- archives androidJavadocJar
- }
-
-}
diff --git a/NativeChart/android/build.gradle.kts b/NativeChart/android/build.gradle.kts
new file mode 100644
index 0000000..c930dc8
--- /dev/null
+++ b/NativeChart/android/build.gradle.kts
@@ -0,0 +1,56 @@
+// android/build.gradle.kts
+
+// Modern build configuration for React Native 0.83+
+
+val DEFAULT_COMPILE_SDK_VERSION = 35
+val DEFAULT_MIN_SDK_VERSION = 24
+val DEFAULT_TARGET_SDK_VERSION = 35
+
+fun safeExtGet(prop: String, fallback: Any): Any {
+ return rootProject.extra.takeIf { it.has(prop) }?.get(prop) ?: fallback
+}
+
+plugins {
+ id("com.android.library")
+ id("org.jetbrains.kotlin.android")
+ id("maven-publish")
+}
+
+android {
+ compileSdk = (safeExtGet("compileSdkVersion", DEFAULT_COMPILE_SDK_VERSION) as Int)
+
+ defaultConfig {
+ minSdk = (safeExtGet("minSdkVersion", DEFAULT_MIN_SDK_VERSION) as Int)
+ targetSdk = (safeExtGet("targetSdkVersion", DEFAULT_TARGET_SDK_VERSION) as Int)
+ }
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
+ }
+
+ kotlinOptions {
+ jvmTarget = "17"
+ }
+
+ lint {
+ abortOnError = false
+ }
+
+ namespace = "org.github.henryquan.nativechart"
+}
+
+repositories {
+ mavenLocal()
+ google()
+ mavenCentral()
+ maven {
+ url = uri("https://jitpack.io")
+ }
+}
+
+dependencies {
+ implementation("com.facebook.react:react-android")
+ implementation("org.jetbrains.kotlin:kotlin-stdlib")
+ implementation("com.github.PhilJay:MPAndroidChart:v3.1.0")
+}
diff --git a/NativeChart/android/gradlew b/NativeChart/android/gradlew
old mode 100644
new mode 100755
diff --git a/NativeChart/android/src/main/AndroidManifest.xml b/NativeChart/android/src/main/AndroidManifest.xml
index 6606123..0a0938a 100644
--- a/NativeChart/android/src/main/AndroidManifest.xml
+++ b/NativeChart/android/src/main/AndroidManifest.xml
@@ -1,4 +1,3 @@
-
+
diff --git a/NativeChart/package.json b/NativeChart/package.json
index 7a26d39..5f30eba 100644
--- a/NativeChart/package.json
+++ b/NativeChart/package.json
@@ -22,12 +22,12 @@
"license": "MIT",
"licenseFilename": "LICENSE",
"peerDependencies": {
- "react": "^16.8.1",
- "react-native": ">=0.59.0-rc.0 <1.0.x"
+ "react": "^18.2.0",
+ "react-native": ">=0.80.0"
},
"devDependencies": {
- "react": "^16.8.3",
- "react-native": "^0.59.10"
+ "react": "^18.3.1",
+ "react-native": "^0.80.0"
},
"bugs": {
"url": "https://github.com/HenryQuan/native-chart-experiment/issues"
diff --git a/NativeChartExample/.buckconfig b/NativeChartExample/.buckconfig
deleted file mode 100644
index 934256c..0000000
--- a/NativeChartExample/.buckconfig
+++ /dev/null
@@ -1,6 +0,0 @@
-
-[android]
- target = Google Inc.:Google APIs:23
-
-[maven_repositories]
- central = https://repo1.maven.org/maven2
diff --git a/NativeChartExample/.flowconfig b/NativeChartExample/.flowconfig
deleted file mode 100644
index 4afc766..0000000
--- a/NativeChartExample/.flowconfig
+++ /dev/null
@@ -1,75 +0,0 @@
-[ignore]
-; We fork some components by platform
-.*/*[.]android.js
-
-; Ignore "BUCK" generated dirs
-/\.buckd/
-
-; Ignore polyfills
-node_modules/react-native/Libraries/polyfills/.*
-
-; These should not be required directly
-; require from fbjs/lib instead: require('fbjs/lib/warning')
-node_modules/warning/.*
-
-; Flow doesn't support platforms
-.*/Libraries/Utilities/LoadingView.js
-
-[untyped]
-.*/node_modules/@react-native-community/cli/.*/.*
-
-[include]
-
-[libs]
-node_modules/react-native/Libraries/react-native/react-native-interface.js
-node_modules/react-native/flow/
-
-[options]
-emoji=true
-
-esproposal.optional_chaining=enable
-esproposal.nullish_coalescing=enable
-
-module.file_ext=.js
-module.file_ext=.json
-module.file_ext=.ios.js
-
-munge_underscores=true
-
-module.name_mapper='^react-native$' -> '/node_modules/react-native/Libraries/react-native/react-native-implementation'
-module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1'
-module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub'
-
-suppress_type=$FlowIssue
-suppress_type=$FlowFixMe
-suppress_type=$FlowFixMeProps
-suppress_type=$FlowFixMeState
-
-suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
-suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
-suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
-
-[lints]
-sketchy-null-number=warn
-sketchy-null-mixed=warn
-sketchy-number=warn
-untyped-type-import=warn
-nonstrict-import=warn
-deprecated-type=warn
-unsafe-getters-setters=warn
-inexact-spread=warn
-unnecessary-invariant=warn
-signature-verification-failure=warn
-deprecated-utility=error
-
-[strict]
-deprecated-type
-nonstrict-import
-sketchy-null
-unclear-type
-unsafe-getters-setters
-untyped-import
-untyped-type-import
-
-[version]
-^0.105.0
diff --git a/NativeChartExample/android/app/build.gradle b/NativeChartExample/android/app/build.gradle
deleted file mode 100644
index 55e940f..0000000
--- a/NativeChartExample/android/app/build.gradle
+++ /dev/null
@@ -1,201 +0,0 @@
-apply plugin: "com.android.application"
-
-import com.android.build.OutputFile
-
-/**
- * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
- * and bundleReleaseJsAndAssets).
- * These basically call `react-native bundle` with the correct arguments during the Android build
- * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
- * bundle directly from the development server. Below you can see all the possible configurations
- * and their defaults. If you decide to add a configuration block, make sure to add it before the
- * `apply from: "../../node_modules/react-native/react.gradle"` line.
- *
- * project.ext.react = [
- * // the name of the generated asset file containing your JS bundle
- * bundleAssetName: "index.android.bundle",
- *
- * // the entry file for bundle generation
- * entryFile: "index.android.js",
- *
- * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
- * bundleCommand: "ram-bundle",
- *
- * // whether to bundle JS and assets in debug mode
- * bundleInDebug: false,
- *
- * // whether to bundle JS and assets in release mode
- * bundleInRelease: true,
- *
- * // whether to bundle JS and assets in another build variant (if configured).
- * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
- * // The configuration property can be in the following formats
- * // 'bundleIn${productFlavor}${buildType}'
- * // 'bundleIn${buildType}'
- * // bundleInFreeDebug: true,
- * // bundleInPaidRelease: true,
- * // bundleInBeta: true,
- *
- * // whether to disable dev mode in custom build variants (by default only disabled in release)
- * // for example: to disable dev mode in the staging build type (if configured)
- * devDisabledInStaging: true,
- * // The configuration property can be in the following formats
- * // 'devDisabledIn${productFlavor}${buildType}'
- * // 'devDisabledIn${buildType}'
- *
- * // the root of your project, i.e. where "package.json" lives
- * root: "../../",
- *
- * // where to put the JS bundle asset in debug mode
- * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
- *
- * // where to put the JS bundle asset in release mode
- * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
- *
- * // where to put drawable resources / React Native assets, e.g. the ones you use via
- * // require('./image.png')), in debug mode
- * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
- *
- * // where to put drawable resources / React Native assets, e.g. the ones you use via
- * // require('./image.png')), in release mode
- * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
- *
- * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
- * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
- * // date; if you have any other folders that you want to ignore for performance reasons (gradle
- * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
- * // for example, you might want to remove it from here.
- * inputExcludes: ["android/**", "ios/**"],
- *
- * // override which node gets called and with what additional arguments
- * nodeExecutableAndArgs: ["node"],
- *
- * // supply additional arguments to the packager
- * extraPackagerArgs: []
- * ]
- */
-
-project.ext.react = [
- entryFile: "index.js",
- enableHermes: false, // clean and rebuild if changing
-]
-
-apply from: "../../node_modules/react-native/react.gradle"
-
-/**
- * Set this to true to create two separate APKs instead of one:
- * - An APK that only works on ARM devices
- * - An APK that only works on x86 devices
- * The advantage is the size of the APK is reduced by about 4MB.
- * Upload all the APKs to the Play Store and people will download
- * the correct one based on the CPU architecture of their device.
- */
-def enableSeparateBuildPerCPUArchitecture = false
-
-/**
- * Run Proguard to shrink the Java bytecode in release builds.
- */
-def enableProguardInReleaseBuilds = false
-
-/**
- * The preferred build flavor of JavaScriptCore.
- *
- * For example, to use the international variant, you can use:
- * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
- *
- * The international variant includes ICU i18n library and necessary data
- * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
- * give correct results when using with locales other than en-US. Note that
- * this variant is about 6MiB larger per architecture than default.
- */
-def jscFlavor = 'org.webkit:android-jsc:+'
-
-/**
- * Whether to enable the Hermes VM.
- *
- * This should be set on project.ext.react and mirrored here. If it is not set
- * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
- * and the benefits of using Hermes will therefore be sharply reduced.
- */
-def enableHermes = project.ext.react.get("enableHermes", false);
-
-android {
- compileSdkVersion rootProject.ext.compileSdkVersion
-
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-
- defaultConfig {
- applicationId "com.nativechartexample"
- minSdkVersion rootProject.ext.minSdkVersion
- targetSdkVersion rootProject.ext.targetSdkVersion
- versionCode 1
- versionName "1.0"
- }
- splits {
- abi {
- reset()
- enable enableSeparateBuildPerCPUArchitecture
- universalApk false // If true, also generate a universal APK
- include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
- }
- }
- signingConfigs {
- debug {
- storeFile file('debug.keystore')
- storePassword 'android'
- keyAlias 'androiddebugkey'
- keyPassword 'android'
- }
- }
- buildTypes {
- debug {
- signingConfig signingConfigs.debug
- }
- release {
- // Caution! In production, you need to generate your own keystore file.
- // see https://facebook.github.io/react-native/docs/signed-apk-android.
- signingConfig signingConfigs.debug
- minifyEnabled enableProguardInReleaseBuilds
- proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
- }
- }
- // applicationVariants are e.g. debug, release
- applicationVariants.all { variant ->
- variant.outputs.each { output ->
- // For each separate APK per architecture, set a unique version code as described here:
- // https://developer.android.com/studio/build/configure-apk-splits.html
- def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
- def abi = output.getFilter(OutputFile.ABI)
- if (abi != null) { // null for the universal-debug, universal-release variants
- output.versionCodeOverride =
- versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
- }
-
- }
- }
-}
-
-dependencies {
- implementation fileTree(dir: "libs", include: ["*.jar"])
- implementation "com.facebook.react:react-native:+" // From node_modules
-
- if (enableHermes) {
- def hermesPath = "../../node_modules/hermes-engine/android/";
- debugImplementation files(hermesPath + "hermes-debug.aar")
- releaseImplementation files(hermesPath + "hermes-release.aar")
- } else {
- implementation jscFlavor
- }
-}
-
-// Run this once to be able to run the application with BUCK
-// puts all compile dependencies into folder libs for BUCK to use
-task copyDownloadableDepsToLibs(type: Copy) {
- from configurations.compile
- into 'libs'
-}
-
-apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
diff --git a/NativeChartExample/android/app/build.gradle.kts b/NativeChartExample/android/app/build.gradle.kts
new file mode 100644
index 0000000..1b53d49
--- /dev/null
+++ b/NativeChartExample/android/app/build.gradle.kts
@@ -0,0 +1,96 @@
+plugins {
+ id("com.android.application")
+ id("org.jetbrains.kotlin.android")
+}
+
+/**
+ * React Native configuration
+ */
+apply(from = "../../node_modules/react-native/react.gradle")
+
+/**
+ * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
+ */
+val enableProguardInReleaseBuilds = false
+
+/**
+ * The preferred build flavor of JavaScriptCore (JSC)
+ *
+ * For example, to use the international variant, you can use:
+ * `val jscFlavor = "org.webkit:android-jsc-intl:+"`
+ *
+ * The international variant includes ICU i18n library and necessary data
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
+ * give correct results when using with locales other than en-US. Note that
+ * this variant is about 6MiB larger per architecture than default.
+ */
+val jscFlavor = "org.webkit:android-jsc:+"
+
+android {
+ compileSdk = 35
+ namespace = "com.nativechartexample"
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
+ }
+
+ kotlinOptions {
+ jvmTarget = "17"
+ }
+
+ buildFeatures {
+ buildConfig = true
+ }
+
+ defaultConfig {
+ applicationId = "com.nativechartexample"
+ minSdk = 24
+ targetSdk = 35
+ versionCode = 1
+ versionName = "1.0"
+
+ buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", "false")
+ buildConfigField("boolean", "IS_HERMES_ENABLED", "true")
+ }
+
+ signingConfigs {
+ getByName("debug") {
+ storeFile = file("debug.keystore")
+ storePassword = "android"
+ keyAlias = "androiddebugkey"
+ keyPassword = "android"
+ }
+ }
+
+ buildTypes {
+ debug {
+ signingConfig = signingConfigs.getByName("debug")
+ }
+ release {
+ // Caution! In production, you need to generate your own keystore file.
+ // see https://reactnative.dev/docs/signed-apk-android.
+ signingConfig = signingConfigs.getByName("debug")
+ isMinifyEnabled = enableProguardInReleaseBuilds
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
+ )
+ }
+ }
+}
+
+dependencies {
+ implementation("com.facebook.react:react-android")
+ implementation("com.facebook.react:hermes-android")
+
+ debugImplementation("com.facebook.flipper:flipper:0.258.0")
+ debugImplementation("com.facebook.flipper:flipper-network-plugin:0.258.0") {
+ exclude(group = "com.squareup.okhttp3", module = "okhttp")
+ }
+ debugImplementation("com.facebook.flipper:flipper-fresco-plugin:0.258.0")
+}
+
+apply(from = file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"))
+val applyNativeModulesAppBuildGradle: groovy.lang.Closure by extra
+applyNativeModulesAppBuildGradle(project)
diff --git a/NativeChartExample/android/app/src/main/AndroidManifest.xml b/NativeChartExample/android/app/src/main/AndroidManifest.xml
index 8b84412..17f7358 100644
--- a/NativeChartExample/android/app/src/main/AndroidManifest.xml
+++ b/NativeChartExample/android/app/src/main/AndroidManifest.xml
@@ -1,5 +1,4 @@
-
+
@@ -13,14 +12,14 @@
+ android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
+ android:windowSoftInputMode="adjustResize"
+ android:exported="true">
-
diff --git a/NativeChartExample/android/app/src/main/java/com/nativechartexample/MainApplication.java b/NativeChartExample/android/app/src/main/java/com/nativechartexample/MainApplication.java
index 590d065..2474f61 100644
--- a/NativeChartExample/android/app/src/main/java/com/nativechartexample/MainApplication.java
+++ b/NativeChartExample/android/app/src/main/java/com/nativechartexample/MainApplication.java
@@ -1,19 +1,19 @@
package com.nativechartexample;
import android.app.Application;
-import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
+import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
+import com.facebook.react.defaults.DefaultReactNativeHost;
import com.facebook.soloader.SoLoader;
-import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
- new ReactNativeHost(this) {
+ new DefaultReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
@@ -32,6 +32,16 @@ protected List getPackages() {
protected String getJSMainModuleName() {
return "index";
}
+
+ @Override
+ protected boolean isNewArchEnabled() {
+ return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
+ }
+
+ @Override
+ protected Boolean isHermesEnabled() {
+ return BuildConfig.IS_HERMES_ENABLED;
+ }
};
@Override
@@ -42,33 +52,10 @@ public ReactNativeHost getReactNativeHost() {
@Override
public void onCreate() {
super.onCreate();
- SoLoader.init(this, /* native exopackage */ false);
- initializeFlipper(this); // Remove this line if you don't want Flipper enabled
- }
-
- /**
- * Loads Flipper in React Native templates.
- *
- * @param context
- */
- private static void initializeFlipper(Context context) {
- if (BuildConfig.DEBUG) {
- try {
- /*
- We use reflection here to pick up the class that initializes Flipper,
- since Flipper library is not available in release mode
- */
- Class> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
- aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- }
+ SoLoader.init(this, false);
+ 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();
}
}
}
diff --git a/NativeChartExample/android/build.gradle b/NativeChartExample/android/build.gradle
deleted file mode 100644
index 28f7ec6..0000000
--- a/NativeChartExample/android/build.gradle
+++ /dev/null
@@ -1,38 +0,0 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-
-buildscript {
- ext {
- buildToolsVersion = "28.0.3"
- minSdkVersion = 16
- compileSdkVersion = 28
- targetSdkVersion = 28
- }
- repositories {
- google()
- jcenter()
- }
- dependencies {
- classpath("com.android.tools.build:gradle:3.4.2")
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
-}
-
-allprojects {
- repositories {
- mavenLocal()
- maven {
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
- url("$rootDir/../node_modules/react-native/android")
- }
- maven {
- // Android JSC is installed from npm
- url("$rootDir/../node_modules/jsc-android/dist")
- }
-
- google()
- jcenter()
- maven { url 'https://jitpack.io' }
- }
-}
diff --git a/NativeChartExample/android/build.gradle.kts b/NativeChartExample/android/build.gradle.kts
new file mode 100644
index 0000000..5439e6b
--- /dev/null
+++ b/NativeChartExample/android/build.gradle.kts
@@ -0,0 +1,32 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ val kotlinVersion = "2.1.0"
+
+ repositories {
+ google()
+ mavenCentral()
+ }
+ dependencies {
+ classpath("com.android.tools.build:gradle:8.7.3")
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
+ }
+}
+
+allprojects {
+ repositories {
+ mavenLocal()
+ maven {
+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
+ url = uri("${rootProject.projectDir}/../node_modules/react-native/android")
+ }
+ maven {
+ // Android JSC is installed from npm
+ url = uri("${rootProject.projectDir}/../node_modules/jsc-android/dist")
+ }
+
+ google()
+ mavenCentral()
+ maven { url = uri("https://jitpack.io") }
+ }
+}
diff --git a/NativeChartExample/android/gradle.properties b/NativeChartExample/android/gradle.properties
index 027ef9d..0d34afa 100644
--- a/NativeChartExample/android/gradle.properties
+++ b/NativeChartExample/android/gradle.properties
@@ -9,13 +9,21 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# 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
+org.gradle.parallel=true
+
+# Enable configuration cache
+org.gradle.configuration-cache=true
+
+# Enable new DSL
+android.defaults.buildfeatures.buildconfig=true
android.useAndroidX=true
-android.enableJetifier=true
+android.enableJetifier=false
+
+# Use this property to enable or disable the Kotlin compiler's IR backend
+kotlin.code.style=official
diff --git a/NativeChartExample/android/gradle/wrapper/gradle-wrapper.properties b/NativeChartExample/android/gradle/wrapper/gradle-wrapper.properties
index e0c4de3..1158199 100644
--- a/NativeChartExample/android/gradle/wrapper/gradle-wrapper.properties
+++ b/NativeChartExample/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/NativeChartExample/android/settings.gradle b/NativeChartExample/android/settings.gradle
deleted file mode 100644
index 87a80bc..0000000
--- a/NativeChartExample/android/settings.gradle
+++ /dev/null
@@ -1,3 +0,0 @@
-rootProject.name = 'NativeChartExample'
-apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
-include ':app'
diff --git a/NativeChartExample/android/settings.gradle.kts b/NativeChartExample/android/settings.gradle.kts
new file mode 100644
index 0000000..035de08
--- /dev/null
+++ b/NativeChartExample/android/settings.gradle.kts
@@ -0,0 +1,5 @@
+rootProject.name = "NativeChartExample"
+apply(from = file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"))
+val applyNativeModulesSettingsGradle: groovy.lang.Closure by extra
+applyNativeModulesSettingsGradle(settings)
+include(":app")
diff --git a/NativeChartExample/babel.config.js b/NativeChartExample/babel.config.js
index f842b77..f7b3da3 100644
--- a/NativeChartExample/babel.config.js
+++ b/NativeChartExample/babel.config.js
@@ -1,3 +1,3 @@
module.exports = {
- presets: ['module:metro-react-native-babel-preset'],
+ presets: ['module:@react-native/babel-preset'],
};
diff --git a/NativeChartExample/ios/NativeChartExample/AppDelegate.h b/NativeChartExample/ios/NativeChartExample/AppDelegate.h
index 2726d5e..5d28082 100644
--- a/NativeChartExample/ios/NativeChartExample/AppDelegate.h
+++ b/NativeChartExample/ios/NativeChartExample/AppDelegate.h
@@ -1,15 +1,6 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-#import
+#import
#import
-@interface AppDelegate : UIResponder
-
-@property (nonatomic, strong) UIWindow *window;
+@interface AppDelegate : RCTAppDelegate
@end
diff --git a/NativeChartExample/ios/NativeChartExample/AppDelegate.m b/NativeChartExample/ios/NativeChartExample/AppDelegate.m
index a237a6e..85289b6 100644
--- a/NativeChartExample/ios/NativeChartExample/AppDelegate.m
+++ b/NativeChartExample/ios/NativeChartExample/AppDelegate.m
@@ -1,39 +1,28 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
#import "AppDelegate.h"
-#import
#import
-#import
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
- RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
- RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
- moduleName:@"NativeChartExample"
- initialProperties:nil];
-
- rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
+ self.moduleName = @"NativeChartExample";
+ // You can add your custom initial props in the dictionary below.
+ // They will be passed down to the ViewController used by React Native.
+ self.initialProps = @{};
- self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- UIViewController *rootViewController = [UIViewController new];
- rootViewController.view = rootView;
- self.window.rootViewController = rootViewController;
- [self.window makeKeyAndVisible];
- return YES;
+ return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
+{
+ return [self bundleURL];
+}
+
+- (NSURL *)bundleURL
{
#if DEBUG
- return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
diff --git a/NativeChartExample/ios/Podfile b/NativeChartExample/ios/Podfile
index 0f5681a..c2e7b4f 100644
--- a/NativeChartExample/ios/Podfile
+++ b/NativeChartExample/ios/Podfile
@@ -1,46 +1,34 @@
-platform :ios, '9.0'
+platform :ios, '15.0'
+require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'NativeChartExample' do
- # Pods for NativeChartExample
- pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
- pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
- pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
- pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
- pod 'React', :path => '../node_modules/react-native/'
- pod 'React-Core', :path => '../node_modules/react-native/'
- pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
- pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
- pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
- pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
- pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
- pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
- pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
- pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
- pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
- pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
- pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
- pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
-
- pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
- pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
- pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
- pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
- pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
- pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
- pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
-
- pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
- pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
- pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
+ use_react_native!(
+ :path => '../node_modules/react-native',
+ :hermes_enabled => true,
+ :fabric_enabled => false
+ )
pod 'NativeChart', :path => '../../NativeChart'
+
target 'NativeChartExampleTests' do
- inherit! :search_paths
- # Pods for testing
+ inherit! :complete
end
- use_native_modules!
+ post_install do |installer|
+ react_native_post_install(
+ installer,
+ '../node_modules/react-native',
+ :mac_catalyst_enabled => false
+ )
+
+ installer.pods_project.targets.each do |target|
+ target.build_configurations.each do |config|
+ config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
+ config.build_settings['SWIFT_VERSION'] = '6.0'
+ end
+ end
+ end
end
target 'NativeChartExample-tvOS' do
@@ -48,7 +36,5 @@ target 'NativeChartExample-tvOS' do
target 'NativeChartExample-tvOSTests' do
inherit! :search_paths
- # Pods for testing
end
-
end
diff --git a/NativeChartExample/metro.config.js b/NativeChartExample/metro.config.js
index 13a9642..3fbffee 100644
--- a/NativeChartExample/metro.config.js
+++ b/NativeChartExample/metro.config.js
@@ -1,17 +1,18 @@
/**
* Metro configuration for React Native
- * https://github.com/facebook/react-native
+ * https://reactnative.dev/docs/metro
*
* @format
*/
-module.exports = {
- transformer: {
- getTransformOptions: async () => ({
- transform: {
- experimentalImportSupport: false,
- inlineRequires: false,
- },
- }),
- },
-};
+const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
+
+/**
+ * Metro configuration
+ * https://reactnative.dev/docs/metro
+ *
+ * @type {import('metro-config').MetroConfig}
+ */
+const config = {};
+
+module.exports = mergeConfig(getDefaultConfig(__dirname), config);
diff --git a/NativeChartExample/package.json b/NativeChartExample/package.json
index 07219d9..c478476 100644
--- a/NativeChartExample/package.json
+++ b/NativeChartExample/package.json
@@ -10,21 +10,28 @@
"lint": "eslint ."
},
"dependencies": {
- "react": "16.9.0",
- "react-native": "0.61.5",
+ "react": "18.3.1",
+ "react-native": "0.83.0",
"native-chart-experiment": "file:../NativeChart"
},
"devDependencies": {
- "@babel/core": "^7.8.4",
- "@babel/runtime": "^7.8.4",
- "@react-native-community/eslint-config": "^0.0.7",
- "babel-jest": "^25.1.0",
- "eslint": "^6.8.0",
- "jest": "^25.1.0",
- "metro-react-native-babel-preset": "^0.58.0",
- "react-test-renderer": "16.9.0"
+ "@babel/core": "^7.25.0",
+ "@babel/preset-env": "^7.25.0",
+ "@babel/runtime": "^7.25.0",
+ "@react-native/babel-preset": "^0.83.0",
+ "@react-native/eslint-config": "^0.83.0",
+ "@react-native/metro-config": "^0.83.0",
+ "@react-native/typescript-config": "^0.83.0",
+ "babel-jest": "^29.7.0",
+ "eslint": "^8.57.0",
+ "jest": "^29.7.0",
+ "prettier": "^3.3.0",
+ "react-test-renderer": "18.3.1"
},
"jest": {
"preset": "react-native"
+ },
+ "engines": {
+ "node": ">=18"
}
}