├── .gitignore ├── .release-it.json ├── Example ├── .buckconfig ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .prettierrc.js ├── .watchmanconfig ├── App.js ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── build_defs.bzl │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── ReactNativeFlipper.java │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── babel.config.js ├── index.js ├── ios │ ├── AppDelegate.mm │ ├── Example-tvOS │ │ └── Info.plist │ ├── Example-tvOSTests │ │ └── Info.plist │ ├── Example.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── Example-tvOS.xcscheme │ │ │ └── Example.xcscheme │ ├── Example.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Example │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ └── main.m │ ├── ExampleTests │ │ ├── ExampleTests.m │ │ └── Info.plist │ ├── Podfile │ └── Podfile.lock ├── metro.config.js ├── package.json ├── src │ ├── BasicExample │ │ └── index.js │ └── GenericExample │ │ ├── data.js │ │ ├── index.js │ │ └── rawData.js └── yarn.lock ├── README.md ├── commitlint.config.js ├── gifs ├── android.gif ├── basic.png └── ios.gif ├── package.json ├── src ├── charts │ └── linear │ │ ├── ChartDot.js │ │ ├── ChartLabels.js │ │ ├── ChartPath.js │ │ └── ChartPathProvider.js ├── helpers │ ├── ChartContext.js │ ├── extremesHelpers.js │ ├── useChartData.js │ ├── useReactiveSharedValue.js │ └── withReanimatedFallback.js ├── index.js ├── interpolations │ ├── bSplineInterpolation.js │ └── monotoneCubicInterpolation.js ├── simplification │ └── simplifyData.js └── smoothing │ └── smoothSVG.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | 24 | # CocoaPods 25 | **/ios/Pods 26 | 27 | # Android/IntelliJ 28 | # 29 | build/ 30 | .idea 31 | .gradle 32 | local.properties 33 | *.iml 34 | 35 | # node.js 36 | # 37 | node_modules/ 38 | npm-debug.log 39 | yarn-error.log 40 | 41 | # BUCK 42 | buck-out/ 43 | \.buckd/ 44 | *.keystore 45 | !debug.keystore 46 | 47 | # Expo 48 | /.expo 49 | 50 | # vscode 51 | jsconfig.json 52 | .classpath 53 | .project 54 | .settings/ 55 | .vscode 56 | -------------------------------------------------------------------------------- /.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "git": { 3 | "commitMessage": "chore: release v${version}" 4 | }, 5 | "github": { 6 | "release": true 7 | } 8 | } -------------------------------------------------------------------------------- /Example/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /Example/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore polyfills 9 | node_modules/react-native/Libraries/polyfills/.* 10 | 11 | ; These should not be required directly 12 | ; require from fbjs/lib instead: require('fbjs/lib/warning') 13 | node_modules/warning/.* 14 | 15 | ; Flow doesn't support platforms 16 | .*/Libraries/Utilities/LoadingView.js 17 | 18 | [untyped] 19 | .*/node_modules/@react-native-community/cli/.*/.* 20 | 21 | [include] 22 | 23 | [libs] 24 | node_modules/react-native/interface.js 25 | node_modules/react-native/flow/ 26 | 27 | [options] 28 | emoji=true 29 | 30 | esproposal.optional_chaining=enable 31 | esproposal.nullish_coalescing=enable 32 | 33 | module.file_ext=.js 34 | module.file_ext=.json 35 | module.file_ext=.ios.js 36 | 37 | munge_underscores=true 38 | 39 | module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' 40 | 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' 41 | 42 | suppress_type=$FlowIssue 43 | suppress_type=$FlowFixMe 44 | suppress_type=$FlowFixMeProps 45 | suppress_type=$FlowFixMeState 46 | 47 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) 48 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ 49 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 50 | 51 | [lints] 52 | sketchy-null-number=warn 53 | sketchy-null-mixed=warn 54 | sketchy-number=warn 55 | untyped-type-import=warn 56 | nonstrict-import=warn 57 | deprecated-type=warn 58 | unsafe-getters-setters=warn 59 | unnecessary-invariant=warn 60 | signature-verification-failure=warn 61 | deprecated-utility=error 62 | 63 | [strict] 64 | deprecated-type 65 | nonstrict-import 66 | sketchy-null 67 | unclear-type 68 | unsafe-getters-setters 69 | untyped-import 70 | untyped-type-import 71 | 72 | [version] 73 | ^0.122.0 74 | -------------------------------------------------------------------------------- /Example/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /Example/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | 24 | # Android/IntelliJ 25 | # 26 | build/ 27 | .idea 28 | .gradle 29 | local.properties 30 | *.iml 31 | 32 | # node.js 33 | # 34 | node_modules/ 35 | npm-debug.log 36 | yarn-error.log 37 | 38 | # BUCK 39 | buck-out/ 40 | \.buckd/ 41 | *.keystore 42 | !debug.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | # CocoaPods 59 | /ios/Pods/ 60 | -------------------------------------------------------------------------------- /Example/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: false, 3 | jsxBracketSameLine: true, 4 | singleQuote: true, 5 | trailingComma: 'all', 6 | }; 7 | -------------------------------------------------------------------------------- /Example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Example/App.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line import/default 2 | import ViewPager from '@react-native-community/viewpager'; 3 | import React from 'react'; 4 | import {SafeAreaView} from 'react-native'; 5 | import BasicExample from './src/BasicExample'; 6 | import Example from './src/GenericExample'; 7 | //import {default as RainbowExample} from './src/RainbowExample/value-chart/ChartExpandedState'; 8 | 9 | const App = () => { 10 | return ( 11 | <> 12 | 13 | 14 | 15 | {/**/} 16 | 17 | 18 | 19 | 20 | ); 21 | }; 22 | 23 | export default App; 24 | -------------------------------------------------------------------------------- /Example/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.example", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.example", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /Example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation. If none specified and 19 | * // "index.android.js" exists, it will be used. Otherwise "index.js" is 20 | * // default. Can be overridden with ENTRY_FILE environment variable. 21 | * entryFile: "index.android.js", 22 | * 23 | * // https://reactnative.dev/docs/performance#enable-the-ram-format 24 | * bundleCommand: "ram-bundle", 25 | * 26 | * // whether to bundle JS and assets in debug mode 27 | * bundleInDebug: false, 28 | * 29 | * // whether to bundle JS and assets in release mode 30 | * bundleInRelease: true, 31 | * 32 | * // whether to bundle JS and assets in another build variant (if configured). 33 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 34 | * // The configuration property can be in the following formats 35 | * // 'bundleIn${productFlavor}${buildType}' 36 | * // 'bundleIn${buildType}' 37 | * // bundleInFreeDebug: true, 38 | * // bundleInPaidRelease: true, 39 | * // bundleInBeta: true, 40 | * 41 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 42 | * // for example: to disable dev mode in the staging build type (if configured) 43 | * devDisabledInStaging: true, 44 | * // The configuration property can be in the following formats 45 | * // 'devDisabledIn${productFlavor}${buildType}' 46 | * // 'devDisabledIn${buildType}' 47 | * 48 | * // the root of your project, i.e. where "package.json" lives 49 | * root: "../../", 50 | * 51 | * // where to put the JS bundle asset in debug mode 52 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 53 | * 54 | * // where to put the JS bundle asset in release mode 55 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 56 | * 57 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 58 | * // require('./image.png')), in debug mode 59 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 60 | * 61 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 62 | * // require('./image.png')), in release mode 63 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 64 | * 65 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 66 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 67 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 68 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 69 | * // for example, you might want to remove it from here. 70 | * inputExcludes: ["android/**", "ios/**"], 71 | * 72 | * // override which node gets called and with what additional arguments 73 | * nodeExecutableAndArgs: ["node"], 74 | * 75 | * // supply additional arguments to the packager 76 | * extraPackagerArgs: [] 77 | * ] 78 | */ 79 | 80 | project.ext.react = [ 81 | enableHermes: true, // clean and rebuild if changing 82 | ] 83 | 84 | apply from: "../../node_modules/react-native/react.gradle" 85 | 86 | /** 87 | * Set this to true to create two separate APKs instead of one: 88 | * - An APK that only works on ARM devices 89 | * - An APK that only works on x86 devices 90 | * The advantage is the size of the APK is reduced by about 4MB. 91 | * Upload all the APKs to the Play Store and people will download 92 | * the correct one based on the CPU architecture of their device. 93 | */ 94 | def enableSeparateBuildPerCPUArchitecture = false 95 | 96 | /** 97 | * Run Proguard to shrink the Java bytecode in release builds. 98 | */ 99 | def enableProguardInReleaseBuilds = false 100 | 101 | /** 102 | * The preferred build flavor of JavaScriptCore. 103 | * 104 | * For example, to use the international variant, you can use: 105 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 106 | * 107 | * The international variant includes ICU i18n library and necessary data 108 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 109 | * give correct results when using with locales other than en-US. Note that 110 | * this variant is about 6MiB larger per architecture than default. 111 | */ 112 | def jscFlavor = 'org.webkit:android-jsc:+' 113 | 114 | /** 115 | * Whether to enable the Hermes VM. 116 | * 117 | * This should be set on project.ext.react and mirrored here. If it is not set 118 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 119 | * and the benefits of using Hermes will therefore be sharply reduced. 120 | */ 121 | def enableHermes = project.ext.react.get("enableHermes", false); 122 | 123 | android { 124 | compileSdkVersion rootProject.ext.compileSdkVersion 125 | 126 | compileOptions { 127 | sourceCompatibility JavaVersion.VERSION_1_8 128 | targetCompatibility JavaVersion.VERSION_1_8 129 | } 130 | 131 | defaultConfig { 132 | applicationId "com.example" 133 | minSdkVersion rootProject.ext.minSdkVersion 134 | targetSdkVersion rootProject.ext.targetSdkVersion 135 | versionCode 1 136 | versionName "1.0" 137 | } 138 | splits { 139 | abi { 140 | reset() 141 | enable enableSeparateBuildPerCPUArchitecture 142 | universalApk false // If true, also generate a universal APK 143 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 144 | } 145 | } 146 | signingConfigs { 147 | debug { 148 | storeFile file('debug.keystore') 149 | storePassword 'android' 150 | keyAlias 'androiddebugkey' 151 | keyPassword 'android' 152 | } 153 | } 154 | buildTypes { 155 | debug { 156 | signingConfig signingConfigs.debug 157 | } 158 | release { 159 | // Caution! In production, you need to generate your own keystore file. 160 | // see https://reactnative.dev/docs/signed-apk-android. 161 | signingConfig signingConfigs.debug 162 | minifyEnabled enableProguardInReleaseBuilds 163 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 164 | } 165 | } 166 | 167 | // applicationVariants are e.g. debug, release 168 | applicationVariants.all { variant -> 169 | variant.outputs.each { output -> 170 | // For each separate APK per architecture, set a unique version code as described here: 171 | // https://developer.android.com/studio/build/configure-apk-splits.html 172 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 173 | def abi = output.getFilter(OutputFile.ABI) 174 | if (abi != null) { // null for the universal-debug, universal-release variants 175 | output.versionCodeOverride = 176 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 177 | } 178 | 179 | } 180 | } 181 | } 182 | 183 | dependencies { 184 | implementation fileTree(dir: "libs", include: ["*.jar"]) 185 | //noinspection GradleDynamicVersion 186 | implementation "com.facebook.react:react-native:+" // From node_modules 187 | 188 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" 189 | 190 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { 191 | exclude group:'com.facebook.fbjni' 192 | } 193 | 194 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 195 | exclude group:'com.facebook.flipper' 196 | exclude group:'com.squareup.okhttp3', module:'okhttp' 197 | } 198 | 199 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { 200 | exclude group:'com.facebook.flipper' 201 | } 202 | 203 | if (enableHermes) { 204 | def hermesPath = "../../node_modules/hermes-engine/android/"; 205 | debugImplementation files(hermesPath + "hermes-debug.aar") 206 | releaseImplementation files(hermesPath + "hermes-release.aar") 207 | } else { 208 | implementation jscFlavor 209 | } 210 | } 211 | 212 | // Run this once to be able to run the application with BUCK 213 | // puts all compile dependencies into folder libs for BUCK to use 214 | task copyDownloadableDepsToLibs(type: Copy) { 215 | from configurations.compile 216 | into 'libs' 217 | } 218 | 219 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 220 | -------------------------------------------------------------------------------- /Example/android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /Example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/Example/android/app/debug.keystore -------------------------------------------------------------------------------- /Example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /Example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/android/app/src/debug/java/com/example/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.example; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin; 21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 22 | import com.facebook.react.ReactInstanceManager; 23 | import com.facebook.react.bridge.ReactContext; 24 | import com.facebook.react.modules.network.NetworkingModule; 25 | import okhttp3.OkHttpClient; 26 | 27 | public class ReactNativeFlipper { 28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 29 | if (FlipperUtils.shouldEnableFlipper(context)) { 30 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 31 | 32 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 33 | client.addPlugin(new ReactFlipperPlugin()); 34 | client.addPlugin(new DatabasesFlipperPlugin(context)); 35 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 36 | client.addPlugin(CrashReporterPlugin.getInstance()); 37 | 38 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 39 | NetworkingModule.setCustomClientBuilder( 40 | new NetworkingModule.CustomClientBuilder() { 41 | @Override 42 | public void apply(OkHttpClient.Builder builder) { 43 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 44 | } 45 | }); 46 | client.addPlugin(networkFlipperPlugin); 47 | client.start(); 48 | 49 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 50 | // Hence we run if after all native modules have been initialized 51 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 52 | if (reactContext == null) { 53 | reactInstanceManager.addReactInstanceEventListener( 54 | new ReactInstanceManager.ReactInstanceEventListener() { 55 | @Override 56 | public void onReactContextInitialized(ReactContext reactContext) { 57 | reactInstanceManager.removeReactInstanceEventListener(this); 58 | reactContext.runOnNativeModulesQueueThread( 59 | new Runnable() { 60 | @Override 61 | public void run() { 62 | client.addPlugin(new FrescoFlipperPlugin()); 63 | } 64 | }); 65 | } 66 | }); 67 | } else { 68 | client.addPlugin(new FrescoFlipperPlugin()); 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.facebook.react.ReactActivity; 4 | import com.facebook.react.ReactActivityDelegate; 5 | import com.facebook.react.ReactRootView; 6 | import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; 7 | 8 | public class MainActivity extends ReactActivity { 9 | 10 | /** 11 | * Returns the name of the main component registered from JavaScript. This is used to schedule 12 | * rendering of the component. 13 | */ 14 | @Override 15 | protected String getMainComponentName() { 16 | return "Example"; 17 | } 18 | @Override 19 | protected ReactActivityDelegate createReactActivityDelegate() { 20 | return new ReactActivityDelegate(this, getMainComponentName()) { 21 | @Override 22 | protected ReactRootView createRootView() { 23 | return new RNGestureHandlerEnabledRootView(MainActivity.this); 24 | } 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/example/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactInstanceManager; 8 | import com.facebook.react.ReactNativeHost; 9 | import com.facebook.react.ReactPackage; 10 | import com.facebook.react.bridge.JSIModulePackage; 11 | import com.facebook.soloader.SoLoader; 12 | import com.swmansion.reanimated.ReanimatedJSIModulePackage; 13 | 14 | import java.lang.reflect.InvocationTargetException; 15 | import java.util.List; 16 | 17 | public class MainApplication extends Application implements ReactApplication { 18 | 19 | private final ReactNativeHost mReactNativeHost = 20 | new ReactNativeHost(this) { 21 | @Override 22 | public boolean getUseDeveloperSupport() { 23 | return BuildConfig.DEBUG; 24 | } 25 | 26 | @Override 27 | protected List getPackages() { 28 | @SuppressWarnings("UnnecessaryLocalVariable") 29 | List packages = new PackageList(this).getPackages(); 30 | // Packages that cannot be autolinked yet can be added manually here, for example: 31 | // packages.add(new MyReactNativePackage()); 32 | return packages; 33 | } 34 | 35 | @Override 36 | protected String getJSMainModuleName() { 37 | return "index"; 38 | } 39 | 40 | @Override 41 | protected JSIModulePackage getJSIModulePackage() { 42 | return new ReanimatedJSIModulePackage(); // <- add 43 | } 44 | }; 45 | 46 | @Override 47 | public ReactNativeHost getReactNativeHost() { 48 | return mReactNativeHost; 49 | } 50 | 51 | @Override 52 | public void onCreate() { 53 | super.onCreate(); 54 | SoLoader.init(this, /* native exopackage */ false); 55 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 56 | } 57 | 58 | /** 59 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like 60 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 61 | * 62 | * @param context 63 | * @param reactInstanceManager 64 | */ 65 | private static void initializeFlipper( 66 | Context context, ReactInstanceManager reactInstanceManager) { 67 | if (BuildConfig.DEBUG) { 68 | try { 69 | /* 70 | We use reflection here to pick up the class that initializes Flipper, 71 | since Flipper library is not available in release mode 72 | */ 73 | Class aClass = Class.forName("com.example.ReactNativeFlipper"); 74 | aClass 75 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 76 | .invoke(null, context, reactInstanceManager); 77 | } catch (ClassNotFoundException e) { 78 | e.printStackTrace(); 79 | } catch (NoSuchMethodException e) { 80 | e.printStackTrace(); 81 | } catch (IllegalAccessException e) { 82 | e.printStackTrace(); 83 | } catch (InvocationTargetException e) { 84 | e.printStackTrace(); 85 | } 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Example 3 | 4 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "29.0.2" 6 | minSdkVersion = 16 7 | compileSdkVersion = 29 8 | targetSdkVersion = 29 9 | } 10 | repositories { 11 | google() 12 | jcenter() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle:3.5.3") 16 | // NOTE: Do not place your application dependencies here; they belong 17 | // in the individual module build.gradle files 18 | } 19 | } 20 | 21 | allprojects { 22 | repositories { 23 | mavenLocal() 24 | maven { 25 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 26 | url("$rootDir/../node_modules/react-native/android") 27 | } 28 | maven { 29 | // Android JSC is installed from npm 30 | url("$rootDir/../node_modules/jsc-android/dist") 31 | } 32 | 33 | google() 34 | jcenter() 35 | maven { url 'https://www.jitpack.io' } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | 27 | # Version of flipper SDK to use with React Native 28 | FLIPPER_VERSION=0.37.0 29 | -------------------------------------------------------------------------------- /Example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/Example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /Example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=`expr $i + 1` 158 | done 159 | case $i in 160 | 0) set -- ;; 161 | 1) set -- "$args0" ;; 162 | 2) set -- "$args0" "$args1" ;; 163 | 3) set -- "$args0" "$args1" "$args2" ;; 164 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=`save "$@"` 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | exec "$JAVACMD" "$@" 184 | -------------------------------------------------------------------------------- /Example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /Example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'Example' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | -------------------------------------------------------------------------------- /Example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Example", 3 | "displayName": "Example" 4 | } -------------------------------------------------------------------------------- /Example/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | ['babel-plugin-styled-components'], 4 | [ 5 | 'module-resolver', 6 | { 7 | alias: { 8 | 'fbjs': './node_modules/fbjs', 9 | 'hoist-non-react-statics': './node_modules/hoist-non-react-statics', 10 | 'invariant': './node_modules/invariant', 11 | 'prop-types': './node_modules/prop-types', 12 | 'react': './node_modules/react', 13 | 'react-native': './node_modules/react-native', 14 | '@rainbow-me/animated-charts': './../src', 15 | 'react-native-gesture-handler': 16 | './node_modules/react-native-gesture-handler', 17 | 'react-native-haptic-feedback': 18 | './node_modules/react-native-haptic-feedback', 19 | 'react-native-reanimated': './node_modules/react-native-reanimated', 20 | 'react-native-svg': './node_modules/react-native-svg', 21 | }, 22 | root: ['./../src'], 23 | }, 24 | ], 25 | 'react-native-reanimated/plugin', 26 | ], 27 | presets: ['module:metro-react-native-babel-preset'], 28 | }; 29 | -------------------------------------------------------------------------------- /Example/index.js: -------------------------------------------------------------------------------- 1 | import {AppRegistry} from 'react-native'; 2 | import App from './App'; 3 | import {name as appName} from './app.json'; 4 | 5 | AppRegistry.registerComponent(appName, () => App); 6 | -------------------------------------------------------------------------------- /Example/ios/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | #import 5 | #import 6 | 7 | #import 8 | #import 9 | 10 | #import 11 | #import 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | 21 | @interface AppDelegate() { 22 | RCTTurboModuleManager *_turboModuleManager; 23 | } 24 | @end 25 | 26 | @implementation AppDelegate 27 | 28 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 29 | { 30 | RCTEnableTurboModule(YES); 31 | 32 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 33 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 34 | moduleName:@"Example" 35 | initialProperties:nil]; 36 | 37 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 38 | 39 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 40 | UIViewController *rootViewController = [UIViewController new]; 41 | rootViewController.view = rootView; 42 | self.window.rootViewController = rootViewController; 43 | [self.window makeKeyAndVisible]; 44 | return YES; 45 | } 46 | 47 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 48 | { 49 | #if DEBUG 50 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 51 | #else 52 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 53 | #endif 54 | } 55 | 56 | - (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge 57 | { 58 | _bridge_reanimated = bridge; 59 | _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge 60 | delegate:self 61 | jsInvoker:bridge.jsCallInvoker]; 62 | #if RCT_DEV 63 | [_turboModuleManager moduleForName:"RCTDevMenu"]; 64 | #endif 65 | 66 | __weak __typeof(self) weakSelf = self; 67 | return std::make_unique([weakSelf, bridge](facebook::jsi::Runtime &runtime) { 68 | if (!bridge) { 69 | return; 70 | } 71 | __typeof(self) strongSelf = weakSelf; 72 | if (strongSelf) { 73 | [strongSelf->_turboModuleManager installJSBindingWithRuntime:&runtime]; 74 | } 75 | }); 76 | } 77 | 78 | - (Class)getModuleClassFromName:(const char *)name 79 | { 80 | return facebook::react::REATurboModuleClassProvider(name); 81 | } 82 | 83 | - (std::shared_ptr)getTurboModule:(const std::string &)name 84 | jsInvoker:(std::shared_ptr)jsInvoker 85 | { 86 | return facebook::react::REATurboModuleProvider(name, jsInvoker); 87 | } 88 | 89 | - (std::shared_ptr)getTurboModule:(const std::string &)name 90 | instance:(id)instance 91 | jsInvoker:(std::shared_ptr)jsInvoker 92 | { 93 | return facebook::react::REATurboModuleProvider(name, instance, jsInvoker); 94 | } 95 | 96 | - (id)getModuleInstanceFromClass:(Class)moduleClass 97 | { 98 | if (moduleClass == RCTImageLoader.class) { 99 | return [[moduleClass alloc] initWithRedirectDelegate:nil loadersProvider:^NSArray> *{ 100 | return @[[RCTLocalAssetImageLoader new]]; 101 | } decodersProvider:^NSArray> *{ 102 | return @[[RCTGIFImageDecoder new]]; 103 | }]; 104 | } else if (moduleClass == RCTNetworking.class) { 105 | return [[moduleClass alloc] initWithHandlersProvider:^NSArray> *{ 106 | return @[ 107 | [RCTHTTPRequestHandler new], 108 | [RCTDataRequestHandler new], 109 | [RCTFileRequestHandler new], 110 | ]; 111 | }]; 112 | } 113 | // No custom initializer here. 114 | return [moduleClass new]; 115 | } 116 | 117 | - (std::shared_ptr)getTurboModule:(const std::string &)name instance:(id)instance jsInvoker:(std::shared_ptr)jsInvoker nativeInvoker:(std::shared_ptr)nativeInvoker perfLogger:(id)perfLogger { 118 | return nil; 119 | } 120 | 121 | 122 | @end 123 | -------------------------------------------------------------------------------- /Example/ios/Example-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSExceptionDomains 28 | 29 | localhost 30 | 31 | NSExceptionAllowsInsecureHTTPLoads 32 | 33 | 34 | 35 | 36 | NSLocationWhenInUseUsageDescription 37 | 38 | UILaunchStoryboardName 39 | LaunchScreen 40 | UIRequiredDeviceCapabilities 41 | 42 | armv7 43 | 44 | UISupportedInterfaceOrientations 45 | 46 | UIInterfaceOrientationPortrait 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | UIViewControllerBasedStatusBarAppearance 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Example/ios/Example-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/ios/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 00E356F31AD99517003FC87E /* ExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ExampleTests.m */; }; 11 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 12 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 13 | 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 14 | 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 15 | 2DCD954D1E0B4F2C00145EB5 /* ExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ExampleTests.m */; }; 16 | 336F7650152404D08196B3CE /* libPods-Example-tvOSTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6382D6A193870347FBA4CB9B /* libPods-Example-tvOSTests.a */; }; 17 | 66887E4A24F6558B007A4258 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 66887E4924F6558B007A4258 /* AppDelegate.mm */; }; 18 | 6CBE75BA6F8751235853821C /* libPods-Example-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C1CD3E20809813695C4FB51 /* libPods-Example-tvOS.a */; }; 19 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; 20 | 84CA815E61277FFAB8C35608 /* libPods-Example-ExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 696CB0F89BE9E82604F127DC /* libPods-Example-ExampleTests.a */; }; 21 | 8560D8C657BDDC94A76F37C2 /* libPods-Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16163D9FE6F0E4DFD5BC5750 /* libPods-Example.a */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 30 | remoteInfo = Example; 31 | }; 32 | 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = 2D02E47A1E0B4A5D006451C7; 37 | remoteInfo = "Example-tvOS"; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 43 | 00E356EE1AD99517003FC87E /* ExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | 00E356F21AD99517003FC87E /* ExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExampleTests.m; sourceTree = ""; }; 46 | 13B07F961A680F5B00A75B9A /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Example/AppDelegate.h; sourceTree = ""; }; 48 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Example/Images.xcassets; sourceTree = ""; }; 49 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Example/Info.plist; sourceTree = ""; }; 50 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Example/main.m; sourceTree = ""; }; 51 | 1428365E1AB34ECA944C33E0 /* Pods-Example-ExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-ExampleTests.release.xcconfig"; path = "Target Support Files/Pods-Example-ExampleTests/Pods-Example-ExampleTests.release.xcconfig"; sourceTree = ""; }; 52 | 16163D9FE6F0E4DFD5BC5750 /* libPods-Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 17E15F1FDF1E1F554725FCAD /* Pods-Example-tvOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-tvOSTests.debug.xcconfig"; path = "Target Support Files/Pods-Example-tvOSTests/Pods-Example-tvOSTests.debug.xcconfig"; sourceTree = ""; }; 54 | 2D02E47B1E0B4A5D006451C7 /* Example-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Example-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 2D02E4901E0B4A5D006451C7 /* Example-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Example-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 41A9E0D5293281AF83E76022 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = ""; }; 57 | 54CA4496913CB77B2DDC85F9 /* Pods-Example-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-tvOS.debug.xcconfig"; path = "Target Support Files/Pods-Example-tvOS/Pods-Example-tvOS.debug.xcconfig"; sourceTree = ""; }; 58 | 5C1CD3E20809813695C4FB51 /* libPods-Example-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 61056C96EEDCA2C540530B4E /* Pods-Example-ExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-ExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-Example-ExampleTests/Pods-Example-ExampleTests.debug.xcconfig"; sourceTree = ""; }; 60 | 6382D6A193870347FBA4CB9B /* libPods-Example-tvOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example-tvOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 61 | 66887E4924F6558B007A4258 /* AppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = ""; }; 62 | 696CB0F89BE9E82604F127DC /* libPods-Example-ExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example-ExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 63 | 7D2886390CEB32185B139D4B /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; }; 64 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = Example/LaunchScreen.storyboard; sourceTree = ""; }; 65 | C3A65085D4754AC206499D06 /* Pods-Example-tvOSTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-tvOSTests.release.xcconfig"; path = "Target Support Files/Pods-Example-tvOSTests/Pods-Example-tvOSTests.release.xcconfig"; sourceTree = ""; }; 66 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 67 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; 68 | FCB42CAB9262173FA4FAE444 /* Pods-Example-tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-tvOS.release.xcconfig"; path = "Target Support Files/Pods-Example-tvOS/Pods-Example-tvOS.release.xcconfig"; sourceTree = ""; }; 69 | /* End PBXFileReference section */ 70 | 71 | /* Begin PBXFrameworksBuildPhase section */ 72 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | 84CA815E61277FFAB8C35608 /* libPods-Example-ExampleTests.a in Frameworks */, 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | 8560D8C657BDDC94A76F37C2 /* libPods-Example.a in Frameworks */, 85 | ); 86 | runOnlyForDeploymentPostprocessing = 0; 87 | }; 88 | 2D02E4781E0B4A5D006451C7 /* Frameworks */ = { 89 | isa = PBXFrameworksBuildPhase; 90 | buildActionMask = 2147483647; 91 | files = ( 92 | 6CBE75BA6F8751235853821C /* libPods-Example-tvOS.a in Frameworks */, 93 | ); 94 | runOnlyForDeploymentPostprocessing = 0; 95 | }; 96 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */ = { 97 | isa = PBXFrameworksBuildPhase; 98 | buildActionMask = 2147483647; 99 | files = ( 100 | 336F7650152404D08196B3CE /* libPods-Example-tvOSTests.a in Frameworks */, 101 | ); 102 | runOnlyForDeploymentPostprocessing = 0; 103 | }; 104 | /* End PBXFrameworksBuildPhase section */ 105 | 106 | /* Begin PBXGroup section */ 107 | 00E356EF1AD99517003FC87E /* ExampleTests */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 00E356F21AD99517003FC87E /* ExampleTests.m */, 111 | 00E356F01AD99517003FC87E /* Supporting Files */, 112 | ); 113 | path = ExampleTests; 114 | sourceTree = ""; 115 | }; 116 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 00E356F11AD99517003FC87E /* Info.plist */, 120 | ); 121 | name = "Supporting Files"; 122 | sourceTree = ""; 123 | }; 124 | 13B07FAE1A68108700A75B9A /* Example */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 128 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 129 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 130 | 13B07FB61A68108700A75B9A /* Info.plist */, 131 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, 132 | 13B07FB71A68108700A75B9A /* main.m */, 133 | 66887E4924F6558B007A4258 /* AppDelegate.mm */, 134 | ); 135 | name = Example; 136 | sourceTree = ""; 137 | }; 138 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 142 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */, 143 | 16163D9FE6F0E4DFD5BC5750 /* libPods-Example.a */, 144 | 696CB0F89BE9E82604F127DC /* libPods-Example-ExampleTests.a */, 145 | 5C1CD3E20809813695C4FB51 /* libPods-Example-tvOS.a */, 146 | 6382D6A193870347FBA4CB9B /* libPods-Example-tvOSTests.a */, 147 | ); 148 | name = Frameworks; 149 | sourceTree = ""; 150 | }; 151 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | ); 155 | name = Libraries; 156 | sourceTree = ""; 157 | }; 158 | 83CBB9F61A601CBA00E9B192 = { 159 | isa = PBXGroup; 160 | children = ( 161 | 13B07FAE1A68108700A75B9A /* Example */, 162 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 163 | 00E356EF1AD99517003FC87E /* ExampleTests */, 164 | 83CBBA001A601CBA00E9B192 /* Products */, 165 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 166 | D830B76FBD742A9D61A94C5C /* Pods */, 167 | ); 168 | indentWidth = 2; 169 | sourceTree = ""; 170 | tabWidth = 2; 171 | usesTabs = 0; 172 | }; 173 | 83CBBA001A601CBA00E9B192 /* Products */ = { 174 | isa = PBXGroup; 175 | children = ( 176 | 13B07F961A680F5B00A75B9A /* Example.app */, 177 | 00E356EE1AD99517003FC87E /* ExampleTests.xctest */, 178 | 2D02E47B1E0B4A5D006451C7 /* Example-tvOS.app */, 179 | 2D02E4901E0B4A5D006451C7 /* Example-tvOSTests.xctest */, 180 | ); 181 | name = Products; 182 | sourceTree = ""; 183 | }; 184 | D830B76FBD742A9D61A94C5C /* Pods */ = { 185 | isa = PBXGroup; 186 | children = ( 187 | 41A9E0D5293281AF83E76022 /* Pods-Example.debug.xcconfig */, 188 | 7D2886390CEB32185B139D4B /* Pods-Example.release.xcconfig */, 189 | 61056C96EEDCA2C540530B4E /* Pods-Example-ExampleTests.debug.xcconfig */, 190 | 1428365E1AB34ECA944C33E0 /* Pods-Example-ExampleTests.release.xcconfig */, 191 | 54CA4496913CB77B2DDC85F9 /* Pods-Example-tvOS.debug.xcconfig */, 192 | FCB42CAB9262173FA4FAE444 /* Pods-Example-tvOS.release.xcconfig */, 193 | 17E15F1FDF1E1F554725FCAD /* Pods-Example-tvOSTests.debug.xcconfig */, 194 | C3A65085D4754AC206499D06 /* Pods-Example-tvOSTests.release.xcconfig */, 195 | ); 196 | path = Pods; 197 | sourceTree = ""; 198 | }; 199 | /* End PBXGroup section */ 200 | 201 | /* Begin PBXNativeTarget section */ 202 | 00E356ED1AD99517003FC87E /* ExampleTests */ = { 203 | isa = PBXNativeTarget; 204 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ExampleTests" */; 205 | buildPhases = ( 206 | 18DC378AA3AF840A8012D42B /* [CP] Check Pods Manifest.lock */, 207 | 00E356EA1AD99517003FC87E /* Sources */, 208 | 00E356EB1AD99517003FC87E /* Frameworks */, 209 | 00E356EC1AD99517003FC87E /* Resources */, 210 | 5D16A62C0AF5EAABECCA5F95 /* [CP] Copy Pods Resources */, 211 | ); 212 | buildRules = ( 213 | ); 214 | dependencies = ( 215 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 216 | ); 217 | name = ExampleTests; 218 | productName = ExampleTests; 219 | productReference = 00E356EE1AD99517003FC87E /* ExampleTests.xctest */; 220 | productType = "com.apple.product-type.bundle.unit-test"; 221 | }; 222 | 13B07F861A680F5B00A75B9A /* Example */ = { 223 | isa = PBXNativeTarget; 224 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Example" */; 225 | buildPhases = ( 226 | 3A8E0DF0AAEDE0B0247794F5 /* [CP] Check Pods Manifest.lock */, 227 | FD10A7F022414F080027D42C /* Start Packager */, 228 | 13B07F871A680F5B00A75B9A /* Sources */, 229 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 230 | 13B07F8E1A680F5B00A75B9A /* Resources */, 231 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 232 | 79E68CEB44D90D754913B2FD /* [CP] Copy Pods Resources */, 233 | ); 234 | buildRules = ( 235 | ); 236 | dependencies = ( 237 | ); 238 | name = Example; 239 | productName = Example; 240 | productReference = 13B07F961A680F5B00A75B9A /* Example.app */; 241 | productType = "com.apple.product-type.application"; 242 | }; 243 | 2D02E47A1E0B4A5D006451C7 /* Example-tvOS */ = { 244 | isa = PBXNativeTarget; 245 | buildConfigurationList = 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "Example-tvOS" */; 246 | buildPhases = ( 247 | 4550505B51152CEF78DF834C /* [CP] Check Pods Manifest.lock */, 248 | FD10A7F122414F3F0027D42C /* Start Packager */, 249 | 2D02E4771E0B4A5D006451C7 /* Sources */, 250 | 2D02E4781E0B4A5D006451C7 /* Frameworks */, 251 | 2D02E4791E0B4A5D006451C7 /* Resources */, 252 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */, 253 | ); 254 | buildRules = ( 255 | ); 256 | dependencies = ( 257 | ); 258 | name = "Example-tvOS"; 259 | productName = "Example-tvOS"; 260 | productReference = 2D02E47B1E0B4A5D006451C7 /* Example-tvOS.app */; 261 | productType = "com.apple.product-type.application"; 262 | }; 263 | 2D02E48F1E0B4A5D006451C7 /* Example-tvOSTests */ = { 264 | isa = PBXNativeTarget; 265 | buildConfigurationList = 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "Example-tvOSTests" */; 266 | buildPhases = ( 267 | 097FE360A1B3DACD5F1D3E99 /* [CP] Check Pods Manifest.lock */, 268 | 2D02E48C1E0B4A5D006451C7 /* Sources */, 269 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */, 270 | 2D02E48E1E0B4A5D006451C7 /* Resources */, 271 | ); 272 | buildRules = ( 273 | ); 274 | dependencies = ( 275 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */, 276 | ); 277 | name = "Example-tvOSTests"; 278 | productName = "Example-tvOSTests"; 279 | productReference = 2D02E4901E0B4A5D006451C7 /* Example-tvOSTests.xctest */; 280 | productType = "com.apple.product-type.bundle.unit-test"; 281 | }; 282 | /* End PBXNativeTarget section */ 283 | 284 | /* Begin PBXProject section */ 285 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 286 | isa = PBXProject; 287 | attributes = { 288 | LastUpgradeCheck = 1130; 289 | TargetAttributes = { 290 | 00E356ED1AD99517003FC87E = { 291 | CreatedOnToolsVersion = 6.2; 292 | TestTargetID = 13B07F861A680F5B00A75B9A; 293 | }; 294 | 13B07F861A680F5B00A75B9A = { 295 | LastSwiftMigration = 1120; 296 | }; 297 | 2D02E47A1E0B4A5D006451C7 = { 298 | CreatedOnToolsVersion = 8.2.1; 299 | ProvisioningStyle = Automatic; 300 | }; 301 | 2D02E48F1E0B4A5D006451C7 = { 302 | CreatedOnToolsVersion = 8.2.1; 303 | ProvisioningStyle = Automatic; 304 | TestTargetID = 2D02E47A1E0B4A5D006451C7; 305 | }; 306 | }; 307 | }; 308 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Example" */; 309 | compatibilityVersion = "Xcode 3.2"; 310 | developmentRegion = en; 311 | hasScannedForEncodings = 0; 312 | knownRegions = ( 313 | en, 314 | Base, 315 | ); 316 | mainGroup = 83CBB9F61A601CBA00E9B192; 317 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 318 | projectDirPath = ""; 319 | projectRoot = ""; 320 | targets = ( 321 | 13B07F861A680F5B00A75B9A /* Example */, 322 | 00E356ED1AD99517003FC87E /* ExampleTests */, 323 | 2D02E47A1E0B4A5D006451C7 /* Example-tvOS */, 324 | 2D02E48F1E0B4A5D006451C7 /* Example-tvOSTests */, 325 | ); 326 | }; 327 | /* End PBXProject section */ 328 | 329 | /* Begin PBXResourcesBuildPhase section */ 330 | 00E356EC1AD99517003FC87E /* Resources */ = { 331 | isa = PBXResourcesBuildPhase; 332 | buildActionMask = 2147483647; 333 | files = ( 334 | ); 335 | runOnlyForDeploymentPostprocessing = 0; 336 | }; 337 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 338 | isa = PBXResourcesBuildPhase; 339 | buildActionMask = 2147483647; 340 | files = ( 341 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */, 342 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 343 | ); 344 | runOnlyForDeploymentPostprocessing = 0; 345 | }; 346 | 2D02E4791E0B4A5D006451C7 /* Resources */ = { 347 | isa = PBXResourcesBuildPhase; 348 | buildActionMask = 2147483647; 349 | files = ( 350 | 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */, 351 | ); 352 | runOnlyForDeploymentPostprocessing = 0; 353 | }; 354 | 2D02E48E1E0B4A5D006451C7 /* Resources */ = { 355 | isa = PBXResourcesBuildPhase; 356 | buildActionMask = 2147483647; 357 | files = ( 358 | ); 359 | runOnlyForDeploymentPostprocessing = 0; 360 | }; 361 | /* End PBXResourcesBuildPhase section */ 362 | 363 | /* Begin PBXShellScriptBuildPhase section */ 364 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 365 | isa = PBXShellScriptBuildPhase; 366 | buildActionMask = 2147483647; 367 | files = ( 368 | ); 369 | inputPaths = ( 370 | ); 371 | name = "Bundle React Native code and images"; 372 | outputPaths = ( 373 | ); 374 | runOnlyForDeploymentPostprocessing = 0; 375 | shellPath = /bin/sh; 376 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; 377 | }; 378 | 097FE360A1B3DACD5F1D3E99 /* [CP] Check Pods Manifest.lock */ = { 379 | isa = PBXShellScriptBuildPhase; 380 | buildActionMask = 2147483647; 381 | files = ( 382 | ); 383 | inputFileListPaths = ( 384 | ); 385 | inputPaths = ( 386 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 387 | "${PODS_ROOT}/Manifest.lock", 388 | ); 389 | name = "[CP] Check Pods Manifest.lock"; 390 | outputFileListPaths = ( 391 | ); 392 | outputPaths = ( 393 | "$(DERIVED_FILE_DIR)/Pods-Example-tvOSTests-checkManifestLockResult.txt", 394 | ); 395 | runOnlyForDeploymentPostprocessing = 0; 396 | shellPath = /bin/sh; 397 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 398 | showEnvVarsInLog = 0; 399 | }; 400 | 18DC378AA3AF840A8012D42B /* [CP] Check Pods Manifest.lock */ = { 401 | isa = PBXShellScriptBuildPhase; 402 | buildActionMask = 2147483647; 403 | files = ( 404 | ); 405 | inputFileListPaths = ( 406 | ); 407 | inputPaths = ( 408 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 409 | "${PODS_ROOT}/Manifest.lock", 410 | ); 411 | name = "[CP] Check Pods Manifest.lock"; 412 | outputFileListPaths = ( 413 | ); 414 | outputPaths = ( 415 | "$(DERIVED_FILE_DIR)/Pods-Example-ExampleTests-checkManifestLockResult.txt", 416 | ); 417 | runOnlyForDeploymentPostprocessing = 0; 418 | shellPath = /bin/sh; 419 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 420 | showEnvVarsInLog = 0; 421 | }; 422 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = { 423 | isa = PBXShellScriptBuildPhase; 424 | buildActionMask = 2147483647; 425 | files = ( 426 | ); 427 | inputPaths = ( 428 | ); 429 | name = "Bundle React Native Code And Images"; 430 | outputPaths = ( 431 | ); 432 | runOnlyForDeploymentPostprocessing = 0; 433 | shellPath = /bin/sh; 434 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; 435 | }; 436 | 3A8E0DF0AAEDE0B0247794F5 /* [CP] Check Pods Manifest.lock */ = { 437 | isa = PBXShellScriptBuildPhase; 438 | buildActionMask = 2147483647; 439 | files = ( 440 | ); 441 | inputFileListPaths = ( 442 | ); 443 | inputPaths = ( 444 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 445 | "${PODS_ROOT}/Manifest.lock", 446 | ); 447 | name = "[CP] Check Pods Manifest.lock"; 448 | outputFileListPaths = ( 449 | ); 450 | outputPaths = ( 451 | "$(DERIVED_FILE_DIR)/Pods-Example-checkManifestLockResult.txt", 452 | ); 453 | runOnlyForDeploymentPostprocessing = 0; 454 | shellPath = /bin/sh; 455 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 456 | showEnvVarsInLog = 0; 457 | }; 458 | 4550505B51152CEF78DF834C /* [CP] Check Pods Manifest.lock */ = { 459 | isa = PBXShellScriptBuildPhase; 460 | buildActionMask = 2147483647; 461 | files = ( 462 | ); 463 | inputFileListPaths = ( 464 | ); 465 | inputPaths = ( 466 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 467 | "${PODS_ROOT}/Manifest.lock", 468 | ); 469 | name = "[CP] Check Pods Manifest.lock"; 470 | outputFileListPaths = ( 471 | ); 472 | outputPaths = ( 473 | "$(DERIVED_FILE_DIR)/Pods-Example-tvOS-checkManifestLockResult.txt", 474 | ); 475 | runOnlyForDeploymentPostprocessing = 0; 476 | shellPath = /bin/sh; 477 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 478 | showEnvVarsInLog = 0; 479 | }; 480 | 5D16A62C0AF5EAABECCA5F95 /* [CP] Copy Pods Resources */ = { 481 | isa = PBXShellScriptBuildPhase; 482 | buildActionMask = 2147483647; 483 | files = ( 484 | ); 485 | inputPaths = ( 486 | "${PODS_ROOT}/Target Support Files/Pods-Example-ExampleTests/Pods-Example-ExampleTests-resources.sh", 487 | "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", 488 | ); 489 | name = "[CP] Copy Pods Resources"; 490 | outputPaths = ( 491 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", 492 | ); 493 | runOnlyForDeploymentPostprocessing = 0; 494 | shellPath = /bin/sh; 495 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example-ExampleTests/Pods-Example-ExampleTests-resources.sh\"\n"; 496 | showEnvVarsInLog = 0; 497 | }; 498 | 79E68CEB44D90D754913B2FD /* [CP] Copy Pods Resources */ = { 499 | isa = PBXShellScriptBuildPhase; 500 | buildActionMask = 2147483647; 501 | files = ( 502 | ); 503 | inputPaths = ( 504 | "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources.sh", 505 | "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", 506 | ); 507 | name = "[CP] Copy Pods Resources"; 508 | outputPaths = ( 509 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", 510 | ); 511 | runOnlyForDeploymentPostprocessing = 0; 512 | shellPath = /bin/sh; 513 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n"; 514 | showEnvVarsInLog = 0; 515 | }; 516 | FD10A7F022414F080027D42C /* Start Packager */ = { 517 | isa = PBXShellScriptBuildPhase; 518 | buildActionMask = 2147483647; 519 | files = ( 520 | ); 521 | inputFileListPaths = ( 522 | ); 523 | inputPaths = ( 524 | ); 525 | name = "Start Packager"; 526 | outputFileListPaths = ( 527 | ); 528 | outputPaths = ( 529 | ); 530 | runOnlyForDeploymentPostprocessing = 0; 531 | shellPath = /bin/sh; 532 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 533 | showEnvVarsInLog = 0; 534 | }; 535 | FD10A7F122414F3F0027D42C /* Start Packager */ = { 536 | isa = PBXShellScriptBuildPhase; 537 | buildActionMask = 2147483647; 538 | files = ( 539 | ); 540 | inputFileListPaths = ( 541 | ); 542 | inputPaths = ( 543 | ); 544 | name = "Start Packager"; 545 | outputFileListPaths = ( 546 | ); 547 | outputPaths = ( 548 | ); 549 | runOnlyForDeploymentPostprocessing = 0; 550 | shellPath = /bin/sh; 551 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 552 | showEnvVarsInLog = 0; 553 | }; 554 | /* End PBXShellScriptBuildPhase section */ 555 | 556 | /* Begin PBXSourcesBuildPhase section */ 557 | 00E356EA1AD99517003FC87E /* Sources */ = { 558 | isa = PBXSourcesBuildPhase; 559 | buildActionMask = 2147483647; 560 | files = ( 561 | 00E356F31AD99517003FC87E /* ExampleTests.m in Sources */, 562 | ); 563 | runOnlyForDeploymentPostprocessing = 0; 564 | }; 565 | 13B07F871A680F5B00A75B9A /* Sources */ = { 566 | isa = PBXSourcesBuildPhase; 567 | buildActionMask = 2147483647; 568 | files = ( 569 | 66887E4A24F6558B007A4258 /* AppDelegate.mm in Sources */, 570 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 571 | ); 572 | runOnlyForDeploymentPostprocessing = 0; 573 | }; 574 | 2D02E4771E0B4A5D006451C7 /* Sources */ = { 575 | isa = PBXSourcesBuildPhase; 576 | buildActionMask = 2147483647; 577 | files = ( 578 | 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */, 579 | ); 580 | runOnlyForDeploymentPostprocessing = 0; 581 | }; 582 | 2D02E48C1E0B4A5D006451C7 /* Sources */ = { 583 | isa = PBXSourcesBuildPhase; 584 | buildActionMask = 2147483647; 585 | files = ( 586 | 2DCD954D1E0B4F2C00145EB5 /* ExampleTests.m in Sources */, 587 | ); 588 | runOnlyForDeploymentPostprocessing = 0; 589 | }; 590 | /* End PBXSourcesBuildPhase section */ 591 | 592 | /* Begin PBXTargetDependency section */ 593 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 594 | isa = PBXTargetDependency; 595 | target = 13B07F861A680F5B00A75B9A /* Example */; 596 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 597 | }; 598 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */ = { 599 | isa = PBXTargetDependency; 600 | target = 2D02E47A1E0B4A5D006451C7 /* Example-tvOS */; 601 | targetProxy = 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */; 602 | }; 603 | /* End PBXTargetDependency section */ 604 | 605 | /* Begin XCBuildConfiguration section */ 606 | 00E356F61AD99517003FC87E /* Debug */ = { 607 | isa = XCBuildConfiguration; 608 | baseConfigurationReference = 61056C96EEDCA2C540530B4E /* Pods-Example-ExampleTests.debug.xcconfig */; 609 | buildSettings = { 610 | BUNDLE_LOADER = "$(TEST_HOST)"; 611 | GCC_PREPROCESSOR_DEFINITIONS = ( 612 | "DEBUG=1", 613 | "$(inherited)", 614 | ); 615 | INFOPLIST_FILE = ExampleTests/Info.plist; 616 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 617 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 618 | OTHER_LDFLAGS = ( 619 | "-ObjC", 620 | "-lc++", 621 | "$(inherited)", 622 | ); 623 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 624 | PRODUCT_NAME = "$(TARGET_NAME)"; 625 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; 626 | }; 627 | name = Debug; 628 | }; 629 | 00E356F71AD99517003FC87E /* Release */ = { 630 | isa = XCBuildConfiguration; 631 | baseConfigurationReference = 1428365E1AB34ECA944C33E0 /* Pods-Example-ExampleTests.release.xcconfig */; 632 | buildSettings = { 633 | BUNDLE_LOADER = "$(TEST_HOST)"; 634 | COPY_PHASE_STRIP = NO; 635 | INFOPLIST_FILE = ExampleTests/Info.plist; 636 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 637 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 638 | OTHER_LDFLAGS = ( 639 | "-ObjC", 640 | "-lc++", 641 | "$(inherited)", 642 | ); 643 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 644 | PRODUCT_NAME = "$(TARGET_NAME)"; 645 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; 646 | }; 647 | name = Release; 648 | }; 649 | 13B07F941A680F5B00A75B9A /* Debug */ = { 650 | isa = XCBuildConfiguration; 651 | baseConfigurationReference = 41A9E0D5293281AF83E76022 /* Pods-Example.debug.xcconfig */; 652 | buildSettings = { 653 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 654 | CLANG_ENABLE_MODULES = YES; 655 | CURRENT_PROJECT_VERSION = 1; 656 | ENABLE_BITCODE = NO; 657 | INFOPLIST_FILE = Example/Info.plist; 658 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 659 | OTHER_LDFLAGS = ( 660 | "$(inherited)", 661 | "-ObjC", 662 | "-lc++", 663 | ); 664 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 665 | PRODUCT_NAME = Example; 666 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 667 | SWIFT_VERSION = 5.0; 668 | VERSIONING_SYSTEM = "apple-generic"; 669 | }; 670 | name = Debug; 671 | }; 672 | 13B07F951A680F5B00A75B9A /* Release */ = { 673 | isa = XCBuildConfiguration; 674 | baseConfigurationReference = 7D2886390CEB32185B139D4B /* Pods-Example.release.xcconfig */; 675 | buildSettings = { 676 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 677 | CLANG_ENABLE_MODULES = YES; 678 | CURRENT_PROJECT_VERSION = 1; 679 | INFOPLIST_FILE = Example/Info.plist; 680 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 681 | OTHER_LDFLAGS = ( 682 | "$(inherited)", 683 | "-ObjC", 684 | "-lc++", 685 | ); 686 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 687 | PRODUCT_NAME = Example; 688 | SWIFT_VERSION = 5.0; 689 | VERSIONING_SYSTEM = "apple-generic"; 690 | }; 691 | name = Release; 692 | }; 693 | 2D02E4971E0B4A5E006451C7 /* Debug */ = { 694 | isa = XCBuildConfiguration; 695 | baseConfigurationReference = 54CA4496913CB77B2DDC85F9 /* Pods-Example-tvOS.debug.xcconfig */; 696 | buildSettings = { 697 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 698 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 699 | CLANG_ANALYZER_NONNULL = YES; 700 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 701 | CLANG_WARN_INFINITE_RECURSION = YES; 702 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 703 | DEBUG_INFORMATION_FORMAT = dwarf; 704 | ENABLE_TESTABILITY = YES; 705 | GCC_NO_COMMON_BLOCKS = YES; 706 | INFOPLIST_FILE = "Example-tvOS/Info.plist"; 707 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 708 | OTHER_LDFLAGS = ( 709 | "$(inherited)", 710 | "-ObjC", 711 | "-lc++", 712 | ); 713 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.Example-tvOS"; 714 | PRODUCT_NAME = "$(TARGET_NAME)"; 715 | SDKROOT = appletvos; 716 | TARGETED_DEVICE_FAMILY = 3; 717 | TVOS_DEPLOYMENT_TARGET = 10.0; 718 | }; 719 | name = Debug; 720 | }; 721 | 2D02E4981E0B4A5E006451C7 /* Release */ = { 722 | isa = XCBuildConfiguration; 723 | baseConfigurationReference = FCB42CAB9262173FA4FAE444 /* Pods-Example-tvOS.release.xcconfig */; 724 | buildSettings = { 725 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 726 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 727 | CLANG_ANALYZER_NONNULL = YES; 728 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 729 | CLANG_WARN_INFINITE_RECURSION = YES; 730 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 731 | COPY_PHASE_STRIP = NO; 732 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 733 | GCC_NO_COMMON_BLOCKS = YES; 734 | INFOPLIST_FILE = "Example-tvOS/Info.plist"; 735 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 736 | OTHER_LDFLAGS = ( 737 | "$(inherited)", 738 | "-ObjC", 739 | "-lc++", 740 | ); 741 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.Example-tvOS"; 742 | PRODUCT_NAME = "$(TARGET_NAME)"; 743 | SDKROOT = appletvos; 744 | TARGETED_DEVICE_FAMILY = 3; 745 | TVOS_DEPLOYMENT_TARGET = 10.0; 746 | }; 747 | name = Release; 748 | }; 749 | 2D02E4991E0B4A5E006451C7 /* Debug */ = { 750 | isa = XCBuildConfiguration; 751 | baseConfigurationReference = 17E15F1FDF1E1F554725FCAD /* Pods-Example-tvOSTests.debug.xcconfig */; 752 | buildSettings = { 753 | BUNDLE_LOADER = "$(TEST_HOST)"; 754 | CLANG_ANALYZER_NONNULL = YES; 755 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 756 | CLANG_WARN_INFINITE_RECURSION = YES; 757 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 758 | DEBUG_INFORMATION_FORMAT = dwarf; 759 | ENABLE_TESTABILITY = YES; 760 | GCC_NO_COMMON_BLOCKS = YES; 761 | INFOPLIST_FILE = "Example-tvOSTests/Info.plist"; 762 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 763 | OTHER_LDFLAGS = ( 764 | "$(inherited)", 765 | "-ObjC", 766 | "-lc++", 767 | ); 768 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.Example-tvOSTests"; 769 | PRODUCT_NAME = "$(TARGET_NAME)"; 770 | SDKROOT = appletvos; 771 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example-tvOS.app/Example-tvOS"; 772 | TVOS_DEPLOYMENT_TARGET = 10.1; 773 | }; 774 | name = Debug; 775 | }; 776 | 2D02E49A1E0B4A5E006451C7 /* Release */ = { 777 | isa = XCBuildConfiguration; 778 | baseConfigurationReference = C3A65085D4754AC206499D06 /* Pods-Example-tvOSTests.release.xcconfig */; 779 | buildSettings = { 780 | BUNDLE_LOADER = "$(TEST_HOST)"; 781 | CLANG_ANALYZER_NONNULL = YES; 782 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 783 | CLANG_WARN_INFINITE_RECURSION = YES; 784 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 785 | COPY_PHASE_STRIP = NO; 786 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 787 | GCC_NO_COMMON_BLOCKS = YES; 788 | INFOPLIST_FILE = "Example-tvOSTests/Info.plist"; 789 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 790 | OTHER_LDFLAGS = ( 791 | "$(inherited)", 792 | "-ObjC", 793 | "-lc++", 794 | ); 795 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.Example-tvOSTests"; 796 | PRODUCT_NAME = "$(TARGET_NAME)"; 797 | SDKROOT = appletvos; 798 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example-tvOS.app/Example-tvOS"; 799 | TVOS_DEPLOYMENT_TARGET = 10.1; 800 | }; 801 | name = Release; 802 | }; 803 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 804 | isa = XCBuildConfiguration; 805 | buildSettings = { 806 | ALWAYS_SEARCH_USER_PATHS = NO; 807 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 808 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 809 | CLANG_CXX_LIBRARY = "libc++"; 810 | CLANG_ENABLE_MODULES = YES; 811 | CLANG_ENABLE_OBJC_ARC = YES; 812 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 813 | CLANG_WARN_BOOL_CONVERSION = YES; 814 | CLANG_WARN_COMMA = YES; 815 | CLANG_WARN_CONSTANT_CONVERSION = YES; 816 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 817 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 818 | CLANG_WARN_EMPTY_BODY = YES; 819 | CLANG_WARN_ENUM_CONVERSION = YES; 820 | CLANG_WARN_INFINITE_RECURSION = YES; 821 | CLANG_WARN_INT_CONVERSION = YES; 822 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 823 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 824 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 825 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 826 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 827 | CLANG_WARN_STRICT_PROTOTYPES = YES; 828 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 829 | CLANG_WARN_UNREACHABLE_CODE = YES; 830 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 831 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 832 | COPY_PHASE_STRIP = NO; 833 | ENABLE_STRICT_OBJC_MSGSEND = YES; 834 | ENABLE_TESTABILITY = YES; 835 | GCC_C_LANGUAGE_STANDARD = gnu99; 836 | GCC_DYNAMIC_NO_PIC = NO; 837 | GCC_NO_COMMON_BLOCKS = YES; 838 | GCC_OPTIMIZATION_LEVEL = 0; 839 | GCC_PREPROCESSOR_DEFINITIONS = ( 840 | "DEBUG=1", 841 | "$(inherited)", 842 | ); 843 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 844 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 845 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 846 | GCC_WARN_UNDECLARED_SELECTOR = YES; 847 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 848 | GCC_WARN_UNUSED_FUNCTION = YES; 849 | GCC_WARN_UNUSED_VARIABLE = YES; 850 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 851 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 852 | LIBRARY_SEARCH_PATHS = ( 853 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 854 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", 855 | "\"$(inherited)\"", 856 | ); 857 | MTL_ENABLE_DEBUG_INFO = YES; 858 | ONLY_ACTIVE_ARCH = YES; 859 | SDKROOT = iphoneos; 860 | }; 861 | name = Debug; 862 | }; 863 | 83CBBA211A601CBA00E9B192 /* Release */ = { 864 | isa = XCBuildConfiguration; 865 | buildSettings = { 866 | ALWAYS_SEARCH_USER_PATHS = NO; 867 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 868 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 869 | CLANG_CXX_LIBRARY = "libc++"; 870 | CLANG_ENABLE_MODULES = YES; 871 | CLANG_ENABLE_OBJC_ARC = YES; 872 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 873 | CLANG_WARN_BOOL_CONVERSION = YES; 874 | CLANG_WARN_COMMA = YES; 875 | CLANG_WARN_CONSTANT_CONVERSION = YES; 876 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 877 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 878 | CLANG_WARN_EMPTY_BODY = YES; 879 | CLANG_WARN_ENUM_CONVERSION = YES; 880 | CLANG_WARN_INFINITE_RECURSION = YES; 881 | CLANG_WARN_INT_CONVERSION = YES; 882 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 883 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 884 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 885 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 886 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 887 | CLANG_WARN_STRICT_PROTOTYPES = YES; 888 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 889 | CLANG_WARN_UNREACHABLE_CODE = YES; 890 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 891 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 892 | COPY_PHASE_STRIP = YES; 893 | ENABLE_NS_ASSERTIONS = NO; 894 | ENABLE_STRICT_OBJC_MSGSEND = YES; 895 | GCC_C_LANGUAGE_STANDARD = gnu99; 896 | GCC_NO_COMMON_BLOCKS = YES; 897 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 898 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 899 | GCC_WARN_UNDECLARED_SELECTOR = YES; 900 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 901 | GCC_WARN_UNUSED_FUNCTION = YES; 902 | GCC_WARN_UNUSED_VARIABLE = YES; 903 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 904 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 905 | LIBRARY_SEARCH_PATHS = ( 906 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 907 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", 908 | "\"$(inherited)\"", 909 | ); 910 | MTL_ENABLE_DEBUG_INFO = NO; 911 | SDKROOT = iphoneos; 912 | VALIDATE_PRODUCT = YES; 913 | }; 914 | name = Release; 915 | }; 916 | /* End XCBuildConfiguration section */ 917 | 918 | /* Begin XCConfigurationList section */ 919 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ExampleTests" */ = { 920 | isa = XCConfigurationList; 921 | buildConfigurations = ( 922 | 00E356F61AD99517003FC87E /* Debug */, 923 | 00E356F71AD99517003FC87E /* Release */, 924 | ); 925 | defaultConfigurationIsVisible = 0; 926 | defaultConfigurationName = Release; 927 | }; 928 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Example" */ = { 929 | isa = XCConfigurationList; 930 | buildConfigurations = ( 931 | 13B07F941A680F5B00A75B9A /* Debug */, 932 | 13B07F951A680F5B00A75B9A /* Release */, 933 | ); 934 | defaultConfigurationIsVisible = 0; 935 | defaultConfigurationName = Release; 936 | }; 937 | 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "Example-tvOS" */ = { 938 | isa = XCConfigurationList; 939 | buildConfigurations = ( 940 | 2D02E4971E0B4A5E006451C7 /* Debug */, 941 | 2D02E4981E0B4A5E006451C7 /* Release */, 942 | ); 943 | defaultConfigurationIsVisible = 0; 944 | defaultConfigurationName = Release; 945 | }; 946 | 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "Example-tvOSTests" */ = { 947 | isa = XCConfigurationList; 948 | buildConfigurations = ( 949 | 2D02E4991E0B4A5E006451C7 /* Debug */, 950 | 2D02E49A1E0B4A5E006451C7 /* Release */, 951 | ); 952 | defaultConfigurationIsVisible = 0; 953 | defaultConfigurationName = Release; 954 | }; 955 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Example" */ = { 956 | isa = XCConfigurationList; 957 | buildConfigurations = ( 958 | 83CBBA201A601CBA00E9B192 /* Debug */, 959 | 83CBBA211A601CBA00E9B192 /* Release */, 960 | ); 961 | defaultConfigurationIsVisible = 0; 962 | defaultConfigurationName = Release; 963 | }; 964 | /* End XCConfigurationList section */ 965 | }; 966 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 967 | } 968 | -------------------------------------------------------------------------------- /Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Example/ios/Example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/ios/Example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : UIResponder 5 | 6 | @property (nonatomic, strong) UIWindow *window; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /Example/ios/Example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | #import 5 | #import 6 | 7 | #ifdef FB_SONARKIT_ENABLED 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import 14 | 15 | static void InitializeFlipper(UIApplication *application) { 16 | FlipperClient *client = [FlipperClient sharedClient]; 17 | SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; 18 | [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; 19 | [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; 20 | [client addPlugin:[FlipperKitReactPlugin new]]; 21 | [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; 22 | [client start]; 23 | } 24 | #endif 25 | 26 | @implementation AppDelegate 27 | 28 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 29 | { 30 | #ifdef FB_SONARKIT_ENABLED 31 | InitializeFlipper(application); 32 | #endif 33 | 34 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 35 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 36 | moduleName:@"Example" 37 | initialProperties:nil]; 38 | 39 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 40 | 41 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 42 | UIViewController *rootViewController = [UIViewController new]; 43 | rootViewController.view = rootView; 44 | self.window.rootViewController = rootViewController; 45 | [self.window makeKeyAndVisible]; 46 | return YES; 47 | } 48 | 49 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 50 | { 51 | #if DEBUG 52 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 53 | #else 54 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 55 | #endif 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Example/ios/Example/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Example/ios/Example/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Example/ios/Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSExceptionDomains 32 | 33 | localhost 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | 38 | 39 | 40 | NSLocationWhenInUseUsageDescription 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UIViewControllerBasedStatusBarAppearance 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /Example/ios/Example/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Example/ios/Example/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char * argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Example/ios/ExampleTests/ExampleTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | #import 6 | 7 | #define TIMEOUT_SECONDS 600 8 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 9 | 10 | @interface ExampleTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation ExampleTests 15 | 16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 17 | { 18 | if (test(view)) { 19 | return YES; 20 | } 21 | for (UIView *subview in [view subviews]) { 22 | if ([self findSubviewInView:subview matching:test]) { 23 | return YES; 24 | } 25 | } 26 | return NO; 27 | } 28 | 29 | - (void)testRendersWelcomeScreen 30 | { 31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 33 | BOOL foundElement = NO; 34 | 35 | __block NSString *redboxError = nil; 36 | #ifdef DEBUG 37 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 38 | if (level >= RCTLogLevelError) { 39 | redboxError = message; 40 | } 41 | }); 42 | #endif 43 | 44 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 45 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 46 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | 48 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 49 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 50 | return YES; 51 | } 52 | return NO; 53 | }]; 54 | } 55 | 56 | #ifdef DEBUG 57 | RCTSetLogFunction(RCTDefaultLogFunction); 58 | #endif 59 | 60 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 61 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 62 | } 63 | 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Example/ios/ExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/ios/Podfile: -------------------------------------------------------------------------------- 1 | require_relative '../node_modules/react-native/scripts/react_native_pods' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | platform :ios, '10.0' 5 | 6 | target 'Example' do 7 | config = use_native_modules! 8 | 9 | use_react_native!(:path => config["reactNativePath"]) 10 | 11 | target 'ExampleTests' do 12 | inherit! :complete 13 | # Pods for testing 14 | end 15 | 16 | # Enables Flipper. 17 | # 18 | # Note that if you have use_frameworks! enabled, Flipper will not work and 19 | # you should disable these next few lines. 20 | use_flipper! 21 | post_install do |installer| 22 | flipper_post_install(installer) 23 | end 24 | end 25 | 26 | target 'Example-tvOS' do 27 | # Pods for Example-tvOS 28 | 29 | target 'Example-tvOSTests' do 30 | inherit! :search_paths 31 | # Pods for testing 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /Example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - boost-for-react-native (1.63.0) 3 | - CocoaAsyncSocket (7.6.4) 4 | - CocoaLibEvent (1.0.0) 5 | - DoubleConversion (1.1.6) 6 | - FBLazyVector (0.63.2) 7 | - FBReactNativeSpec (0.63.2): 8 | - Folly (= 2020.01.13.00) 9 | - RCTRequired (= 0.63.2) 10 | - RCTTypeSafety (= 0.63.2) 11 | - React-Core (= 0.63.2) 12 | - React-jsi (= 0.63.2) 13 | - ReactCommon/turbomodule/core (= 0.63.2) 14 | - Flipper (0.41.5): 15 | - Flipper-Folly (~> 2.2) 16 | - Flipper-RSocket (~> 1.1) 17 | - Flipper-DoubleConversion (1.1.7) 18 | - Flipper-Folly (2.2.0): 19 | - boost-for-react-native 20 | - CocoaLibEvent (~> 1.0) 21 | - Flipper-DoubleConversion 22 | - Flipper-Glog 23 | - OpenSSL-Universal (= 1.0.2.19) 24 | - Flipper-Glog (0.3.6) 25 | - Flipper-PeerTalk (0.0.4) 26 | - Flipper-RSocket (1.1.0): 27 | - Flipper-Folly (~> 2.2) 28 | - FlipperKit (0.41.5): 29 | - FlipperKit/Core (= 0.41.5) 30 | - FlipperKit/Core (0.41.5): 31 | - Flipper (~> 0.41.5) 32 | - FlipperKit/CppBridge 33 | - FlipperKit/FBCxxFollyDynamicConvert 34 | - FlipperKit/FBDefines 35 | - FlipperKit/FKPortForwarding 36 | - FlipperKit/CppBridge (0.41.5): 37 | - Flipper (~> 0.41.5) 38 | - FlipperKit/FBCxxFollyDynamicConvert (0.41.5): 39 | - Flipper-Folly (~> 2.2) 40 | - FlipperKit/FBDefines (0.41.5) 41 | - FlipperKit/FKPortForwarding (0.41.5): 42 | - CocoaAsyncSocket (~> 7.6) 43 | - Flipper-PeerTalk (~> 0.0.4) 44 | - FlipperKit/FlipperKitHighlightOverlay (0.41.5) 45 | - FlipperKit/FlipperKitLayoutPlugin (0.41.5): 46 | - FlipperKit/Core 47 | - FlipperKit/FlipperKitHighlightOverlay 48 | - FlipperKit/FlipperKitLayoutTextSearchable 49 | - YogaKit (~> 1.18) 50 | - FlipperKit/FlipperKitLayoutTextSearchable (0.41.5) 51 | - FlipperKit/FlipperKitNetworkPlugin (0.41.5): 52 | - FlipperKit/Core 53 | - FlipperKit/FlipperKitReactPlugin (0.41.5): 54 | - FlipperKit/Core 55 | - FlipperKit/FlipperKitUserDefaultsPlugin (0.41.5): 56 | - FlipperKit/Core 57 | - FlipperKit/SKIOSNetworkPlugin (0.41.5): 58 | - FlipperKit/Core 59 | - FlipperKit/FlipperKitNetworkPlugin 60 | - Folly (2020.01.13.00): 61 | - boost-for-react-native 62 | - DoubleConversion 63 | - Folly/Default (= 2020.01.13.00) 64 | - glog 65 | - Folly/Default (2020.01.13.00): 66 | - boost-for-react-native 67 | - DoubleConversion 68 | - glog 69 | - glog (0.3.5) 70 | - OpenSSL-Universal (1.0.2.19): 71 | - OpenSSL-Universal/Static (= 1.0.2.19) 72 | - OpenSSL-Universal/Static (1.0.2.19) 73 | - RCTRequired (0.63.2) 74 | - RCTTypeSafety (0.63.2): 75 | - FBLazyVector (= 0.63.2) 76 | - Folly (= 2020.01.13.00) 77 | - RCTRequired (= 0.63.2) 78 | - React-Core (= 0.63.2) 79 | - React (0.63.2): 80 | - React-Core (= 0.63.2) 81 | - React-Core/DevSupport (= 0.63.2) 82 | - React-Core/RCTWebSocket (= 0.63.2) 83 | - React-RCTActionSheet (= 0.63.2) 84 | - React-RCTAnimation (= 0.63.2) 85 | - React-RCTBlob (= 0.63.2) 86 | - React-RCTImage (= 0.63.2) 87 | - React-RCTLinking (= 0.63.2) 88 | - React-RCTNetwork (= 0.63.2) 89 | - React-RCTSettings (= 0.63.2) 90 | - React-RCTText (= 0.63.2) 91 | - React-RCTVibration (= 0.63.2) 92 | - React-callinvoker (0.63.2) 93 | - React-Core (0.63.2): 94 | - Folly (= 2020.01.13.00) 95 | - glog 96 | - React-Core/Default (= 0.63.2) 97 | - React-cxxreact (= 0.63.2) 98 | - React-jsi (= 0.63.2) 99 | - React-jsiexecutor (= 0.63.2) 100 | - Yoga 101 | - React-Core/CoreModulesHeaders (0.63.2): 102 | - Folly (= 2020.01.13.00) 103 | - glog 104 | - React-Core/Default 105 | - React-cxxreact (= 0.63.2) 106 | - React-jsi (= 0.63.2) 107 | - React-jsiexecutor (= 0.63.2) 108 | - Yoga 109 | - React-Core/Default (0.63.2): 110 | - Folly (= 2020.01.13.00) 111 | - glog 112 | - React-cxxreact (= 0.63.2) 113 | - React-jsi (= 0.63.2) 114 | - React-jsiexecutor (= 0.63.2) 115 | - Yoga 116 | - React-Core/DevSupport (0.63.2): 117 | - Folly (= 2020.01.13.00) 118 | - glog 119 | - React-Core/Default (= 0.63.2) 120 | - React-Core/RCTWebSocket (= 0.63.2) 121 | - React-cxxreact (= 0.63.2) 122 | - React-jsi (= 0.63.2) 123 | - React-jsiexecutor (= 0.63.2) 124 | - React-jsinspector (= 0.63.2) 125 | - Yoga 126 | - React-Core/RCTActionSheetHeaders (0.63.2): 127 | - Folly (= 2020.01.13.00) 128 | - glog 129 | - React-Core/Default 130 | - React-cxxreact (= 0.63.2) 131 | - React-jsi (= 0.63.2) 132 | - React-jsiexecutor (= 0.63.2) 133 | - Yoga 134 | - React-Core/RCTAnimationHeaders (0.63.2): 135 | - Folly (= 2020.01.13.00) 136 | - glog 137 | - React-Core/Default 138 | - React-cxxreact (= 0.63.2) 139 | - React-jsi (= 0.63.2) 140 | - React-jsiexecutor (= 0.63.2) 141 | - Yoga 142 | - React-Core/RCTBlobHeaders (0.63.2): 143 | - Folly (= 2020.01.13.00) 144 | - glog 145 | - React-Core/Default 146 | - React-cxxreact (= 0.63.2) 147 | - React-jsi (= 0.63.2) 148 | - React-jsiexecutor (= 0.63.2) 149 | - Yoga 150 | - React-Core/RCTImageHeaders (0.63.2): 151 | - Folly (= 2020.01.13.00) 152 | - glog 153 | - React-Core/Default 154 | - React-cxxreact (= 0.63.2) 155 | - React-jsi (= 0.63.2) 156 | - React-jsiexecutor (= 0.63.2) 157 | - Yoga 158 | - React-Core/RCTLinkingHeaders (0.63.2): 159 | - Folly (= 2020.01.13.00) 160 | - glog 161 | - React-Core/Default 162 | - React-cxxreact (= 0.63.2) 163 | - React-jsi (= 0.63.2) 164 | - React-jsiexecutor (= 0.63.2) 165 | - Yoga 166 | - React-Core/RCTNetworkHeaders (0.63.2): 167 | - Folly (= 2020.01.13.00) 168 | - glog 169 | - React-Core/Default 170 | - React-cxxreact (= 0.63.2) 171 | - React-jsi (= 0.63.2) 172 | - React-jsiexecutor (= 0.63.2) 173 | - Yoga 174 | - React-Core/RCTSettingsHeaders (0.63.2): 175 | - Folly (= 2020.01.13.00) 176 | - glog 177 | - React-Core/Default 178 | - React-cxxreact (= 0.63.2) 179 | - React-jsi (= 0.63.2) 180 | - React-jsiexecutor (= 0.63.2) 181 | - Yoga 182 | - React-Core/RCTTextHeaders (0.63.2): 183 | - Folly (= 2020.01.13.00) 184 | - glog 185 | - React-Core/Default 186 | - React-cxxreact (= 0.63.2) 187 | - React-jsi (= 0.63.2) 188 | - React-jsiexecutor (= 0.63.2) 189 | - Yoga 190 | - React-Core/RCTVibrationHeaders (0.63.2): 191 | - Folly (= 2020.01.13.00) 192 | - glog 193 | - React-Core/Default 194 | - React-cxxreact (= 0.63.2) 195 | - React-jsi (= 0.63.2) 196 | - React-jsiexecutor (= 0.63.2) 197 | - Yoga 198 | - React-Core/RCTWebSocket (0.63.2): 199 | - Folly (= 2020.01.13.00) 200 | - glog 201 | - React-Core/Default (= 0.63.2) 202 | - React-cxxreact (= 0.63.2) 203 | - React-jsi (= 0.63.2) 204 | - React-jsiexecutor (= 0.63.2) 205 | - Yoga 206 | - React-CoreModules (0.63.2): 207 | - FBReactNativeSpec (= 0.63.2) 208 | - Folly (= 2020.01.13.00) 209 | - RCTTypeSafety (= 0.63.2) 210 | - React-Core/CoreModulesHeaders (= 0.63.2) 211 | - React-jsi (= 0.63.2) 212 | - React-RCTImage (= 0.63.2) 213 | - ReactCommon/turbomodule/core (= 0.63.2) 214 | - React-cxxreact (0.63.2): 215 | - boost-for-react-native (= 1.63.0) 216 | - DoubleConversion 217 | - Folly (= 2020.01.13.00) 218 | - glog 219 | - React-callinvoker (= 0.63.2) 220 | - React-jsinspector (= 0.63.2) 221 | - React-jsi (0.63.2): 222 | - boost-for-react-native (= 1.63.0) 223 | - DoubleConversion 224 | - Folly (= 2020.01.13.00) 225 | - glog 226 | - React-jsi/Default (= 0.63.2) 227 | - React-jsi/Default (0.63.2): 228 | - boost-for-react-native (= 1.63.0) 229 | - DoubleConversion 230 | - Folly (= 2020.01.13.00) 231 | - glog 232 | - React-jsiexecutor (0.63.2): 233 | - DoubleConversion 234 | - Folly (= 2020.01.13.00) 235 | - glog 236 | - React-cxxreact (= 0.63.2) 237 | - React-jsi (= 0.63.2) 238 | - React-jsinspector (0.63.2) 239 | - react-native-viewpager (4.1.6): 240 | - React 241 | - React-RCTActionSheet (0.63.2): 242 | - React-Core/RCTActionSheetHeaders (= 0.63.2) 243 | - React-RCTAnimation (0.63.2): 244 | - FBReactNativeSpec (= 0.63.2) 245 | - Folly (= 2020.01.13.00) 246 | - RCTTypeSafety (= 0.63.2) 247 | - React-Core/RCTAnimationHeaders (= 0.63.2) 248 | - React-jsi (= 0.63.2) 249 | - ReactCommon/turbomodule/core (= 0.63.2) 250 | - React-RCTBlob (0.63.2): 251 | - FBReactNativeSpec (= 0.63.2) 252 | - Folly (= 2020.01.13.00) 253 | - React-Core/RCTBlobHeaders (= 0.63.2) 254 | - React-Core/RCTWebSocket (= 0.63.2) 255 | - React-jsi (= 0.63.2) 256 | - React-RCTNetwork (= 0.63.2) 257 | - ReactCommon/turbomodule/core (= 0.63.2) 258 | - React-RCTImage (0.63.2): 259 | - FBReactNativeSpec (= 0.63.2) 260 | - Folly (= 2020.01.13.00) 261 | - RCTTypeSafety (= 0.63.2) 262 | - React-Core/RCTImageHeaders (= 0.63.2) 263 | - React-jsi (= 0.63.2) 264 | - React-RCTNetwork (= 0.63.2) 265 | - ReactCommon/turbomodule/core (= 0.63.2) 266 | - React-RCTLinking (0.63.2): 267 | - FBReactNativeSpec (= 0.63.2) 268 | - React-Core/RCTLinkingHeaders (= 0.63.2) 269 | - React-jsi (= 0.63.2) 270 | - ReactCommon/turbomodule/core (= 0.63.2) 271 | - React-RCTNetwork (0.63.2): 272 | - FBReactNativeSpec (= 0.63.2) 273 | - Folly (= 2020.01.13.00) 274 | - RCTTypeSafety (= 0.63.2) 275 | - React-Core/RCTNetworkHeaders (= 0.63.2) 276 | - React-jsi (= 0.63.2) 277 | - ReactCommon/turbomodule/core (= 0.63.2) 278 | - React-RCTSettings (0.63.2): 279 | - FBReactNativeSpec (= 0.63.2) 280 | - Folly (= 2020.01.13.00) 281 | - RCTTypeSafety (= 0.63.2) 282 | - React-Core/RCTSettingsHeaders (= 0.63.2) 283 | - React-jsi (= 0.63.2) 284 | - ReactCommon/turbomodule/core (= 0.63.2) 285 | - React-RCTText (0.63.2): 286 | - React-Core/RCTTextHeaders (= 0.63.2) 287 | - React-RCTVibration (0.63.2): 288 | - FBReactNativeSpec (= 0.63.2) 289 | - Folly (= 2020.01.13.00) 290 | - React-Core/RCTVibrationHeaders (= 0.63.2) 291 | - React-jsi (= 0.63.2) 292 | - ReactCommon/turbomodule/core (= 0.63.2) 293 | - ReactCommon/turbomodule/core (0.63.2): 294 | - DoubleConversion 295 | - Folly (= 2020.01.13.00) 296 | - glog 297 | - React-callinvoker (= 0.63.2) 298 | - React-Core (= 0.63.2) 299 | - React-cxxreact (= 0.63.2) 300 | - React-jsi (= 0.63.2) 301 | - RNGestureHandler (1.7.0): 302 | - React 303 | - RNReactNativeHapticFeedback (1.10.0): 304 | - React 305 | - RNReanimated (2.0.0-alpha.6): 306 | - DoubleConversion 307 | - FBLazyVector 308 | - FBReactNativeSpec 309 | - Folly 310 | - glog 311 | - RCTRequired 312 | - RCTTypeSafety 313 | - React 314 | - React-callinvoker 315 | - React-Core 316 | - React-Core/DevSupport 317 | - React-Core/RCTWebSocket 318 | - React-CoreModules 319 | - React-cxxreact 320 | - React-jsi 321 | - React-jsiexecutor 322 | - React-jsinspector 323 | - React-RCTActionSheet 324 | - React-RCTAnimation 325 | - React-RCTBlob 326 | - React-RCTImage 327 | - React-RCTLinking 328 | - React-RCTNetwork 329 | - React-RCTSettings 330 | - React-RCTText 331 | - React-RCTVibration 332 | - ReactCommon/turbomodule/core 333 | - Yoga 334 | - RNSVG (12.1.0): 335 | - React 336 | - Yoga (1.14.0) 337 | - YogaKit (1.18.1): 338 | - Yoga (~> 1.14) 339 | 340 | DEPENDENCIES: 341 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) 342 | - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) 343 | - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`) 344 | - Flipper (~> 0.41.1) 345 | - Flipper-DoubleConversion (= 1.1.7) 346 | - Flipper-Folly (~> 2.2) 347 | - Flipper-Glog (= 0.3.6) 348 | - Flipper-PeerTalk (~> 0.0.4) 349 | - Flipper-RSocket (~> 1.1) 350 | - FlipperKit (~> 0.41.1) 351 | - FlipperKit/Core (~> 0.41.1) 352 | - FlipperKit/CppBridge (~> 0.41.1) 353 | - FlipperKit/FBCxxFollyDynamicConvert (~> 0.41.1) 354 | - FlipperKit/FBDefines (~> 0.41.1) 355 | - FlipperKit/FKPortForwarding (~> 0.41.1) 356 | - FlipperKit/FlipperKitHighlightOverlay (~> 0.41.1) 357 | - FlipperKit/FlipperKitLayoutPlugin (~> 0.41.1) 358 | - FlipperKit/FlipperKitLayoutTextSearchable (~> 0.41.1) 359 | - FlipperKit/FlipperKitNetworkPlugin (~> 0.41.1) 360 | - FlipperKit/FlipperKitReactPlugin (~> 0.41.1) 361 | - FlipperKit/FlipperKitUserDefaultsPlugin (~> 0.41.1) 362 | - FlipperKit/SKIOSNetworkPlugin (~> 0.41.1) 363 | - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`) 364 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) 365 | - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) 366 | - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) 367 | - React (from `../node_modules/react-native/`) 368 | - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`) 369 | - React-Core (from `../node_modules/react-native/`) 370 | - React-Core/DevSupport (from `../node_modules/react-native/`) 371 | - React-Core/RCTWebSocket (from `../node_modules/react-native/`) 372 | - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) 373 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) 374 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) 375 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) 376 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) 377 | - "react-native-viewpager (from `../node_modules/@react-native-community/viewpager`)" 378 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) 379 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) 380 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) 381 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`) 382 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) 383 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) 384 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) 385 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`) 386 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) 387 | - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) 388 | - RNGestureHandler (from `../node_modules/react-native-gesture-handler`) 389 | - RNReactNativeHapticFeedback (from `../node_modules/react-native-haptic-feedback`) 390 | - RNReanimated (from `../node_modules/react-native-reanimated`) 391 | - RNSVG (from `../node_modules/react-native-svg`) 392 | - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) 393 | 394 | SPEC REPOS: 395 | trunk: 396 | - boost-for-react-native 397 | - CocoaAsyncSocket 398 | - CocoaLibEvent 399 | - Flipper 400 | - Flipper-DoubleConversion 401 | - Flipper-Folly 402 | - Flipper-Glog 403 | - Flipper-PeerTalk 404 | - Flipper-RSocket 405 | - FlipperKit 406 | - OpenSSL-Universal 407 | - YogaKit 408 | 409 | EXTERNAL SOURCES: 410 | DoubleConversion: 411 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" 412 | FBLazyVector: 413 | :path: "../node_modules/react-native/Libraries/FBLazyVector" 414 | FBReactNativeSpec: 415 | :path: "../node_modules/react-native/Libraries/FBReactNativeSpec" 416 | Folly: 417 | :podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec" 418 | glog: 419 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" 420 | RCTRequired: 421 | :path: "../node_modules/react-native/Libraries/RCTRequired" 422 | RCTTypeSafety: 423 | :path: "../node_modules/react-native/Libraries/TypeSafety" 424 | React: 425 | :path: "../node_modules/react-native/" 426 | React-callinvoker: 427 | :path: "../node_modules/react-native/ReactCommon/callinvoker" 428 | React-Core: 429 | :path: "../node_modules/react-native/" 430 | React-CoreModules: 431 | :path: "../node_modules/react-native/React/CoreModules" 432 | React-cxxreact: 433 | :path: "../node_modules/react-native/ReactCommon/cxxreact" 434 | React-jsi: 435 | :path: "../node_modules/react-native/ReactCommon/jsi" 436 | React-jsiexecutor: 437 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor" 438 | React-jsinspector: 439 | :path: "../node_modules/react-native/ReactCommon/jsinspector" 440 | react-native-viewpager: 441 | :path: "../node_modules/@react-native-community/viewpager" 442 | React-RCTActionSheet: 443 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS" 444 | React-RCTAnimation: 445 | :path: "../node_modules/react-native/Libraries/NativeAnimation" 446 | React-RCTBlob: 447 | :path: "../node_modules/react-native/Libraries/Blob" 448 | React-RCTImage: 449 | :path: "../node_modules/react-native/Libraries/Image" 450 | React-RCTLinking: 451 | :path: "../node_modules/react-native/Libraries/LinkingIOS" 452 | React-RCTNetwork: 453 | :path: "../node_modules/react-native/Libraries/Network" 454 | React-RCTSettings: 455 | :path: "../node_modules/react-native/Libraries/Settings" 456 | React-RCTText: 457 | :path: "../node_modules/react-native/Libraries/Text" 458 | React-RCTVibration: 459 | :path: "../node_modules/react-native/Libraries/Vibration" 460 | ReactCommon: 461 | :path: "../node_modules/react-native/ReactCommon" 462 | RNGestureHandler: 463 | :path: "../node_modules/react-native-gesture-handler" 464 | RNReactNativeHapticFeedback: 465 | :path: "../node_modules/react-native-haptic-feedback" 466 | RNReanimated: 467 | :path: "../node_modules/react-native-reanimated" 468 | RNSVG: 469 | :path: "../node_modules/react-native-svg" 470 | Yoga: 471 | :path: "../node_modules/react-native/ReactCommon/yoga" 472 | 473 | SPEC CHECKSUMS: 474 | boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c 475 | CocoaAsyncSocket: 694058e7c0ed05a9e217d1b3c7ded962f4180845 476 | CocoaLibEvent: 2fab71b8bd46dd33ddb959f7928ec5909f838e3f 477 | DoubleConversion: cde416483dac037923206447da6e1454df403714 478 | FBLazyVector: 3ef4a7f62e7db01092f9d517d2ebc0d0677c4a37 479 | FBReactNativeSpec: dc7fa9088f0f2a998503a352b0554d69a4391c5a 480 | Flipper: 33585e2d9810fe5528346be33bcf71b37bb7ae13 481 | Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41 482 | Flipper-Folly: c12092ea368353b58e992843a990a3225d4533c3 483 | Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6 484 | Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9 485 | Flipper-RSocket: 64e7431a55835eb953b0bf984ef3b90ae9fdddd7 486 | FlipperKit: bc68102cd4952a258a23c9c1b316c7bec1fecf83 487 | Folly: b73c3869541e86821df3c387eb0af5f65addfab4 488 | glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3 489 | OpenSSL-Universal: 8b48cc0d10c1b2923617dfe5c178aa9ed2689355 490 | RCTRequired: f13f25e7b12f925f1f6a6a8c69d929a03c0129fe 491 | RCTTypeSafety: 44982c5c8e43ff4141eb519a8ddc88059acd1f3a 492 | React: e1c65dd41cb9db13b99f24608e47dd595f28ca9a 493 | React-callinvoker: 552a6a6bc8b3bb794cf108ad59e5a9e2e3b4fc98 494 | React-Core: 9d341e725dc9cd2f49e4c49ad1fc4e8776aa2639 495 | React-CoreModules: 5335e168165da7f7083ce7147768d36d3e292318 496 | React-cxxreact: d3261ec5f7d11743fbf21e263a34ea51d1f13ebc 497 | React-jsi: 54245e1d5f4b690dec614a73a3795964eeef13a8 498 | React-jsiexecutor: 8ca588cc921e70590820ce72b8789b02c67cce38 499 | React-jsinspector: b14e62ebe7a66e9231e9581279909f2fc3db6606 500 | react-native-viewpager: f44c9e21c37d4cb76d38841c8a450e3891923461 501 | React-RCTActionSheet: 910163b6b09685a35c4ebbc52b66d1bfbbe39fc5 502 | React-RCTAnimation: 9a883bbe1e9d2e158d4fb53765ed64c8dc2200c6 503 | React-RCTBlob: 39cf0ece1927996c4466510e25d2105f67010e13 504 | React-RCTImage: de355d738727b09ad3692f2a979affbd54b5f378 505 | React-RCTLinking: 8122f221d395a63364b2c0078ce284214bd04575 506 | React-RCTNetwork: 8f96c7b49ea6a0f28f98258f347b6ad218bc0830 507 | React-RCTSettings: 8a49622aff9c1925f5455fa340b6fe4853d64ab6 508 | React-RCTText: 1b6773e776e4b33f90468c20fe3b16ca3e224bb8 509 | React-RCTVibration: 4d2e726957f4087449739b595f107c0d4b6c2d2d 510 | ReactCommon: a0a1edbebcac5e91338371b72ffc66aa822792ce 511 | RNGestureHandler: b6b359bb800ae399a9c8b27032bdbf7c18f08a08 512 | RNReactNativeHapticFeedback: 22c5ecf474428766c6b148f96f2ff6155cd7225e 513 | RNReanimated: 6bd3347e383cee6eb879a1a7d6c748934a015a05 514 | RNSVG: ce9d996113475209013317e48b05c21ee988d42e 515 | Yoga: 7740b94929bbacbddda59bf115b5317e9a161598 516 | YogaKit: f782866e155069a2cca2517aafea43200b01fd5a 517 | 518 | PODFILE CHECKSUM: e25a4f49fb371e2f341db9dc0893d6e999552221 519 | 520 | COCOAPODS: 1.9.1 521 | -------------------------------------------------------------------------------- /Example/metro.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = { 4 | transformer: { 5 | getTransformOptions: async () => ({ 6 | transform: { 7 | experimentalImportSupport: false, 8 | inlineRequires: false, 9 | }, 10 | }), 11 | }, 12 | watchFolders: [path.resolve(__dirname, '..')], 13 | }; 14 | -------------------------------------------------------------------------------- /Example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Example", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios", 8 | "start": "react-native start", 9 | "test": "jest" 10 | }, 11 | "dependencies": { 12 | "@react-native-community/viewpager": "^4.1.6", 13 | "babel-plugin-module-resolver": "^4.0.0", 14 | "bignumber.js": "^9.0.0", 15 | "chroma-js": "^2.1.0", 16 | "lodash": "^4.17.20", 17 | "react": "16.13.1", 18 | "react-coin-icon": "^0.1.19", 19 | "react-native": "0.63.2", 20 | "react-native-gesture-handler": "^1.7.0", 21 | "react-native-haptic-feedback": "^1.10.0", 22 | "react-native-reanimated": "^2.0.0-alpha.6", 23 | "react-native-redash": "^14.2.4", 24 | "react-native-shadow-stack": "^0.0.5", 25 | "react-native-svg": "^12.1.0", 26 | "styled-components": "^5.1.1" 27 | }, 28 | "devDependencies": { 29 | "@babel/core": "^7.11.4", 30 | "@babel/runtime": "^7.11.2", 31 | "babel-jest": "^26.3.0", 32 | "babel-plugin-styled-components": "^1.11.1", 33 | "glob-to-regexp": "^0.4.1", 34 | "jest": "^26.4.2", 35 | "metro-react-native-babel-preset": "^0.63.0", 36 | "react-test-renderer": "16.13.1" 37 | }, 38 | "jest": { 39 | "preset": "react-native" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Example/src/BasicExample/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {Dimensions, View} from 'react-native'; 3 | import { 4 | ChartDot, 5 | ChartPath, 6 | ChartPathProvider, 7 | monotoneCubicInterpolation, 8 | } from '@rainbow-me/animated-charts'; 9 | 10 | export const {width: SIZE} = Dimensions.get('window'); 11 | 12 | export const data = [ 13 | {x: 1453075200, y: 1.47}, 14 | {x: 1453161600, y: 1.37}, 15 | {x: 1453248000, y: 1.53}, 16 | {x: 1453334400, y: 1.54}, 17 | {x: 1453420800, y: 1.52}, 18 | {x: 1453507200, y: 2.03}, 19 | {x: 1453593600, y: 2.1}, 20 | {x: 1453680000, y: 2.5}, 21 | {x: 1453766400, y: 2.3}, 22 | {x: 1453852800, y: 2.42}, 23 | {x: 1453939200, y: 2.55}, 24 | {x: 1454025600, y: 2.41}, 25 | {x: 1454112000, y: 2.43}, 26 | {x: 1454198400, y: 2.2}, 27 | ]; 28 | 29 | const points = monotoneCubicInterpolation(data)(40); 30 | 31 | const BasicExample = () => ( 32 | 36 | 41 | 42 | 47 | 48 | 49 | ); 50 | 51 | export default BasicExample; 52 | -------------------------------------------------------------------------------- /Example/src/GenericExample/data.js: -------------------------------------------------------------------------------- 1 | import {data1 as rawData1, data2 as rawData2} from './rawData'; 2 | 3 | export const data1 = rawData1.map(([x, y]) => ({x, y})); 4 | export const data2 = rawData2.map(([x, y]) => ({x, y})); 5 | -------------------------------------------------------------------------------- /Example/src/GenericExample/index.js: -------------------------------------------------------------------------------- 1 | import React, {useEffect, useState} from 'react'; 2 | import { 3 | Dimensions, 4 | ScrollView, 5 | Text, 6 | TouchableOpacity, 7 | View, 8 | } from 'react-native'; 9 | import bSplineInterpolation from '../../../src/interpolations/bSplineInterpolation'; 10 | import {data1, data2} from './data'; 11 | import { 12 | ChartDot, 13 | ChartPath, 14 | ChartPathProvider, 15 | ChartXLabel, 16 | ChartYLabel, 17 | monotoneCubicInterpolation, 18 | simplifyData, 19 | } from '@rainbow-me/animated-charts'; 20 | 21 | export const {width: SIZE} = Dimensions.get('window'); 22 | 23 | export const formatUSD = value => { 24 | 'worklet'; 25 | if (value === '') { 26 | return ''; 27 | } 28 | return `$ ${value.toLocaleString('en-US', { 29 | currency: 'USD', 30 | })}`; 31 | }; 32 | 33 | export const formatDatetime = value => { 34 | 'worklet'; 35 | if (value === '') { 36 | return ''; 37 | } 38 | const date = new Date(Number(value * 1000)); 39 | const s = date.getSeconds(); 40 | const m = date.getMinutes(); 41 | const h = date.getHours(); 42 | const d = date.getDate(); 43 | const n = date.getMonth(); 44 | const y = date.getFullYear(); 45 | return `${y}-${n}-${d} ${h}:${m}:${s}`; 46 | }; 47 | 48 | function GenericExample() { 49 | const [ 50 | disableSmoothingWhileTransitioning, 51 | setDisableSmoothingWhileTransitioning, 52 | ] = useState(false); 53 | const [enableHaptics, setEnableHaptics] = useState(false); 54 | const [data, setData] = useState({points: data1}); 55 | const [dataSource, setDataSource] = useState(1); 56 | const [simplifying, setSimplifying] = useState(false); 57 | const [pickRange, setPickRange] = useState(10); 58 | const [includeExtremes, setIncludeExtremes] = useState(true); 59 | const [interpolationStrategy, setInterpolationStrategy] = useState('b'); 60 | const [numberOfPointsInterpolated, setNumberOfPointsInterpolated] = useState( 61 | 80 62 | ); 63 | const [bSplineDegree, setBSplineDegree] = useState(3); 64 | const [smoothingStrategy, setSmoothingStrategy] = useState('none'); 65 | const [smoothingFactor, setSmoothingFactor] = useState(0.05); 66 | const [softMargin, setSoftMargin] = useState(30); 67 | 68 | useEffect(() => { 69 | const rawData = dataSource === 1 ? data1 : data2; 70 | const simplifiedData = simplifying 71 | ? simplifyData(rawData, pickRange, includeExtremes) 72 | : rawData; 73 | const intepolatedData = (() => { 74 | // eslint-disable-next-line default-case 75 | switch (interpolationStrategy) { 76 | case 'none': 77 | return simplifiedData; 78 | case 'b': 79 | return bSplineInterpolation( 80 | simplifiedData, 81 | bSplineDegree 82 | )(numberOfPointsInterpolated); 83 | case 'mono': 84 | return monotoneCubicInterpolation(simplifiedData)( 85 | numberOfPointsInterpolated 86 | ); 87 | } 88 | })(); 89 | const data = { 90 | points: intepolatedData, 91 | smoothingFactor: smoothingStrategy === 'none' ? 0 : smoothingFactor, 92 | smoothingStrategy, 93 | }; 94 | setData(data); 95 | }, [ 96 | bSplineDegree, 97 | dataSource, 98 | includeExtremes, 99 | interpolationStrategy, 100 | numberOfPointsInterpolated, 101 | pickRange, 102 | simplifying, 103 | smoothingFactor, 104 | smoothingStrategy, 105 | ]); 106 | 107 | return ( 108 | 112 | 113 | {/**/} 114 | {/* Generic Example (swipe right for a real-life example)*/} 115 | {/**/} 116 | 120 | 130 | 135 | 139 | 143 | 144 | Haptics: 145 | 146 | setEnableHaptics(true)}> 147 | 151 | Yes 152 | 153 | 154 | setEnableHaptics(false)}> 155 | 159 | No 160 | 161 | 162 | 163 | 164 | Disable smoothing while transitioning: 165 | 166 | 167 | setDisableSmoothingWhileTransitioning(true)}> 169 | 175 | Yes 176 | 177 | 178 | setDisableSmoothingWhileTransitioning(false)}> 180 | 186 | No 187 | 188 | 189 | 190 | Soft margin: 191 | 192 | setSoftMargin(0)}> 193 | 197 | 0 198 | 199 | 200 | setSoftMargin(30)}> 201 | 205 | 30 206 | 207 | 208 | setSoftMargin(50)}> 209 | 213 | 50 214 | 215 | 216 | 217 | Data source: 218 | 219 | setDataSource(1)}> 220 | 221 | Data 1 222 | 223 | 224 | setDataSource(2)}> 225 | 226 | Data 2 227 | 228 | 229 | 230 | Simplifying: 231 | 232 | setSimplifying(true)}> 233 | 234 | Yes 235 | 236 | 237 | setSimplifying(false)}> 238 | 239 | No 240 | 241 | 242 | 243 | {simplifying ? ( 244 | <> 245 | 246 | Pick range: 247 | 248 | 250 | setPickRange(2)}> 251 | 252 | 2 253 | 254 | 255 | setPickRange(5)}> 256 | 257 | 5 258 | 259 | 260 | setPickRange(10)}> 261 | 263 | 10 264 | 265 | 266 | setPickRange(25)}> 267 | 269 | 25 270 | 271 | 272 | 273 | 274 | Include extremes: 275 | 276 | 278 | setIncludeExtremes(true)}> 279 | 280 | Yes 281 | 282 | 283 | setIncludeExtremes(false)}> 284 | 286 | No 287 | 288 | 289 | 290 | 291 | ) : null} 292 | 293 | Interpolation strategy: 294 | 295 | 296 | setInterpolationStrategy('none')}> 297 | 302 | None 303 | 304 | 305 | setInterpolationStrategy('b')}> 306 | 310 | B Spline 311 | 312 | 313 | setInterpolationStrategy('mono')}> 314 | 319 | Monotone Qubic Spline 320 | 321 | 322 | 323 | {interpolationStrategy === 'b' ? ( 324 | <> 325 | 326 | BSpline degree: 327 | 328 | 330 | setBSplineDegree(2)}> 331 | 335 | 2 336 | 337 | 338 | setBSplineDegree(3)}> 339 | 343 | 3 344 | 345 | 346 | setBSplineDegree(4)}> 347 | 351 | 4 352 | 353 | 354 | setBSplineDegree(5)}> 355 | 359 | 5 360 | 361 | 362 | 363 | 364 | ) : null} 365 | {interpolationStrategy !== 'none' ? ( 366 | <> 367 | 368 | Number of points Interpolated: 369 | 370 | 372 | setNumberOfPointsInterpolated(30)}> 374 | 381 | 30 382 | 383 | 384 | setNumberOfPointsInterpolated(80)}> 386 | 393 | 80 394 | 395 | 396 | setNumberOfPointsInterpolated(120)}> 398 | 405 | 120 406 | 407 | 408 | setNumberOfPointsInterpolated(200)}> 410 | 417 | 200 418 | 419 | 420 | 421 | 422 | ) : null} 423 | 424 | Smoothing strategy: 425 | 426 | 427 | setSmoothingStrategy('none')}> 428 | 432 | None 433 | 434 | 435 | setSmoothingStrategy('simple')}> 436 | 440 | Simple (Quadratic bezier with fixed points) 441 | 442 | 443 | 444 | 445 | setSmoothingStrategy('complex')}> 446 | 450 | Complex (Cubic bezier) 451 | 452 | 453 | setSmoothingStrategy('bezier')}> 454 | 458 | Bezier 459 | 460 | 461 | 462 | {smoothingStrategy !== 'none' && smoothingStrategy !== 'bezier' ? ( 463 | <> 464 | 465 | Smoothing factor: 466 | 467 | 469 | setSmoothingFactor(0.05)}> 470 | 474 | 0.05 475 | 476 | 477 | setSmoothingFactor(0.1)}> 478 | 482 | 0.1 483 | 484 | 485 | setSmoothingFactor(0.2)}> 486 | 490 | 0.2 491 | 492 | 493 | setSmoothingFactor(0.3)}> 494 | 498 | 0.3 499 | 500 | 501 | setSmoothingFactor(0.5)}> 502 | 506 | 0.5 507 | 508 | 509 | setSmoothingFactor(0.7)}> 510 | 514 | 0.7 515 | 516 | 517 | setSmoothingFactor(0.9)}> 518 | 522 | 0.9 523 | 524 | 525 | 526 | 527 | ) : null} 528 | 529 | 530 | ); 531 | } 532 | 533 | export default GenericExample; 534 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |

React Native Animated Charts

3 |

Set of components and helpers for building complex and beautifully animated charts.

4 |

5 | 6 | ![](gifs/ios.gif) | ![](gifs/android.gif) | 7 | :----------------:|:---------------------:| 8 | 9 | The library was designed to create aesthetic, animated (so far only linear) charts based on a given input. 10 | The main assumptions of the library were to create smooth transitions between subsequent data sets. For this reason, 11 | we have discovered a shortage of existing libraries related to the charts. 12 | The current package was created as part of the [Rainbow.me project](https://rainbow.me/) and for this reason it was not designed as a complete and comprehensive solution for displaying various types of charts. However, we will be now using more charts in the whole application, so we believe that the number of functionalities in the application will gradually grow. 13 | 14 | Additionally, we are open to new Pull Requests. We want this library to become popular and complete thanks to community activity. 15 | 16 | It's a part of the [Rainbow.me project](https://rainbow.me/). 17 | 18 | ## TODO 19 | The library has been released in a production-ready version. 20 | We use it inside the [Rainbow.me project](https://rainbow.me/) so it's verified for use in production. 21 | However, it relies on [React Native Reanimated 2.0](https://docs.swmansion.com/react-native-reanimated/) in the alpha version thus it might not work perfectly. 22 | Test it deeply before using it. Until the stable release of Reanimated, I think it's worth not marking this library as stable. 23 | Although the library works with Reanimated without any changes, we faced a few issues related to our (quite advanced) usage of the library. 24 | Thus we made some hacks we're not very proud of and it's for 99% something you should not do. However, if you see some crashes, you may try one of our hacks. 25 | 26 | There're a few things left to make it polished regarding linear charts: 27 | - [ ] cleanup API. `ChartProvider` and `ChartPath` have been split for two components to separated responsibilities of providing data and displaying charts. 28 | I'm still not sure if it's a good move so we can decide to move some props from one to another or connect them inside one component. 29 | - [ ] Support for gestures - pinching, swiping, etc. 30 | - [ ] more parameters regarding interpolation, smoothing, and animations (i.e. allow to override `springConfig` and `timingConfig`) 31 | 32 | 33 | ## Installation 34 | 35 | 1. Install [react-native-reanimated](https://docs.swmansion.com/react-native-reanimated/docs/next/installation) in the newest version. 36 | 2. 37 | ```bash 38 | yarn add @rainbow-me/animated-charts 39 | npm i @rainbow-me/animated-charts 40 | ``` 41 | 3. If you want to use haptic feedback on the press in / out, install 42 | ```bash 43 | yarn add react-native-haptic-feedback 44 | npm i react-native-haptic-feedback 45 | ``` 46 | 47 | The library is verified on `2.0.0-alpha.6` version of reanimated. 48 | 49 | ### Reanimated 50 | Using TurboModules might have an impact on your current development flow and most likely 51 | you don't want to decrease your DX. Since we're not using reanimated in other places in the app, we 52 | made some tweaks to disable charts in development mode with compilation macros on iOS. 53 | You can find it [here](https://github.com/rainbow-me/rainbow/blob/develop/ios/Rainbow/AppDelegate.mm) 54 | 55 | Also, because we're using libraries which currently do not support reanimated 2, 56 | we [patched exports in reanimated](https://github.com/rainbow-me/rainbow/tree/develop/patches) 57 | 58 | Furthermore, we found few differences in how the `Animated` module works with and without TurboModules support, so 59 | we [made a trick](https://github.com/rainbow-me/rainbow/tree/develop/patches) to fallback to the not-TM version of Animated. 60 | 61 | Most likely, you don't need any of those patches. 62 | 63 | ## Example app 64 | We made a generic example to show briefly what's possible to achieve with this library. 65 | A Real-life example is available inside [Rainbow](https://github.com/rainbow-me)! 66 | 67 | In order to run an example clone this repo and navigate to `Example` then: 68 | ``` 69 | yarn && cd ios && pod install && cd .. 70 | react-native run-android 71 | react-native run-ios 72 | ``` 73 | 74 | ## API 75 | The library has been designed to provide as much flexibility as possible with the component-based API for easy integration with existing applications. 76 | 77 | ### Basic API Example 78 | ```jsx 79 | import React from 'react'; 80 | import {Dimensions, View} from 'react-native'; 81 | import {ChartDot, ChartPath, ChartPathProvider, monotoneCubicInterpolation} from '@rainbow-me/animated-charts'; 82 | 83 | export const {width: SIZE} = Dimensions.get('window'); 84 | 85 | export const data = [ 86 | {x: 1453075200, y: 1.47}, {x: 1453161600, y: 1.37}, 87 | {x: 1453248000, y: 1.53}, {x: 1453334400, y: 1.54}, 88 | {x: 1453420800, y: 1.52}, {x: 1453507200, y: 2.03}, 89 | {x: 1453593600, y: 2.10}, {x: 1453680000, y: 2.50}, 90 | {x: 1453766400, y: 2.30}, {x: 1453852800, y: 2.42}, 91 | {x: 1453939200, y: 2.55}, {x: 1454025600, y: 2.41}, 92 | {x: 1454112000, y: 2.43}, {x: 1454198400, y: 2.20}, 93 | ]; 94 | 95 | const points = monotoneCubicInterpolation(data)(40); 96 | 97 | const BasicExample = () => ( 98 | 99 | 100 | 101 | 102 | 103 | 104 | ); 105 | ``` 106 | 107 | The code above generates the chart below: 108 | 109 | ![](gifs/basic.png) 110 | 111 | ### Linear charts 112 | 113 | ### `ChartPathProvider` 114 | The whole chart's structure has to be wrapped with `ChartProvider`. It's responsible for data managing and itself does not have a visual impact on the layout. Under the hood, it uses context API to simplify manipulation with other components. The rule is to use one data series for each wrapper. 115 | 116 | | Prop name | type | default / obligatory | description | 117 | |-----------------|------------|------------------------|-------------| 118 | | `softMargin` | `number` | `0` | While scrubbing the chart touching edges of the screen you may want make points on the edges more accessible. With `softMargin` it's possible to access points on edges doubling the speed of scrubbing beyond this margin. | 119 | | `enableHaptics` | `boolean` | `false` | On pressing in/out on the chart it might be expected to make haptic feedback. It will happen with `enableHaptics` set to `true` and `react-native-haptic-feedback` installed | 120 | | `data` | { points: [Point], nativePoints: [Point], smoothingStrategy?: 'bezier'|'simple'|'complex', smoothingFactor } | obligatory | Object containing data structure and way to display them. Each of the properties is explained below. | 121 | | `springConfig` | object | `{damping: 15, mass: 1, stiffness: 600}` | Object [defining the spring animation](https://docs.swmansion.com/react-native-reanimated/docs/next/animations). This spring is used for a dot's scale. 122 | | `timingFeedbackConfig` | object | `{duration: 80}` | Object [defining the timing animation](https://docs.swmansion.com/react-native-reanimated/docs/next/animations). `timingFeedbackConfig` is used for a path's opacity and width. 123 | | `timingAnimationConfig` | object | `{duration: 300}` | Object [defining the timing animation](https://docs.swmansion.com/react-native-reanimated/docs/next/animations). `timingAnimationConfig` is used for the transition between chart's data. 124 | 125 | - `data` is an array containing points to be displayed. A `Point` is an object containing `x` and `y` as a number. 126 | - `nativeData` is an array of points that will not be drawn. However, if you used some strategy of interpolating data or simplifying you might want to present data slightly different from the real one. Then if you'd like labels to be fully correct you may want to provide real data before adjusting them. 127 | - `smoothingStrategy`. While presenting points path can be drawn with different approaches. 128 | - If `smoothingStrategy` is not provided (or set to any other value but for listed here), connects points using linear interpolation. 129 | - The `bezier` strategy connects points with a bezier path inspired by [d3 shape](https://github.com/d3/d3-shape/blob/master/src/curve/basis.js). It's not parametrized by `smoothingFactor`. 130 | - The `complex` strategy uses approach explained [here](https://medium.com/@francoisromain/smooth-a-svg-path-with-cubic-bezier-curves-e37b49d46c74) using cubic splines. It's parametrized by `smoothingFactor`. 131 | - The `simple` strategy is a bit simplified `complex` strategy using quadratic splines. It's parametrized by `smoothingFactor`. 132 | - `smoothingFactor`. Is a value from `0` to `1` defining how smooth a presentation should be. `0` means no smoothing, and it's the default. `smoothingFactor` has an impact if `smoothingStrategy` is `simple` or `complex`. 133 | 134 | ### `ChartPath` 135 | This component is used for showing the path itself. 136 | 137 | | Prop name | type | default / obligatory | description | 138 | |--------------------------------------|------------|------------------------|-------------| 139 | | `disableSmoothingWhileTransitioning` | `number` | `false` | Although smoothing is not complex computing, it might impact performance in some low-end devices so while having a big set of data it might be worth disable smoothing while transitioning. | 140 | | `height` | `number` | obligatory | Height od the SVG canvas | 141 | | `width` | `number` | obligatory | Width od the SVG canvas | 142 | | `strokeWidth` | `number` | `1` | Width of the path. | 143 | | `strokeWidthSelected` | `number` | `1` | Width of the path selected. | 144 | | `gestureEnabled` | `boolean` | `true` | Defines if interaction with the chart should be allowed or not | 145 | | `longPressGestureHandlerProps` | `object` | `{maxDist: 100000, minDurationMs: 0, shouldCancelWhenOutside: false}` | Under the hood we're using `LongPressGestureHandler` for handling interactions. It's recommended to not override its props. However, it might be useful while interacting with another GH. | 146 | | `selectedOpacity` | `number` | `0.7` | Target opacity of the path while touching the chart. 147 | | ...rest | `object` | `{}` | Props applied to SVG [Path](https://github.com/react-native-community/react-native-svg#path). | 148 | 149 | 150 | ### `ChartDot` 151 | Component for displaying the dot for scrubbing on the chart. 152 | 153 | | Prop name | type | default | description | 154 | |--------------|------------|---------|-------------| 155 | | `size` | `number` | `10` | Size of the dot. | 156 | | ...props | `object` | `{}` | Rest of the props applied to `Reanimated.View` including `style` | 157 | 158 | ### `ChartYLabel` & `ChartXLabel` 159 | Labels are useful while moving finger through the chart to show the exact value in given point. 160 | 161 | | Prop name | type | default | description | 162 | |--------------|----------------------|----------|-------------| 163 | | `format` | reanimated worklet | `a => a` | Worklet for formatting data from the chart. It can be useful when your data is a timestamp or currency. | 164 | | ...props | `object` | `{}` | Rest of the props applied to `TextInput` including `style` | 165 | 166 | 167 | 168 | ### Candle Charts 169 | TODO 170 | ### Pie charts 171 | TODO 172 | 173 | ## Helpers 174 | It's not essential in the library, but we have decided to include a lot of helpers we are (or we were) using for displaying charts. 175 | ## Interpolations 176 | We have two interpolators which share the most of the API: `bSplineInterpolation` and `monotoneCubicInterpolation`. 177 | ```js 178 | import { bSplineInterpolation as interpolator } from '@rainbow-me/animated-charts'; 179 | // import { monotoneCubicInterpolation as interpolator } from '@rainbow-me/animated-charts'; 180 | 181 | const interpolatedData = interpolator(data)(80, true, false); 182 | ``` 183 | 184 | Code above generates 80 equidistant points from given dataset. 185 | Interpolator (`monotoneCubicInterpolation` or `bSplineInterpolation`) returns generator. 186 | Generator accepts 3 arguments: `range`, `includeExtremes`, `removePointsSurroundingExtremes`. 187 | - `range` is the number of points of the output. 188 | - `includeExtremes`. If it's vital to include extremes in the output, set to true. However, the data might not be fully equidistant. 189 | - `removePointsSurroundingExtremes`. Makes sense only if `includeExtremes` set to `true`. When disabled, it might be possible that extremes look very "pointy". To get rid of this, you can remove points surrounding extremes. 190 | E.g. 191 | 192 | - `removePointsSurroundingExtremes = false` 193 | 194 | `o---------o----Min--o---------o---------o---------o---------o` 195 | 196 | - `removePointsSurroundingExtremes = true` 197 | 198 | `o--------------Min------------o---------o---------o---------o` 199 | 200 | ### `bSplineInterpolation(data, degree = 3)` 201 | `bSplineInterpolation` is inspired by [victorian lib](https://github.com/networkcube/vistorian/blob/17e2be9b51267509ea67b5984421d8c03558d928/core/lib/BSpline.js) 202 | and uses [B-spline](https://en.wikipedia.org/wiki/B-spline) interpolation of a given `degree`. 203 | 204 | ### `monotoneCubicInterpolation(data, degree = 3)` 205 | This curve is inspired by [d3 shape](https://github.com/d3/d3-shape/blob/master/src/curve/monotone.js). 206 | "Produces a cubic spline that preserves monotonicity in y, assuming monotonicity in x, as proposed by Steffen in A simple method for monotonic interpolation in one dimension: “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations. Local extrema can occur only at grid points where they are given by the data, but not in between two adjacent grid points.” 207 | 208 | 209 | 210 | ## `simplifyData(data, pickRange = 10, includeExtremes = true)` 211 | This helper takes only one point per `pickRange`. Might be useful for very dense data. If it's important, it's possible to include extremes with the `includeExtremes` flag. 212 | E.g. 213 | 214 | `pickRange = 3, includeExtremes = true` 215 | 216 | ``` 217 | X are equidistant in this case 218 | 219 | Y:0 1 7 2 -3 0 1 2 220 | S----------o----------E----------X----------E----------o----------X----------o----------S 221 | ``` 222 | 223 | 224 | `X` - points picked because `index%3=0` 225 | 226 | `S` – the first and the last points are always included. 227 | 228 | `E` – extremes. 229 | 230 | 231 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = {extends: ['@commitlint/config-conventional']}; 2 | -------------------------------------------------------------------------------- /gifs/android.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/gifs/android.gif -------------------------------------------------------------------------------- /gifs/basic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/gifs/basic.png -------------------------------------------------------------------------------- /gifs/ios.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/react-native-animated-charts/45d77b8bba4a74656d73d9f334101e85f53cdf3e/gifs/ios.gif -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rainbow-me/animated-charts", 3 | "version": "1.0.0-alpha.1", 4 | "description": "The library provides a set of components and helpers for building complex and beautiful animated linear (only - for now) charts. It's a part of the [Rainbow.me project](https://rainbow.me/).", 5 | "main": "src/index.js", 6 | "scripts": { 7 | "release": "release-it" 8 | }, 9 | "author": "Michał Osadnik", 10 | "files": [ 11 | "src/" 12 | ], 13 | "husky": { 14 | "hooks": { 15 | "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" 16 | } 17 | }, 18 | "license": "ISC", 19 | "dependencies": { 20 | "@babel/core": "^7.11.4", 21 | "@babel/runtime": "^7.11.2", 22 | "react-native-gesture-handler": "^1.7.0", 23 | "react-native-reanimated": "^2.0.0-alpha.5", 24 | "react-native-svg": "^12.1.0" 25 | }, 26 | "peerDependencies": { 27 | "react": "*", 28 | "react-native": "*" 29 | }, 30 | "devDependencies": { 31 | "@commitlint/cli": "^11.0.0", 32 | "@commitlint/config-conventional": "^11.0.0", 33 | "husky": "^4.3.0", 34 | "release-it": "^14.0.3" 35 | }, 36 | "repository": { 37 | "type": "git", 38 | "url": "git+https://github.com/rainbow-me/react-native-animated-charts.git" 39 | }, 40 | "bugs": { 41 | "url": "https://github.com/rainbow-me/react-native-animated-charts/issues" 42 | }, 43 | "homepage": "https://github.com/rainbow-me/react-native-animated-charts#readme" 44 | } 45 | -------------------------------------------------------------------------------- /src/charts/linear/ChartDot.js: -------------------------------------------------------------------------------- 1 | import React, { useContext } from 'react'; 2 | // eslint-disable-next-line import/no-unresolved 3 | import Animated from 'react-native-reanimated'; 4 | import ChartContext from '../../helpers/ChartContext'; 5 | import withReanimatedFallback from '../../helpers/withReanimatedFallback'; 6 | 7 | function ChartDot({ style, size = 10, ...props }) { 8 | const { dotStyle } = useContext(ChartContext); 9 | return ( 10 | 26 | ); 27 | } 28 | 29 | export default withReanimatedFallback(ChartDot); 30 | -------------------------------------------------------------------------------- /src/charts/linear/ChartLabels.js: -------------------------------------------------------------------------------- 1 | import React, { useContext } from 'react'; 2 | import { TextInput } from 'react-native'; 3 | import Animated, { 4 | useAnimatedStyle, 5 | useDerivedValue, 6 | // eslint-disable-next-line import/no-unresolved 7 | } from 'react-native-reanimated'; 8 | import ChartContext from '../../helpers/ChartContext'; 9 | 10 | const AnimatedTextInput = Animated.createAnimatedComponent(TextInput); 11 | 12 | function ChartLabelFactory(style) { 13 | return function ChartLabel({ format, ...props }) { 14 | const { [style]: val } = useContext(ChartContext); 15 | const formattedValue = useDerivedValue( 16 | () => { 17 | return format ? format(val.value) : val.value; 18 | }, 19 | undefined, 20 | style + 'formattedValue' 21 | ); 22 | const textProps = useAnimatedStyle( 23 | () => { 24 | return { 25 | text: formattedValue.value, 26 | }; 27 | }, 28 | undefined, 29 | style + 'textProps' 30 | ); 31 | return ( 32 | 38 | ); 39 | }; 40 | } 41 | 42 | export const ChartYLabel = ChartLabelFactory('nativeY'); 43 | export const ChartXLabel = ChartLabelFactory('nativeX'); 44 | -------------------------------------------------------------------------------- /src/charts/linear/ChartPath.js: -------------------------------------------------------------------------------- 1 | import React, { useContext, useEffect } from 'react'; 2 | import { LongPressGestureHandler } from 'react-native-gesture-handler'; 3 | import Animated, { 4 | useAnimatedStyle, 5 | useDerivedValue, 6 | // eslint-disable-next-line import/no-unresolved 7 | } from 'react-native-reanimated'; 8 | import { Path, Svg } from 'react-native-svg'; 9 | import ChartContext from '../../helpers/ChartContext'; 10 | import useReactiveSharedValue from '../../helpers/useReactiveSharedValue'; 11 | import withReanimatedFallback from '../../helpers/withReanimatedFallback'; 12 | import { svgBezierPath } from '../../smoothing/smoothSVG'; 13 | 14 | const AnimatedPath = Animated.createAnimatedComponent(Path); 15 | 16 | function ChartPath({ 17 | disableSmoothingWhileTransitioning, 18 | height, 19 | width, 20 | longPressGestureHandlerProps, 21 | strokeWidthSelected = 1, 22 | strokeWidth = 1, 23 | gestureEnabled = true, 24 | selectedOpacity = 0.7, 25 | style, 26 | ...props 27 | }) { 28 | const disableSmoothingWhileTransitioningValue = useReactiveSharedValue( 29 | disableSmoothingWhileTransitioning, 30 | 'disableSmoothingWhileTransitioningValue' 31 | ); 32 | const strokeWidthSelectedValue = useReactiveSharedValue( 33 | strokeWidthSelected, 34 | 'strokeWidthSelectedValue' 35 | ); 36 | const strokeWidthValue = useReactiveSharedValue( 37 | strokeWidth, 38 | 'strokeWidthValue' 39 | ); 40 | 41 | const { 42 | onLongPressGestureEvent, 43 | prevData, 44 | currData, 45 | smoothingStrategy, 46 | prevSmoothing, 47 | currSmoothing, 48 | pathOpacity, 49 | progress, 50 | size: layoutSize, 51 | } = useContext(ChartContext); 52 | 53 | useEffect(() => { 54 | layoutSize.value = { height, width }; 55 | }, [height, layoutSize, width]); 56 | 57 | const path = useDerivedValue( 58 | () => { 59 | let fromValue = prevData.value; 60 | let toValue = currData.value; 61 | let res; 62 | let smoothing = 0; 63 | let strategy = smoothingStrategy.value; 64 | if (progress.value !== 1) { 65 | const numOfPoints = Math.round( 66 | fromValue.length + 67 | (toValue.length - fromValue.length) * 68 | Math.min(progress.value, 0.5) * 69 | 2 70 | ); 71 | if (fromValue.length !== numOfPoints) { 72 | const mappedFrom = []; 73 | const coef = (fromValue.length - 1) / (numOfPoints - 1); 74 | for (let i = 0; i < numOfPoints; i++) { 75 | mappedFrom.push(fromValue[Math.round(i * coef)]); 76 | } 77 | fromValue = mappedFrom; 78 | } 79 | 80 | if (toValue.length !== numOfPoints) { 81 | const mappedTo = []; 82 | const coef = (toValue.length - 1) / (numOfPoints - 1); 83 | 84 | for (let i = 0; i < numOfPoints; i++) { 85 | mappedTo.push(toValue[Math.round(i * coef)]); 86 | } 87 | toValue = mappedTo; 88 | } 89 | 90 | if (!disableSmoothingWhileTransitioningValue.value) { 91 | if (prevSmoothing.value > currSmoothing.value) { 92 | smoothing = 93 | prevSmoothing.value + 94 | Math.min(progress.value * 5, 1) * 95 | (currSmoothing.value - prevSmoothing.value); 96 | } else { 97 | smoothing = 98 | prevSmoothing.value + 99 | Math.max(Math.min((progress.value - 0.7) * 4, 1), 0) * 100 | (currSmoothing.value - prevSmoothing.value); 101 | } 102 | } 103 | 104 | res = fromValue.map(({ x, y }, i) => { 105 | const { x: nX, y: nY } = toValue[i]; 106 | const mX = (x + (nX - x) * progress.value) * layoutSize.value.width; 107 | const mY = (y + (nY - y) * progress.value) * layoutSize.value.height; 108 | return { x: mX, y: mY }; 109 | }); 110 | } else { 111 | smoothing = currSmoothing.value; 112 | res = toValue.map(({ x, y }) => { 113 | return { 114 | x: x * layoutSize.value.width, 115 | y: y * layoutSize.value.height, 116 | }; 117 | }); 118 | } 119 | 120 | // For som reason isNaN(y) does not work 121 | res = res.filter(({ y }) => y === Number(y)); 122 | 123 | if (res.length !== 0) { 124 | const firstValue = res[0]; 125 | const lastValue = res[res.length - 1]; 126 | if (firstValue.x === 0 && strategy !== 'bezier') { 127 | // extrapolate the first points 128 | res = [ 129 | { x: res[0].x, y: res[0].y }, 130 | { x: -res[4].x, y: res[0].y }, 131 | ].concat(res); 132 | } 133 | if (lastValue.x === layoutSize.value.width && strategy !== 'bezier') { 134 | // extrapolate the last points 135 | res[res.length - 1].x = lastValue.x + 20; 136 | if (res.length > 2) { 137 | res[res.length - 2].x = res[res.length - 2].x + 10; 138 | } 139 | } 140 | } 141 | 142 | if ( 143 | (smoothing !== 0 && 144 | (strategy === 'complex' || strategy === 'simple')) || 145 | (strategy === 'bezier' && 146 | (!disableSmoothingWhileTransitioningValue.value || 147 | progress.value === 1)) 148 | ) { 149 | return svgBezierPath(res, smoothing, strategy); 150 | } 151 | 152 | return res 153 | .map(({ x, y }) => { 154 | return `L ${x} ${y}`; 155 | }) 156 | .join(' ') 157 | .replace('L', 'M'); 158 | }, 159 | undefined, 160 | 'ChartPathPath' 161 | ); 162 | 163 | const animatedProps = useAnimatedStyle( 164 | () => { 165 | return { 166 | d: path.value, 167 | strokeWidth: 168 | pathOpacity.value * 169 | (Number(strokeWidthValue.value) - 170 | Number(strokeWidthSelectedValue.value)) + 171 | Number(strokeWidthSelectedValue.value), 172 | }; 173 | }, 174 | undefined, 175 | 'ChartPathAnimateProps' 176 | ); 177 | 178 | const animatedStyle = useAnimatedStyle( 179 | () => { 180 | return { 181 | opacity: pathOpacity.value * (1 - selectedOpacity) + selectedOpacity, 182 | }; 183 | }, 184 | undefined, 185 | 'ChartPathAnimatedStyle' 186 | ); 187 | 188 | return ( 189 | 197 | 198 | 203 | 208 | 209 | 210 | 211 | ); 212 | } 213 | 214 | export default withReanimatedFallback(ChartPath, true); 215 | -------------------------------------------------------------------------------- /src/charts/linear/ChartPathProvider.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useMemo, useRef, useState } from 'react'; 2 | import { Platform } from 'react-native'; 3 | import { 4 | useAnimatedGestureHandler, 5 | useAnimatedStyle, 6 | useSharedValue, 7 | withSpring, 8 | withTiming, 9 | // eslint-disable-next-line import/no-unresolved 10 | } from 'react-native-reanimated'; 11 | import ChartContext from '../../helpers/ChartContext'; 12 | import { findYExtremes } from '../../helpers/extremesHelpers'; 13 | import useReactiveSharedValue from '../../helpers/useReactiveSharedValue'; 14 | 15 | function impactHeavy() { 16 | // eslint-disable-next-line import/no-extraneous-dependencies 17 | const ReactNativeHapticFeedback = require('react-native-haptic-feedback'); 18 | ReactNativeHapticFeedback.default.trigger('impactHeavy'); 19 | } 20 | 21 | const android = Platform.OS === 'android'; 22 | 23 | const springDefaultConfig = { 24 | damping: 15, 25 | mass: 1, 26 | stiffness: 600, 27 | }; 28 | 29 | const timingFeedbackDefaultConfig = { 30 | duration: 80, 31 | }; 32 | 33 | const timingAnimationDefaultConfig = { 34 | duration: 300, 35 | }; 36 | 37 | const parse = data => { 38 | const { greatestY, smallestY } = findYExtremes(data); 39 | const smallestX = data[0]; 40 | const greatestX = data[data.length - 1]; 41 | return [ 42 | data.map(({ x, y }) => ({ 43 | nativeX: x, 44 | nativeY: y, 45 | x: (x - smallestX.x) / (greatestX.x - smallestX.x), 46 | y: 1 - (y - smallestY.y) / (greatestY.y - smallestY.y), 47 | })), 48 | { 49 | greatestX, 50 | greatestY, 51 | smallestX, 52 | smallestY, 53 | }, 54 | ]; 55 | }; 56 | 57 | function setNativeXYAccordingToPosition(nativeX, nativeY, position, data) { 58 | 'worklet'; 59 | let idx = 0; 60 | for (let i = 0; i < data.value.length; i++) { 61 | if (data.value[i].x >= position) { 62 | idx = i; 63 | break; 64 | } 65 | if (i === data.value.length - 1) { 66 | idx = data.value.length - 1; 67 | } 68 | } 69 | nativeX.value = data.value[idx].nativeX.toString(); 70 | nativeY.value = data.value[idx].nativeY 71 | ? data.value[idx].nativeY.toString() 72 | : 'undefined'; 73 | } 74 | 75 | function positionXWithMargin(x, margin, width) { 76 | 'worklet'; 77 | if (x < margin) { 78 | return Math.max(3 * x - 2 * margin, 0); 79 | } else if (width - x < margin) { 80 | return Math.min(margin + x * 2 - width, width); 81 | } else { 82 | return x; 83 | } 84 | } 85 | 86 | function getValue(data, i, smoothingStrategy) { 87 | 'worklet'; 88 | if (smoothingStrategy.value === 'bezier') { 89 | if (i === 0) { 90 | return data.value[i]; 91 | } 92 | 93 | const p0 = data.value[i - 2] || data.value[i - 1] || data.value[i]; 94 | 95 | const x0 = p0.x; 96 | const y0 = p0.y; 97 | const p1 = data.value[i - 1] || data.value[i]; 98 | const x1 = p1.x; 99 | const y1 = p1.y; 100 | const p = data.value[i]; 101 | const x = p.x; 102 | const y = p.y; 103 | const cp3x = (x0 + 4 * x1 + x) / 6; 104 | const cp3y = (y0 + 4 * y1 + y) / 6; 105 | return { x: cp3x, y: cp3y }; 106 | } 107 | return data.value[i]; 108 | } 109 | 110 | export default function ChartPathProvider({ 111 | data: rawData, 112 | children, 113 | softMargin = 0, 114 | enableHaptics = false, 115 | springConfig = {}, 116 | timingFeedbackConfig = {}, 117 | timingAnimationConfig = {}, 118 | }) { 119 | const valuesStore = useRef(null); 120 | if (valuesStore.current == null) { 121 | valuesStore.current = { 122 | currData: [], 123 | currNativeData: [], 124 | dataQueue: [], 125 | prevData: [], 126 | }; 127 | } 128 | 129 | const prevData = useSharedValue(valuesStore.current.prevData, 'prevData'); 130 | const currData = useSharedValue(valuesStore.current.currData, 'currData'); 131 | const currNativeData = useSharedValue( 132 | valuesStore.current.currNativeData, 133 | 'currNativeData' 134 | ); 135 | const prevSmoothing = useSharedValue(0, 'prevSmoothing'); 136 | const currSmoothing = useSharedValue(0, 'currSmoothing'); 137 | 138 | const progress = useSharedValue(1, 'progress'); 139 | const dotScale = useSharedValue(0, 'dotScale'); 140 | const nativeX = useSharedValue('', 'nativeX'); 141 | const nativeY = useSharedValue('', 'nativeY'); 142 | const pathOpacity = useSharedValue(1, 'pathOpacity'); 143 | const softMarginValue = useReactiveSharedValue(softMargin, 'softMarginValue'); 144 | const enableHapticsValue = useReactiveSharedValue( 145 | enableHaptics, 146 | 'enableHapticsValue' 147 | ); 148 | const size = useSharedValue(0, 'size'); 149 | const state = useSharedValue(0, 'state'); 150 | const [extremes, setExtremes] = useState({}); 151 | const isAnimationInProgress = useSharedValue(false, 'isAnimationInProgress'); 152 | 153 | const [data, setData] = useState(rawData); 154 | const dataQueue = useSharedValue(valuesStore.current.dataQueue, 'dataQueue'); 155 | useEffect(() => { 156 | if (isAnimationInProgress.value) { 157 | dataQueue.value.push(rawData); 158 | } else { 159 | setData(rawData); 160 | } 161 | // eslint-disable-next-line react-hooks/exhaustive-deps 162 | }, [rawData]); 163 | 164 | const smoothingStrategy = useReactiveSharedValue( 165 | data.smoothingStrategy, 166 | 'smoothingStrategy' 167 | ); 168 | 169 | useEffect(() => { 170 | if (!data || !data.points || data.points.length === 0) { 171 | return; 172 | } 173 | const [parsedData] = parse(data.points); 174 | const [parsedNativeData, newExtremes] = parse( 175 | data.nativePoints || data.points 176 | ); 177 | setExtremes(newExtremes); 178 | if (prevData.value.length !== 0) { 179 | valuesStore.current.prevData = currData.value; 180 | prevData.value = currData.value; 181 | prevSmoothing.value = currSmoothing.value; 182 | progress.value = 0; 183 | valuesStore.current.currData = parsedData; 184 | currData.value = parsedData; 185 | valuesStore.current.currNativeData = parsedNativeData; 186 | currNativeData.value = parsedNativeData; 187 | currSmoothing.value = data.smoothingFactor || 0; 188 | isAnimationInProgress.value = true; 189 | progress.value = withTiming( 190 | 1, 191 | { ...timingAnimationDefaultConfig, ...timingAnimationConfig }, 192 | () => { 193 | isAnimationInProgress.value = false; 194 | if (dataQueue.value.length !== 0) { 195 | setData(dataQueue.value[0]); 196 | dataQueue.value.shift(); 197 | } 198 | } 199 | ); 200 | } else { 201 | prevSmoothing.value = data.smoothing || 0; 202 | currSmoothing.value = data.smoothing || 0; 203 | valuesStore.current.currData = parsedData; 204 | valuesStore.current.currNativeData = parsedData; 205 | prevData.value = parsedData; 206 | currData.value = parsedData; 207 | currNativeData.value = parsedNativeData; 208 | } 209 | // eslint-disable-next-line react-hooks/exhaustive-deps 210 | }, [data]); 211 | const positionX = useSharedValue(0, 'positionX'); 212 | const positionY = useSharedValue(0, 'positionY'); 213 | 214 | const isStarted = useReactiveSharedValue(false, 'isStarted'); 215 | 216 | const onLongPressGestureEvent = useAnimatedGestureHandler({ 217 | onActive: event => { 218 | state.value = event.state; 219 | if (!currData.value || currData.value.length === 0) { 220 | return; 221 | } 222 | if (!isStarted.value) { 223 | dotScale.value = withSpring(1, { 224 | ...springDefaultConfig, 225 | ...springConfig, 226 | }); 227 | pathOpacity.value = withTiming(0, { 228 | ...timingFeedbackDefaultConfig, 229 | ...timingFeedbackConfig, 230 | }); 231 | } 232 | 233 | if (enableHapticsValue.value && !isStarted.value) { 234 | impactHeavy(); 235 | } 236 | isStarted.value = true; 237 | 238 | const eventX = positionXWithMargin( 239 | event.x, 240 | softMarginValue.value, 241 | size.value.width 242 | ); 243 | 244 | let idx = 0; 245 | let ss = smoothingStrategy; 246 | for (let i = 0; i < currData.value.length; i++) { 247 | if (getValue(currData, i, ss).x > eventX / size.value.width) { 248 | idx = i; 249 | break; 250 | } 251 | if (i === currData.value.length - 1) { 252 | idx = currData.value.length - 1; 253 | } 254 | } 255 | 256 | if ( 257 | ss.value === 'bezier' && 258 | currData.value.length > 30 && 259 | eventX / size.value.width >= currData.value[currData.value.length - 2].x 260 | ) { 261 | const prevLastY = currData.value[currData.value.length - 2].y; 262 | const prevLastX = currData.value[currData.value.length - 2].x; 263 | const lastY = currData.value[currData.value.length - 1].y; 264 | const lastX = currData.value[currData.value.length - 1].x; 265 | const progress = 266 | (eventX / size.value.width - prevLastX) / (lastX - prevLastX); 267 | positionY.value = 268 | (prevLastY + progress * (lastY - prevLastY)) * size.value.height; 269 | } else if (idx === 0) { 270 | positionY.value = getValue(currData, idx, ss).y * size.value.height; 271 | } else { 272 | // prev + diff over X 273 | positionY.value = 274 | (getValue(currData, idx - 1, ss).y + 275 | (getValue(currData, idx, ss).y - 276 | getValue(currData, idx - 1, ss).y) * 277 | ((eventX / size.value.width - getValue(currData, idx - 1, ss).x) / 278 | (getValue(currData, idx, ss).x - 279 | getValue(currData, idx - 1, ss).x))) * 280 | size.value.height; 281 | } 282 | 283 | setNativeXYAccordingToPosition( 284 | nativeX, 285 | nativeY, 286 | eventX / size.value.width, 287 | currNativeData 288 | ); 289 | positionX.value = eventX; 290 | }, 291 | onCancel: event => { 292 | isStarted.value = false; 293 | state.value = event.state; 294 | nativeX.value = ''; 295 | nativeY.value = ''; 296 | dotScale.value = withSpring(0, { 297 | ...springDefaultConfig, 298 | ...springConfig, 299 | }); 300 | if (android) { 301 | pathOpacity.value = 1; 302 | } else { 303 | pathOpacity.value = withTiming(1, { 304 | ...timingFeedbackDefaultConfig, 305 | ...timingFeedbackConfig, 306 | }); 307 | } 308 | }, 309 | onEnd: event => { 310 | isStarted.value = false; 311 | state.value = event.state; 312 | nativeX.value = ''; 313 | nativeY.value = ''; 314 | dotScale.value = withSpring(0, { 315 | ...springDefaultConfig, 316 | ...springConfig, 317 | }); 318 | if (android) { 319 | pathOpacity.value = 1; 320 | } else { 321 | pathOpacity.value = withTiming(1, { 322 | ...timingFeedbackDefaultConfig, 323 | ...timingFeedbackConfig, 324 | }); 325 | } 326 | 327 | if (enableHapticsValue.value) { 328 | impactHeavy(); 329 | } 330 | }, 331 | onFail: event => { 332 | isStarted.value = false; 333 | state.value = event.state; 334 | nativeX.value = ''; 335 | nativeY.value = ''; 336 | dotScale.value = withSpring(0, { 337 | ...springDefaultConfig, 338 | ...springConfig, 339 | }); 340 | if (android) { 341 | pathOpacity.value = 1; 342 | } else { 343 | pathOpacity.value = withTiming(1, { 344 | ...timingFeedbackDefaultConfig, 345 | ...timingFeedbackConfig, 346 | }); 347 | } 348 | }, 349 | onStart: event => { 350 | state.value = event.state; 351 | if (!currData.value || currData.value.length === 0) { 352 | return; 353 | } 354 | 355 | const eventX = positionXWithMargin( 356 | event.x, 357 | softMarginValue.value, 358 | size.value.width 359 | ); 360 | 361 | progress.value = 1; 362 | let idx = 0; 363 | for (let i = 0; i < currData.value.length; i++) { 364 | if (currData.value[i].x > eventX / size.value.width) { 365 | idx = i; 366 | break; 367 | } 368 | if (i === currData.value.length - 1) { 369 | idx = currData.value.length - 1; 370 | } 371 | } 372 | setNativeXYAccordingToPosition( 373 | nativeX, 374 | nativeY, 375 | eventX / size.value.width, 376 | currNativeData 377 | ); 378 | dotScale.value = withSpring(1, { 379 | ...springDefaultConfig, 380 | ...springConfig, 381 | }); 382 | 383 | if (!android) { 384 | positionX.value = positionXWithMargin(eventX, 30, size.value.width); 385 | positionY.value = currData.value[idx].y * size.value.height; 386 | pathOpacity.value = withTiming(0, { 387 | ...timingFeedbackDefaultConfig, 388 | ...timingFeedbackConfig, 389 | }); 390 | } 391 | if (enableHapticsValue.value && !isStarted.value) { 392 | impactHeavy(); 393 | } 394 | isStarted.value = true; 395 | }, 396 | }); 397 | 398 | // @ts-ignore 399 | const dotStyle = useAnimatedStyle( 400 | () => ({ 401 | opacity: dotScale.value, 402 | transform: [ 403 | { translateX: positionX.value }, 404 | { translateY: positionY.value + 10 }, // TODO temporary fix for clipped chart 405 | { scale: dotScale.value }, 406 | ], 407 | }), 408 | undefined, 409 | 'dotStyle' 410 | ); 411 | 412 | const contextValue = useMemo( 413 | () => ({ 414 | currData, 415 | currSmoothing, 416 | data, 417 | dotStyle, 418 | extremes, 419 | nativeX, 420 | nativeY, 421 | onLongPressGestureEvent, 422 | pathOpacity, 423 | prevData, 424 | prevSmoothing, 425 | progress, 426 | size, 427 | smoothingStrategy, 428 | state, 429 | }), 430 | [ 431 | dotStyle, 432 | onLongPressGestureEvent, 433 | nativeX, 434 | nativeY, 435 | size, 436 | data, 437 | extremes, 438 | state, 439 | pathOpacity, 440 | prevData, 441 | currData, 442 | prevSmoothing, 443 | currSmoothing, 444 | progress, 445 | smoothingStrategy, 446 | ] 447 | ); 448 | 449 | return ( 450 | 451 | {children} 452 | 453 | ); 454 | } 455 | -------------------------------------------------------------------------------- /src/helpers/ChartContext.js: -------------------------------------------------------------------------------- 1 | import { createContext } from 'react'; 2 | export default createContext(null); 3 | -------------------------------------------------------------------------------- /src/helpers/extremesHelpers.js: -------------------------------------------------------------------------------- 1 | export function findYExtremes(data) { 2 | let smallestY = null; 3 | let greatestY = null; 4 | for (const d of data) { 5 | if (d.y !== undefined && (smallestY === null || d.y < smallestY.y)) { 6 | smallestY = d; 7 | } 8 | 9 | if (d.y !== undefined && (greatestY === null || d.y > greatestY.y)) { 10 | greatestY = d; 11 | } 12 | } 13 | return { 14 | greatestY, 15 | smallestY, 16 | }; 17 | } 18 | 19 | export function addExtremesIfNeeded( 20 | res, 21 | data, 22 | includeExtremes, 23 | removePointsSurroundingExtremes 24 | ) { 25 | if (includeExtremes) { 26 | const { greatestY, smallestY } = findYExtremes(data); 27 | 28 | const [ex1, ex2] = [greatestY, smallestY].sort((a, b) => a.x < b.x); 29 | let added1 = false; 30 | let added2 = false; 31 | 32 | const newRes = []; 33 | for (let i = 0; i < res.length; i++) { 34 | const d = res[i]; 35 | let justAdded1 = false; 36 | let justAdded2 = false; 37 | if ( 38 | !added1 && 39 | (newRes.length === 0 || newRes[newRes.length - 1].x <= ex1.x) && 40 | ex1.x <= d.x 41 | ) { 42 | justAdded1 = true; 43 | added1 = true; 44 | if (ex1.x !== d.x) { 45 | if (removePointsSurroundingExtremes) { 46 | newRes.pop(); 47 | } 48 | newRes.push(ex1); 49 | } 50 | } 51 | if ( 52 | !added2 && 53 | (newRes.length === 0 || newRes[newRes.length - 1].x <= ex2.x) && 54 | ex2.x <= d.x 55 | ) { 56 | justAdded2 = true; 57 | added2 = true; 58 | if (ex2.x !== d.x) { 59 | if (!justAdded1 && removePointsSurroundingExtremes) { 60 | newRes.pop(); 61 | } 62 | 63 | newRes.push(ex2); 64 | } 65 | } 66 | if ( 67 | (!justAdded1 && !justAdded2) || 68 | !removePointsSurroundingExtremes || 69 | i === res.length - 1 70 | ) { 71 | newRes.push(d); 72 | } 73 | } 74 | if (!added1) { 75 | newRes.push(ex1); 76 | } 77 | if (!added2) { 78 | newRes.push(ex2); 79 | } 80 | return newRes; 81 | } 82 | return res; 83 | } 84 | -------------------------------------------------------------------------------- /src/helpers/useChartData.js: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react'; 2 | import ChartContext from './ChartContext'; 3 | 4 | export default function useChartData() { 5 | const { extremes, ...rest } = useContext(ChartContext); 6 | return { ...extremes, ...rest }; 7 | } 8 | -------------------------------------------------------------------------------- /src/helpers/useReactiveSharedValue.js: -------------------------------------------------------------------------------- 1 | import { useEffect } from 'react'; 2 | // eslint-disable-next-line import/no-unresolved 3 | import { useSharedValue } from 'react-native-reanimated'; 4 | 5 | export default function useReactiveSharedValue(prop, name) { 6 | const sharedValue = useSharedValue(null, name); 7 | if (sharedValue.value === null) { 8 | sharedValue.value = prop; 9 | } 10 | useEffect(() => { 11 | sharedValue.value = prop; 12 | }, [sharedValue, prop]); 13 | return sharedValue; 14 | } 15 | -------------------------------------------------------------------------------- /src/helpers/withReanimatedFallback.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, TurboModuleRegistry } from 'react-native'; 3 | 4 | function ChartFallback() { 5 | return Charts are not available without Reanimated 2; 6 | } 7 | 8 | export default function withReanimatedFallback( 9 | ChartComponent, 10 | showText = false 11 | ) { 12 | return !TurboModuleRegistry.get('NativeReanimated') && 13 | (!global.__reanimatedModuleProxy || 14 | global.__reanimatedModuleProxy.__shimmed) 15 | ? showText 16 | ? ChartFallback 17 | : () => null 18 | : ChartComponent; 19 | } 20 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | export { default as ChartPathProvider } from './charts/linear/ChartPathProvider'; 2 | export { default as ChartDot } from './charts/linear/ChartDot'; 3 | export { ChartYLabel, ChartXLabel } from './charts/linear/ChartLabels'; 4 | export { default as ChartPath } from './charts/linear/ChartPath'; 5 | export { default as useChartData } from './helpers/useChartData'; 6 | export { default as simplifyData } from './simplification/simplifyData'; 7 | export { default as monotoneCubicInterpolation } from './interpolations/monotoneCubicInterpolation'; 8 | export { default as bSplineInterpolation } from './interpolations/bSplineInterpolation'; 9 | -------------------------------------------------------------------------------- /src/interpolations/bSplineInterpolation.js: -------------------------------------------------------------------------------- 1 | import { addExtremesIfNeeded } from '../helpers/extremesHelpers'; 2 | 3 | class BSpline { 4 | constructor(points, degree, copy) { 5 | if (copy) { 6 | this.points = []; 7 | for (let i = 0; i < points.length; i++) { 8 | this.points.push(points[i]); 9 | } 10 | } else { 11 | this.points = points; 12 | } 13 | this.degree = degree; 14 | this.dimension = points[0].length; 15 | if (degree === 2) { 16 | this.baseFunc = this.basisDeg2; 17 | this.baseFuncRangeInt = 2; 18 | } else if (degree === 3) { 19 | this.baseFunc = this.basisDeg3; 20 | this.baseFuncRangeInt = 2; 21 | } else if (degree === 4) { 22 | this.baseFunc = this.basisDeg4; 23 | this.baseFuncRangeInt = 3; 24 | } else if (degree === 5) { 25 | this.baseFunc = this.basisDeg5; 26 | this.baseFuncRangeInt = 3; 27 | } 28 | } 29 | 30 | seqAt(dim) { 31 | let points = this.points; 32 | let margin = this.degree + 1; 33 | return function(n) { 34 | if (n < margin) { 35 | return points[0][dim]; 36 | } else if (points.length + margin <= n) { 37 | return points[points.length - 1][dim]; 38 | } else { 39 | return points[n - margin][dim]; 40 | } 41 | }; 42 | } 43 | 44 | basisDeg2(x) { 45 | if (-0.5 <= x && x < 0.5) { 46 | return 0.75 - x * x; 47 | } else if (0.5 <= x && x <= 1.5) { 48 | return 1.125 + (-1.5 + x / 2.0) * x; 49 | } else if (-1.5 <= x && x < -0.5) { 50 | return 1.125 + (1.5 + x / 2.0) * x; 51 | } else { 52 | return 0; 53 | } 54 | } 55 | 56 | basisDeg3(x) { 57 | if (-1 <= x && x < 0) { 58 | return 2.0 / 3.0 + (-1.0 - x / 2.0) * x * x; 59 | } else if (1 <= x && x <= 2) { 60 | return 4.0 / 3.0 + x * (-2.0 + (1.0 - x / 6.0) * x); 61 | } else if (-2 <= x && x < -1) { 62 | return 4.0 / 3.0 + x * (2.0 + (1.0 + x / 6.0) * x); 63 | } else if (0 <= x && x < 1) { 64 | return 2.0 / 3.0 + (-1.0 + x / 2.0) * x * x; 65 | } else { 66 | return 0; 67 | } 68 | } 69 | 70 | basisDeg4(x) { 71 | if (-1.5 <= x && x < -0.5) { 72 | return ( 73 | 55.0 / 96.0 + 74 | x * (-(5.0 / 24.0) + x * (-(5.0 / 4.0) + (-(5.0 / 6.0) - x / 6.0) * x)) 75 | ); 76 | } else if (0.5 <= x && x < 1.5) { 77 | return ( 78 | 55.0 / 96.0 + 79 | x * (5.0 / 24.0 + x * (-(5.0 / 4.0) + (5.0 / 6.0 - x / 6.0) * x)) 80 | ); 81 | } else if (1.5 <= x && x <= 2.5) { 82 | return ( 83 | 625.0 / 384.0 + 84 | x * 85 | (-(125.0 / 48.0) + x * (25.0 / 16.0 + (-(5.0 / 12.0) + x / 24.0) * x)) 86 | ); 87 | } else if (-2.5 <= x && x <= -1.5) { 88 | return ( 89 | 625.0 / 384.0 + 90 | x * (125.0 / 48.0 + x * (25.0 / 16.0 + (5.0 / 12.0 + x / 24.0) * x)) 91 | ); 92 | } else if (-1.5 <= x && x < 1.5) { 93 | return 115.0 / 192.0 + x * x * (-(5.0 / 8.0) + (x * x) / 4.0); 94 | } else { 95 | return 0; 96 | } 97 | } 98 | 99 | getInterpol(seq, t) { 100 | let f = this.baseFunc; 101 | let rangeInt = this.baseFuncRangeInt; 102 | let tInt = Math.floor(t); 103 | let result = 0; 104 | for (let i = tInt - rangeInt; i <= tInt + rangeInt; i++) { 105 | result += seq(i) * f(t - i); 106 | } 107 | return result; 108 | } 109 | 110 | basisDeg5(x) { 111 | if (-2 <= x && x < -1) { 112 | return ( 113 | 17.0 / 40.0 + 114 | x * 115 | (-(5.0 / 8.0) + 116 | x * 117 | (-(7.0 / 4.0) + 118 | x * (-(5.0 / 4.0) + (-(3.0 / 8.0) - x / 24.0) * x))) 119 | ); 120 | } else if (0 <= x && x < 1) { 121 | return ( 122 | 11.0 / 20.0 + x * x * (-(1.0 / 2.0) + (1.0 / 4.0 - x / 12.0) * x * x) 123 | ); 124 | } else if (2 <= x && x <= 3) { 125 | return ( 126 | 81.0 / 40.0 + 127 | x * 128 | (-(27.0 / 8.0) + 129 | x * (9.0 / 4.0 + x * (-(3.0 / 4.0) + (1.0 / 8.0 - x / 120.0) * x))) 130 | ); 131 | } else if (-3 <= x && x < -2) { 132 | return ( 133 | 81.0 / 40.0 + 134 | x * 135 | (27.0 / 8.0 + 136 | x * (9.0 / 4.0 + x * (3.0 / 4.0 + (1.0 / 8.0 + x / 120.0) * x))) 137 | ); 138 | } else if (1 <= x && x < 2) { 139 | return ( 140 | 17.0 / 40.0 + 141 | x * 142 | (5.0 / 8.0 + 143 | x * 144 | (-(7.0 / 4.0) + x * (5.0 / 4.0 + (-(3.0 / 8.0) + x / 24.0) * x))) 145 | ); 146 | } else if (-1 <= x && x < 0) { 147 | return ( 148 | 11.0 / 20.0 + x * x * (-(1.0 / 2.0) + (1.0 / 4.0 + x / 12.0) * x * x) 149 | ); 150 | } else { 151 | return 0; 152 | } 153 | } 154 | 155 | calcAt(t) { 156 | t = t * ((this.degree + 1) * 2 + this.points.length); //t must be in [0,1] 157 | if (this.dimension === 2) { 158 | return [ 159 | this.getInterpol(this.seqAt(0), t), 160 | this.getInterpol(this.seqAt(1), t), 161 | ]; 162 | } else if (this.dimension === 3) { 163 | return [ 164 | this.getInterpol(this.seqAt(0), t), 165 | this.getInterpol(this.seqAt(1), t), 166 | this.getInterpol(this.seqAt(2), t), 167 | ]; 168 | } else { 169 | let res = []; 170 | for (let i = 0; i < this.dimension; i++) { 171 | res.push(this.getInterpol(this.seqAt(i), t)); 172 | } 173 | return res; 174 | } 175 | } 176 | } 177 | 178 | export default function bSplineInterpolation(data, degree = 3) { 179 | if (!data || data.length === 0) { 180 | return () => []; 181 | } 182 | const parsed = data.map(({ x, y }) => [x, y]); 183 | const spline = new BSpline(parsed, degree, true); 184 | 185 | return (range, includeExtremes, removePointsSurroundingExtremes = true) => { 186 | const res = []; 187 | for (let i = 0; i < range; i++) { 188 | res.push(spline.calcAt(i / (range - 1))); 189 | } 190 | return addExtremesIfNeeded( 191 | res.map(([x, y]) => ({ x, y })), 192 | data, 193 | includeExtremes, 194 | removePointsSurroundingExtremes 195 | ); 196 | }; 197 | } 198 | -------------------------------------------------------------------------------- /src/interpolations/monotoneCubicInterpolation.js: -------------------------------------------------------------------------------- 1 | import { addExtremesIfNeeded } from '../helpers/extremesHelpers'; 2 | 3 | export default function monotoneCubicInterpolation(data) { 4 | if (!data || data.length === 0) { 5 | return () => []; 6 | } 7 | const { x, y } = data.reduce( 8 | (acc, curr) => { 9 | acc.x.push(curr.x); 10 | acc.y.push(curr.y); 11 | return acc; 12 | }, 13 | { 14 | x: [], 15 | y: [], 16 | } 17 | ); 18 | let alpha, 19 | beta, 20 | delta, 21 | dist, 22 | i, 23 | m, 24 | n, 25 | tau, 26 | toFix, 27 | idx, 28 | jdx, 29 | len, 30 | len2, 31 | ref, 32 | ref2, 33 | ref3, 34 | ref4; 35 | 36 | n = x.length; 37 | delta = []; 38 | m = []; 39 | alpha = []; 40 | beta = []; 41 | dist = []; 42 | tau = []; 43 | 44 | for ( 45 | i = 0, ref = n - 1; 46 | ref >= 0 ? i < ref : i > ref; 47 | ref >= 0 ? (i += 1) : (i -= 1) 48 | ) { 49 | delta[i] = (y[i + 1] - y[i]) / (x[i + 1] - x[i]); 50 | if (i > 0) { 51 | m[i] = (delta[i - 1] + delta[i]) / 2; 52 | } 53 | } 54 | 55 | m[0] = delta[0]; 56 | m[n - 1] = delta[n - 2]; 57 | toFix = []; 58 | 59 | for ( 60 | i = 0, ref2 = n - 1; 61 | ref2 >= 0 ? i < ref2 : i > ref2; 62 | ref2 >= 0 ? (i += 1) : (i -= 1) 63 | ) { 64 | if (delta[i] === 0) { 65 | toFix.push(i); 66 | } 67 | } 68 | 69 | for (idx = 0, len = toFix.length; idx < len; idx++) { 70 | i = toFix[idx]; 71 | m[i] = m[i + 1] = 0; 72 | } 73 | 74 | for ( 75 | i = 0, ref3 = n - 1; 76 | ref3 >= 0 ? i < ref3 : i > ref3; 77 | ref3 >= 0 ? (i += 1) : (i -= 1) 78 | ) { 79 | alpha[i] = m[i] / delta[i]; 80 | beta[i] = m[i + 1] / delta[i]; 81 | dist[i] = Math.pow(alpha[i], 2) + Math.pow(beta[i], 2); 82 | tau[i] = 3 / Math.sqrt(dist[i]); 83 | } 84 | 85 | toFix = []; 86 | 87 | for ( 88 | i = 0, ref4 = n - 1; 89 | ref4 >= 0 ? i < ref4 : i > ref4; 90 | ref4 >= 0 ? (i += 1) : (i -= 1) 91 | ) { 92 | if (dist[i] > 9) { 93 | toFix.push(i); 94 | } 95 | } 96 | 97 | for (jdx = 0, len2 = toFix.length; jdx < len2; jdx++) { 98 | i = toFix[jdx]; 99 | m[i] = tau[i] * alpha[i] * delta[i]; 100 | m[i + 1] = tau[i] * beta[i] * delta[i]; 101 | } 102 | 103 | const _x = x.slice(0, n); 104 | const _y = y.slice(0, n); 105 | const _m = m; 106 | 107 | return (range, includeExtremes, removePointsSurroundingExtremes = true) => { 108 | const firstValue = _x[0]; 109 | const lastValue = _x[_x.length - 1]; 110 | const res = []; 111 | for (let j = 0; j < range; j++) { 112 | const interpolatedValue = 113 | firstValue + (lastValue - firstValue) * (j / (range - 1)); 114 | 115 | let h, h00, h01, h10, h11, i, t, t2, t3, y, _ref; 116 | 117 | for ( 118 | i = _ref = _x.length - 2; 119 | _ref <= 0 ? i <= 0 : i >= 0; 120 | _ref <= 0 ? (i += 1) : (i -= 1) 121 | ) { 122 | if (_x[i] <= interpolatedValue) { 123 | break; 124 | } 125 | } 126 | 127 | h = _x[i + 1] - _x[i]; 128 | t = (interpolatedValue - _x[i]) / h; 129 | t2 = Math.pow(t, 2); 130 | t3 = Math.pow(t, 3); 131 | h00 = 2 * t3 - 3 * t2 + 1; 132 | h10 = t3 - 2 * t2 + t; 133 | h01 = -2 * t3 + 3 * t2; 134 | h11 = t3 - t2; 135 | y = h00 * _y[i] + h10 * h * _m[i] + h01 * _y[i + 1] + h11 * h * _m[i + 1]; 136 | 137 | res.push({ x: interpolatedValue, y }); 138 | } 139 | 140 | return addExtremesIfNeeded( 141 | res, 142 | data, 143 | includeExtremes, 144 | removePointsSurroundingExtremes 145 | ); 146 | }; 147 | } 148 | -------------------------------------------------------------------------------- /src/simplification/simplifyData.js: -------------------------------------------------------------------------------- 1 | export default function simplifyData( 2 | data, 3 | pickRange = 10, 4 | includeExtremes = true 5 | ) { 6 | if (!data) { 7 | return []; 8 | } 9 | let min = -1; 10 | let max = -1; 11 | if (includeExtremes) { 12 | min = 0; 13 | max = 0; 14 | for (let i = 0; i < data.length; i++) { 15 | if (data[min].y > data[i].y) { 16 | min = i; 17 | } 18 | 19 | if (data[max].y < data[i].y) { 20 | max = i; 21 | } 22 | } 23 | } 24 | 25 | return data.filter( 26 | (_, i) => 27 | i % pickRange === 0 || 28 | i === min || 29 | i === max || 30 | i === 0 || 31 | i === data.length - 1 32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /src/smoothing/smoothSVG.js: -------------------------------------------------------------------------------- 1 | const controlPoint = (current, previous, next, reverse, smoothing) => { 2 | 'worklet'; 3 | const p = previous || current; 4 | const n = next || current; 5 | // Properties of the opposed-line 6 | const lengthX = n[0] - p[0]; 7 | const lengthY = n[1] - p[1]; 8 | const o = { 9 | angle: Math.atan2(lengthY, lengthX), 10 | length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)), 11 | }; 12 | // If is end-control-point, add PI to the angle to go backward 13 | const angle = o.angle + (reverse ? Math.PI : 0); 14 | const length = o.length * smoothing; 15 | // The control point position is relative to the current point 16 | const x = current[0] + Math.cos(angle) * length; 17 | const y = current[1] + Math.sin(angle) * length; 18 | return [x, y]; 19 | }; 20 | 21 | export const svgBezierPath = (points, smoothing, strategy) => { 22 | 'worklet'; 23 | const traversed = points.map(p => [p.x, p.y]); 24 | // build the d attributes by looping over the points 25 | return traversed.reduce((acc, point, i, a) => { 26 | if (i === 0) { 27 | return `M ${point[0]},${point[1]}`; 28 | } else { 29 | const cps = controlPoint(a[i - 1], a[i - 2], point, false, smoothing); 30 | const cpsX = cps[0]; 31 | const cpsY = cps[1]; 32 | 33 | const cpe = controlPoint(point, a[i - 1], a[i + 1], true, smoothing); 34 | const cpeX = cpe[0]; 35 | const cpeY = cpe[1]; 36 | if (strategy === 'simple') { 37 | return `${acc} Q ${(cpsX + cpeX) / 2},${(cpsY + cpeY) / 2} ${ 38 | point[0] 39 | },${point[1]}`; 40 | } else if (strategy === 'complex') { 41 | return `${acc} C ${cpsX},${cpsY} ${cpeX},${cpeY} ${point[0]},${point[1]}`; 42 | } else if (strategy === 'bezier') { 43 | const p0 = a[i - 2] || a[i - 1]; 44 | const x0 = p0[0]; 45 | const y0 = p0[1]; 46 | const p1 = a[i - 1]; 47 | const x1 = p1[0]; 48 | const y1 = p1[1]; 49 | const x = point[0]; 50 | const y = point[1]; 51 | const cp1x = (2 * x0 + x1) / 3; 52 | const cp1y = (2 * y0 + y1) / 3; 53 | const cp2x = (x0 + 2 * x1) / 3; 54 | const cp2y = (y0 + 2 * y1) / 3; 55 | const cp3x = (x0 + 4 * x1 + x) / 6; 56 | const cp3y = (y0 + 4 * y1 + y) / 6; 57 | if (i === a.length - 1) { 58 | return `${acc} C ${cp1x},${cp1y} ${cp2x},${cp2y} ${cp3x},${cp3y} C${x},${y} ${x},${y} ${x},${y}`; 59 | } 60 | return `${acc} C ${cp1x},${cp1y} ${cp2x},${cp2y} ${cp3x},${cp3y}`; 61 | } 62 | return null; 63 | } 64 | }, ''); 65 | }; 66 | --------------------------------------------------------------------------------