├── .github ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── cla.yml │ └── publish.yml ├── .gitignore ├── .huskyrc ├── .lintstagedrc ├── .nvmrc ├── Example ├── .bundle │ └── config ├── .eslintrc.js ├── .gitignore ├── .prettierrc.js ├── .watchmanconfig ├── Gemfile ├── Gemfile.lock ├── README.md ├── __tests__ │ └── App.test.tsx ├── android │ ├── app │ │ ├── build.gradle │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ ├── MainActivity.kt │ │ │ │ └── MainApplication.kt │ │ │ └── res │ │ │ ├── drawable │ │ │ └── rn_edit_text_material.xml │ │ │ ├── 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 ├── dist │ └── index.html ├── global.d.ts ├── index.js ├── ios │ ├── .xcode.env │ ├── Example.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Example.xcscheme │ ├── Example.xcworkspace │ │ └── contents.xcworkspacedata │ ├── Example │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ └── main.m │ ├── ExampleTests │ │ ├── ExampleTests.m │ │ └── Info.plist │ ├── Podfile │ └── Podfile.lock ├── jest.config.js ├── macos │ ├── .gitignore │ ├── .xcode.env │ ├── .xcode.env.local │ ├── Example-macOS │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ └── Main.storyboard │ │ ├── Example.entitlements │ │ ├── Info.plist │ │ └── main.m │ ├── Example.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Example-macOS.xcscheme │ ├── Example.xcworkspace │ │ └── contents.xcworkspacedata │ ├── Podfile │ └── Podfile.lock ├── metro.config.js ├── package.json ├── src │ ├── App.tsx │ ├── assets │ │ ├── google.png │ │ └── ruby.svg │ ├── components │ │ └── Description.tsx │ └── styles.ts ├── tsconfig.json ├── webpack.config.js └── yarn.lock ├── LICENSE ├── README.md ├── babel.config.js ├── index.d.ts ├── index.js ├── package-lock.json ├── package.json ├── screenshot ├── android.png └── ios.png ├── src ├── LogoSVG │ ├── index.js │ └── index.native.js ├── __mocks__ │ ├── react-native-svg.js │ └── react-native.js ├── __tests__ │ ├── Matrix-test.js │ ├── QRCode-test.js │ └── __snapshots__ │ │ ├── Matrix-test.js.snap │ │ └── QRCode-test.js.snap ├── genMatrix.js ├── index.js ├── package.json ├── transformMatrixIntoPath.js └── utils.js └── textEncodingTransformation.js /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Details 2 | 3 | 4 | ## What this fixes 5 | 9 | 10 | ## Checklist 11 | - [ ] I have described the bug/issue 12 | - [ ] I have provided reproduction in `Example` App 13 | - [ ] I have tested that solution works on `Example` App on all platforms: 14 | - Android 15 | - iOS 16 | - Web 17 | 18 | ### Screenshots/Videos 19 | -------------------------------------------------------------------------------- /.github/workflows/cla.yml: -------------------------------------------------------------------------------- 1 | name: CLA Assistant 2 | 3 | on: 4 | issue_comment: 5 | types: [created] 6 | pull_request_target: 7 | types: [opened, synchronize] 8 | 9 | jobs: 10 | CLA: 11 | uses: Expensify/GitHub-Actions/.github/workflows/cla.yml@main 12 | secrets: inherit 13 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish package to npmjs 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | 7 | # Ensure that only one instance of this workflow executes at a time. 8 | # If multiple PRs are merged in quick succession, there will only ever be one publish workflow running and one pending. 9 | concurrency: ${{ github.workflow }} 10 | 11 | jobs: 12 | publish: 13 | # os-botify[bot] will update the version on `main`, so this check is important to prevent an infinite loop 14 | if: ${{ github.actor != 'os-botify[bot]' }} 15 | uses: Expensify/GitHub-Actions/.github/workflows/npmPublish.yml@main 16 | secrets: inherit 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | 3 | # Webstorm and IntelliJ 4 | .idea 5 | -------------------------------------------------------------------------------- /.huskyrc: -------------------------------------------------------------------------------- 1 | { 2 | "hooks": { 3 | "pre-commit": "npm run lint:staged && npm run test" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.lintstagedrc: -------------------------------------------------------------------------------- 1 | { 2 | "*.js": "npm run lint" 3 | } 4 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 20.15.1 2 | -------------------------------------------------------------------------------- /Example/.bundle/config: -------------------------------------------------------------------------------- 1 | BUNDLE_PATH: "vendor/bundle" 2 | BUNDLE_FORCE_RUBY_PLATFORM: 1 3 | -------------------------------------------------------------------------------- /Example/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native', 4 | }; 5 | -------------------------------------------------------------------------------- /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 | **/.xcode.env.local 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | *.hprof 33 | .cxx/ 34 | *.keystore 35 | !debug.keystore 36 | 37 | # node.js 38 | # 39 | node_modules/ 40 | npm-debug.log 41 | yarn-error.log 42 | 43 | # fastlane 44 | # 45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 46 | # screenshots whenever they are needed. 47 | # For more information about the recommended setup visit: 48 | # https://docs.fastlane.tools/best-practices/source-control/ 49 | 50 | **/fastlane/report.xml 51 | **/fastlane/Preview.html 52 | **/fastlane/screenshots 53 | **/fastlane/test_output 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | # Ruby / CocoaPods 59 | **/Pods/ 60 | /vendor/bundle/ 61 | 62 | # Temporary files created by Metro to check the health of the file watcher 63 | .metro-health-check* 64 | 65 | # testing 66 | /coverage 67 | 68 | # Yarn 69 | .yarn/* 70 | !.yarn/patches 71 | !.yarn/plugins 72 | !.yarn/releases 73 | !.yarn/sdks 74 | !.yarn/versions 75 | -------------------------------------------------------------------------------- /Example/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | arrowParens: 'avoid', 3 | bracketSameLine: true, 4 | bracketSpacing: false, 5 | singleQuote: true, 6 | trailingComma: 'all', 7 | }; 8 | -------------------------------------------------------------------------------- /Example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /Example/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version 4 | ruby ">= 2.6.10" 5 | 6 | # Exclude problematic versions of cocoapods and activesupport that causes build failures. 7 | gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1' 8 | gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0' 9 | -------------------------------------------------------------------------------- /Example/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (3.0.7) 5 | base64 6 | nkf 7 | rexml 8 | activesupport (7.0.8.1) 9 | concurrent-ruby (~> 1.0, >= 1.0.2) 10 | i18n (>= 1.6, < 2) 11 | minitest (>= 5.1) 12 | tzinfo (~> 2.0) 13 | addressable (2.8.6) 14 | public_suffix (>= 2.0.2, < 6.0) 15 | algoliasearch (1.27.5) 16 | httpclient (~> 2.8, >= 2.8.3) 17 | json (>= 1.5.1) 18 | atomos (0.1.3) 19 | base64 (0.2.0) 20 | claide (1.1.0) 21 | cocoapods (1.14.3) 22 | addressable (~> 2.8) 23 | claide (>= 1.0.2, < 2.0) 24 | cocoapods-core (= 1.14.3) 25 | cocoapods-deintegrate (>= 1.0.3, < 2.0) 26 | cocoapods-downloader (>= 2.1, < 3.0) 27 | cocoapods-plugins (>= 1.0.0, < 2.0) 28 | cocoapods-search (>= 1.0.0, < 2.0) 29 | cocoapods-trunk (>= 1.6.0, < 2.0) 30 | cocoapods-try (>= 1.1.0, < 2.0) 31 | colored2 (~> 3.1) 32 | escape (~> 0.0.4) 33 | fourflusher (>= 2.3.0, < 3.0) 34 | gh_inspector (~> 1.0) 35 | molinillo (~> 0.8.0) 36 | nap (~> 1.0) 37 | ruby-macho (>= 2.3.0, < 3.0) 38 | xcodeproj (>= 1.23.0, < 2.0) 39 | cocoapods-core (1.14.3) 40 | activesupport (>= 5.0, < 8) 41 | addressable (~> 2.8) 42 | algoliasearch (~> 1.0) 43 | concurrent-ruby (~> 1.1) 44 | fuzzy_match (~> 2.0.4) 45 | nap (~> 1.0) 46 | netrc (~> 0.11) 47 | public_suffix (~> 4.0) 48 | typhoeus (~> 1.0) 49 | cocoapods-deintegrate (1.0.5) 50 | cocoapods-downloader (2.1) 51 | cocoapods-plugins (1.0.0) 52 | nap 53 | cocoapods-search (1.0.1) 54 | cocoapods-trunk (1.6.0) 55 | nap (>= 0.8, < 2.0) 56 | netrc (~> 0.11) 57 | cocoapods-try (1.2.0) 58 | colored2 (3.1.2) 59 | concurrent-ruby (1.2.3) 60 | escape (0.0.4) 61 | ethon (0.16.0) 62 | ffi (>= 1.15.0) 63 | ffi (1.16.3) 64 | fourflusher (2.3.1) 65 | fuzzy_match (2.0.4) 66 | gh_inspector (1.1.3) 67 | httpclient (2.8.3) 68 | i18n (1.14.4) 69 | concurrent-ruby (~> 1.0) 70 | json (2.7.1) 71 | minitest (5.22.3) 72 | molinillo (0.8.0) 73 | nanaimo (0.3.0) 74 | nap (1.1.0) 75 | netrc (0.11.0) 76 | nkf (0.2.0) 77 | public_suffix (4.0.7) 78 | rexml (3.2.6) 79 | ruby-macho (2.5.1) 80 | typhoeus (1.4.1) 81 | ethon (>= 0.9.0) 82 | tzinfo (2.0.6) 83 | concurrent-ruby (~> 1.0) 84 | xcodeproj (1.24.0) 85 | CFPropertyList (>= 2.3.3, < 4.0) 86 | atomos (~> 0.1.3) 87 | claide (>= 1.0.2, < 2.0) 88 | colored2 (~> 3.1) 89 | nanaimo (~> 0.3.0) 90 | rexml (~> 3.2.4) 91 | 92 | PLATFORMS 93 | ruby 94 | 95 | DEPENDENCIES 96 | activesupport (>= 6.1.7.5, != 7.1.0) 97 | cocoapods (>= 1.13, != 1.15.1, != 1.15.0) 98 | 99 | RUBY VERSION 100 | ruby 3.0.0p0 101 | 102 | BUNDLED WITH 103 | 2.5.6 104 | -------------------------------------------------------------------------------- /Example/README.md: -------------------------------------------------------------------------------- 1 | # QRCode SVG Example App 2 | 3 | ## Step 1: Install dependencies 4 | 5 | Install dependencies in both root and Example directories. 6 | 7 | ```bash 8 | npm install && cd Example 9 | yarn install 10 | ``` 11 | 12 | ## Step 2: Start Example Native Application 13 | 14 | First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native. 15 | 16 | To start Metro, run the following command: 17 | 18 | ```bash 19 | yarn start 20 | ``` 21 | 22 | Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your Example app directory . 23 | Run the following command to start your _Android_ or _iOS_ app: 24 | 25 | ### For Android 26 | 27 | ```bash 28 | yarn android 29 | ``` 30 | 31 | ### For iOS 32 | 33 | ```bash 34 | cd ios && pod install && cd .. 35 | yarn ios 36 | ``` 37 | 38 | If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly. 39 | 40 | ## Step 3: Start Example Web Application 41 | 42 | Just run 43 | 44 | ```bash 45 | yarn web 46 | ``` 47 | 48 | and enter the `http://localhost:8080/`. 49 | -------------------------------------------------------------------------------- /Example/__tests__/App.test.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../src/App.tsx'; 8 | 9 | // Note: import explicitly to use the types shipped with jest. 10 | import {it} from '@jest/globals'; 11 | 12 | // Note: test renderer must be required after react-native. 13 | import renderer from 'react-test-renderer'; 14 | 15 | it('renders correctly', () => { 16 | renderer.create(); 17 | }); 18 | -------------------------------------------------------------------------------- /Example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | apply plugin: "org.jetbrains.kotlin.android" 3 | apply plugin: "com.facebook.react" 4 | 5 | /** 6 | * This is the configuration block to customize your React Native Android app. 7 | * By default you don't need to apply any configuration, just uncomment the lines you need. 8 | */ 9 | react { 10 | /* Folders */ 11 | // The root of your project, i.e. where "package.json" lives. Default is '..' 12 | // root = file("../") 13 | // The folder where the react-native NPM package is. Default is ../node_modules/react-native 14 | // reactNativeDir = file("../node_modules/react-native") 15 | // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen 16 | // codegenDir = file("../node_modules/@react-native/codegen") 17 | // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js 18 | // cliFile = file("../node_modules/react-native/cli.js") 19 | 20 | /* Variants */ 21 | // The list of variants to that are debuggable. For those we're going to 22 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'. 23 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. 24 | // debuggableVariants = ["liteDebug", "prodDebug"] 25 | 26 | /* Bundling */ 27 | // A list containing the node command and its flags. Default is just 'node'. 28 | // nodeExecutableAndArgs = ["node"] 29 | // 30 | // The command to run when bundling. By default is 'bundle' 31 | // bundleCommand = "ram-bundle" 32 | // 33 | // The path to the CLI configuration file. Default is empty. 34 | // bundleConfig = file(../rn-cli.config.js) 35 | // 36 | // The name of the generated asset file containing your JS bundle 37 | // bundleAssetName = "MyApplication.android.bundle" 38 | // 39 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' 40 | // entryFile = file("../js/MyApplication.android.js") 41 | // 42 | // A list of extra flags to pass to the 'bundle' commands. 43 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle 44 | // extraPackagerArgs = [] 45 | 46 | /* Hermes Commands */ 47 | // The hermes compiler command to run. By default it is 'hermesc' 48 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" 49 | // 50 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" 51 | // hermesFlags = ["-O", "-output-source-map"] 52 | 53 | /* Autolinking */ 54 | autolinkLibrariesWithApp() 55 | } 56 | 57 | /** 58 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode. 59 | */ 60 | def enableProguardInReleaseBuilds = false 61 | 62 | /** 63 | * The preferred build flavor of JavaScriptCore (JSC) 64 | * 65 | * For example, to use the international variant, you can use: 66 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 67 | * 68 | * The international variant includes ICU i18n library and necessary data 69 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 70 | * give correct results when using with locales other than en-US. Note that 71 | * this variant is about 6MiB larger per architecture than default. 72 | */ 73 | def jscFlavor = 'org.webkit:android-jsc:+' 74 | 75 | android { 76 | ndkVersion rootProject.ext.ndkVersion 77 | buildToolsVersion rootProject.ext.buildToolsVersion 78 | compileSdk rootProject.ext.compileSdkVersion 79 | 80 | namespace "com.example" 81 | defaultConfig { 82 | applicationId "com.example" 83 | minSdkVersion rootProject.ext.minSdkVersion 84 | targetSdkVersion rootProject.ext.targetSdkVersion 85 | versionCode 1 86 | versionName "1.0" 87 | } 88 | signingConfigs { 89 | debug { 90 | storeFile file('debug.keystore') 91 | storePassword 'android' 92 | keyAlias 'androiddebugkey' 93 | keyPassword 'android' 94 | } 95 | } 96 | buildTypes { 97 | debug { 98 | signingConfig signingConfigs.debug 99 | } 100 | release { 101 | // Caution! In production, you need to generate your own keystore file. 102 | // see https://reactnative.dev/docs/signed-apk-android. 103 | signingConfig signingConfigs.debug 104 | minifyEnabled enableProguardInReleaseBuilds 105 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 106 | } 107 | } 108 | } 109 | 110 | dependencies { 111 | // The version of react-native is set by the React Native Gradle Plugin 112 | implementation("com.facebook.react:react-android") 113 | 114 | if (hermesEnabled.toBoolean()) { 115 | implementation("com.facebook.react:hermes-android") 116 | } else { 117 | implementation jscFlavor 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /Example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/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 | 9 | 10 | -------------------------------------------------------------------------------- /Example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 13 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | import com.facebook.react.ReactActivity 4 | import com.facebook.react.ReactActivityDelegate 5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled 6 | import com.facebook.react.defaults.DefaultReactActivityDelegate 7 | 8 | class MainActivity : 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 fun getMainComponentName(): String = "Example" 15 | 16 | /** 17 | * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] 18 | * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] 19 | */ 20 | override fun createReactActivityDelegate(): ReactActivityDelegate = 21 | DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) 22 | } 23 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/example/MainApplication.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | import android.app.Application 4 | import com.facebook.react.PackageList 5 | import com.facebook.react.ReactApplication 6 | import com.facebook.react.ReactHost 7 | import com.facebook.react.ReactNativeHost 8 | import com.facebook.react.ReactPackage 9 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load 10 | import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost 11 | import com.facebook.react.defaults.DefaultReactNativeHost 12 | import com.facebook.soloader.SoLoader 13 | 14 | class MainApplication : Application(), ReactApplication { 15 | 16 | override val reactNativeHost: ReactNativeHost = 17 | object : DefaultReactNativeHost(this) { 18 | override fun getPackages(): List = 19 | PackageList(this).packages.apply { 20 | // Packages that cannot be autolinked yet can be added manually here, for example: 21 | // add(MyReactNativePackage()) 22 | } 23 | 24 | override fun getJSMainModuleName(): String = "index" 25 | 26 | override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG 27 | 28 | override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED 29 | override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED 30 | } 31 | 32 | override val reactHost: ReactHost 33 | get() = getDefaultReactHost(applicationContext, reactNativeHost) 34 | 35 | override fun onCreate() { 36 | super.onCreate() 37 | SoLoader.init(this, false) 38 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { 39 | // If you opted-in for the New Architecture, we load the native entry point for this app. 40 | load() 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/drawable/rn_edit_text_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 21 | 22 | 23 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/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/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/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/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/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/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/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/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/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/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/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/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/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/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/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/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/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/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/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 | buildscript { 2 | ext { 3 | buildToolsVersion = "34.0.0" 4 | minSdkVersion = 23 5 | compileSdkVersion = 34 6 | targetSdkVersion = 34 7 | ndkVersion = "26.1.10909125" 8 | kotlinVersion = "1.9.24" 9 | } 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle") 16 | classpath("com.facebook.react:react-native-gradle-plugin") 17 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") 18 | } 19 | } 20 | 21 | apply plugin: "com.facebook.react.rootproject" 22 | -------------------------------------------------------------------------------- /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: -Xmx512m -XX:MaxMetaspaceSize=256m 13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m 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 | 25 | # Use this property to specify which architecture you want to build. 26 | # You can also override it from the CLI using 27 | # ./gradlew -PreactNativeArchitectures=x86_64 28 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 29 | 30 | # Use this property to enable support to the new architecture. 31 | # This will allow you to use TurboModules and the Fabric render in 32 | # your application. You should enable this flag either if you want 33 | # to write custom TurboModules/Fabric components OR use libraries that 34 | # are providing them. 35 | newArchEnabled=false 36 | 37 | # Use this property to enable or disable the Hermes JS engine. 38 | # If set to false, you will be using JSC instead. 39 | hermesEnabled=true 40 | -------------------------------------------------------------------------------- /Example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/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-8.8-all.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /Example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original 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 POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 88 | 89 | # Use the maximum available, or set MAX_FD != -1 to use that value. 90 | MAX_FD=maximum 91 | 92 | warn () { 93 | echo "$*" 94 | } >&2 95 | 96 | die () { 97 | echo 98 | echo "$*" 99 | echo 100 | exit 1 101 | } >&2 102 | 103 | # OS specific support (must be 'true' or 'false'). 104 | cygwin=false 105 | msys=false 106 | darwin=false 107 | nonstop=false 108 | case "$( uname )" in #( 109 | CYGWIN* ) cygwin=true ;; #( 110 | Darwin* ) darwin=true ;; #( 111 | MSYS* | MINGW* ) msys=true ;; #( 112 | NONSTOP* ) nonstop=true ;; 113 | esac 114 | 115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 116 | 117 | 118 | # Determine the Java command to use to start the JVM. 119 | if [ -n "$JAVA_HOME" ] ; then 120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 121 | # IBM's JDK on AIX uses strange locations for the executables 122 | JAVACMD=$JAVA_HOME/jre/sh/java 123 | else 124 | JAVACMD=$JAVA_HOME/bin/java 125 | fi 126 | if [ ! -x "$JAVACMD" ] ; then 127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 128 | 129 | Please set the JAVA_HOME variable in your environment to match the 130 | location of your Java installation." 131 | fi 132 | else 133 | JAVACMD=java 134 | if ! command -v java >/dev/null 2>&1 135 | then 136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | fi 142 | 143 | # Increase the maximum file descriptors if we can. 144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 145 | case $MAX_FD in #( 146 | max*) 147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 148 | # shellcheck disable=SC3045 149 | MAX_FD=$( ulimit -H -n ) || 150 | warn "Could not query maximum file descriptor limit" 151 | esac 152 | case $MAX_FD in #( 153 | '' | soft) :;; #( 154 | *) 155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 156 | # shellcheck disable=SC3045 157 | ulimit -n "$MAX_FD" || 158 | warn "Could not set maximum file descriptor limit to $MAX_FD" 159 | esac 160 | fi 161 | 162 | # Collect all arguments for the java command, stacking in reverse order: 163 | # * args from the command line 164 | # * the main class name 165 | # * -classpath 166 | # * -D...appname settings 167 | # * --module-path (only if needed) 168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 169 | 170 | # For Cygwin or MSYS, switch paths to Windows format before running java 171 | if "$cygwin" || "$msys" ; then 172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command; 206 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 207 | # shell script including quotes and variable substitutions, so put them in 208 | # double quotes to make sure that they get re-expanded; and 209 | # * put everything else in single quotes, so that it's not re-expanded. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -classpath "$CLASSPATH" \ 214 | org.gradle.wrapper.GradleWrapperMain \ 215 | "$@" 216 | 217 | # Stop when "xargs" is not available. 218 | if ! command -v xargs >/dev/null 2>&1 219 | then 220 | die "xargs is not available" 221 | fi 222 | 223 | # Use "xargs" to parse quoted args. 224 | # 225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 226 | # 227 | # In Bash we could simply go: 228 | # 229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 230 | # set -- "${ARGS[@]}" "$@" 231 | # 232 | # but POSIX shell has neither arrays nor command substitution, so instead we 233 | # post-process each arg (as a line of input to sed) to backslash-escape any 234 | # character that might be a shell metacharacter, then use eval to reverse 235 | # that process (while maintaining the separation between arguments), and wrap 236 | # the whole thing up as a single "set" statement. 237 | # 238 | # This will of course break if any of these variables contains a newline or 239 | # an unmatched quote. 240 | # 241 | 242 | eval "set -- $( 243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 244 | xargs -n1 | 245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 246 | tr '\n' ' ' 247 | )" '"$@"' 248 | 249 | exec "$JAVACMD" "$@" 250 | -------------------------------------------------------------------------------- /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 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /Example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } 2 | plugins { id("com.facebook.react.settings") } 3 | extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() } 4 | rootProject.name = 'Example' 5 | include ':app' 6 | includeBuild('../node_modules/@react-native/gradle-plugin') 7 | -------------------------------------------------------------------------------- /Example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Example", 3 | "displayName": "Example" 4 | } 5 | -------------------------------------------------------------------------------- /Example/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:@react-native/babel-preset'], 3 | plugins: ['@babel/plugin-proposal-export-namespace-from'], 4 | }; 5 | -------------------------------------------------------------------------------- /Example/dist/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | react-native-qrcode-svg example 7 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/global.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.svg' { 2 | import type React from 'react'; 3 | import type {SvgProps} from 'react-native-svg'; 4 | 5 | const content: React.FC; 6 | export default content; 7 | } 8 | -------------------------------------------------------------------------------- /Example/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './src/App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | 11 | if (typeof document !== 'undefined') { 12 | const rootTag = document.getElementById('root'); 13 | AppRegistry.runApplication(appName, {rootTag}); 14 | } 15 | -------------------------------------------------------------------------------- /Example/ios/.xcode.env: -------------------------------------------------------------------------------- 1 | # This `.xcode.env` file is versioned and is used to source the environment 2 | # used when running script phases inside Xcode. 3 | # To customize your local environment, you can create an `.xcode.env.local` 4 | # file that is not versioned. 5 | 6 | # NODE_BINARY variable contains the PATH to the node executable. 7 | # 8 | # Customize the NODE_BINARY variable here. 9 | # For example, to use nvm with brew, add the following line 10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use 11 | export NODE_BINARY=$(command -v node) 12 | -------------------------------------------------------------------------------- /Example/ios/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 00E356F31AD99517003FC87E /* ExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ExampleTests.m */; }; 11 | 0C80B921A6F3F58F76C31292 /* libPods-Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-Example.a */; }; 12 | 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; }; 13 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 14 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 15 | 23C8E92FACEE21A27366D508 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = C5204FD6204212742B840957 /* PrivacyInfo.xcprivacy */; }; 16 | 7699B88040F8A987B510C191 /* libPods-Example-ExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-Example-ExampleTests.a */; }; 17 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 26 | remoteInfo = Example; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 00E356EE1AD99517003FC87E /* ExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | 00E356F21AD99517003FC87E /* ExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExampleTests.m; sourceTree = ""; }; 34 | 13B07F961A680F5B00A75B9A /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Example/AppDelegate.h; sourceTree = ""; }; 36 | 13B07FB01A68108700A75B9A /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = Example/AppDelegate.mm; sourceTree = ""; }; 37 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Example/Images.xcassets; sourceTree = ""; }; 38 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Example/Info.plist; sourceTree = ""; }; 39 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Example/main.m; sourceTree = ""; }; 40 | 19F6CBCC0A4E27FBF8BF4A61 /* libPods-Example-ExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example-ExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 3B4392A12AC88292D35C810B /* 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 = ""; }; 42 | 5709B34CF0A7D63546082F79 /* 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 = ""; }; 43 | 5B7EB9410499542E8C5724F5 /* 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 = ""; }; 44 | 5DCACB8F33CDC322A6C60F78 /* libPods-Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = Example/LaunchScreen.storyboard; sourceTree = ""; }; 46 | 89C6BE57DB24E9ADA2F236DE /* 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 = ""; }; 47 | C5204FD6204212742B840957 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = Example/PrivacyInfo.xcprivacy; sourceTree = ""; }; 48 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 49 | /* End PBXFileReference section */ 50 | 51 | /* Begin PBXFrameworksBuildPhase section */ 52 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 53 | isa = PBXFrameworksBuildPhase; 54 | buildActionMask = 2147483647; 55 | files = ( 56 | 7699B88040F8A987B510C191 /* libPods-Example-ExampleTests.a in Frameworks */, 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | 0C80B921A6F3F58F76C31292 /* libPods-Example.a in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 00E356EF1AD99517003FC87E /* ExampleTests */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 00E356F21AD99517003FC87E /* ExampleTests.m */, 75 | 00E356F01AD99517003FC87E /* Supporting Files */, 76 | ); 77 | path = ExampleTests; 78 | sourceTree = ""; 79 | }; 80 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 00E356F11AD99517003FC87E /* Info.plist */, 84 | ); 85 | name = "Supporting Files"; 86 | sourceTree = ""; 87 | }; 88 | 13B07FAE1A68108700A75B9A /* Example */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 92 | 13B07FB01A68108700A75B9A /* AppDelegate.mm */, 93 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 94 | 13B07FB61A68108700A75B9A /* Info.plist */, 95 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, 96 | 13B07FB71A68108700A75B9A /* main.m */, 97 | C5204FD6204212742B840957 /* PrivacyInfo.xcprivacy */, 98 | ); 99 | name = Example; 100 | sourceTree = ""; 101 | }; 102 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 106 | 5DCACB8F33CDC322A6C60F78 /* libPods-Example.a */, 107 | 19F6CBCC0A4E27FBF8BF4A61 /* libPods-Example-ExampleTests.a */, 108 | ); 109 | name = Frameworks; 110 | sourceTree = ""; 111 | }; 112 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | ); 116 | name = Libraries; 117 | sourceTree = ""; 118 | }; 119 | 83CBB9F61A601CBA00E9B192 = { 120 | isa = PBXGroup; 121 | children = ( 122 | 13B07FAE1A68108700A75B9A /* Example */, 123 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 124 | 00E356EF1AD99517003FC87E /* ExampleTests */, 125 | 83CBBA001A601CBA00E9B192 /* Products */, 126 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 127 | BBD78D7AC51CEA395F1C20DB /* Pods */, 128 | ); 129 | indentWidth = 2; 130 | sourceTree = ""; 131 | tabWidth = 2; 132 | usesTabs = 0; 133 | }; 134 | 83CBBA001A601CBA00E9B192 /* Products */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 13B07F961A680F5B00A75B9A /* Example.app */, 138 | 00E356EE1AD99517003FC87E /* ExampleTests.xctest */, 139 | ); 140 | name = Products; 141 | sourceTree = ""; 142 | }; 143 | BBD78D7AC51CEA395F1C20DB /* Pods */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 3B4392A12AC88292D35C810B /* Pods-Example.debug.xcconfig */, 147 | 5709B34CF0A7D63546082F79 /* Pods-Example.release.xcconfig */, 148 | 5B7EB9410499542E8C5724F5 /* Pods-Example-ExampleTests.debug.xcconfig */, 149 | 89C6BE57DB24E9ADA2F236DE /* Pods-Example-ExampleTests.release.xcconfig */, 150 | ); 151 | path = Pods; 152 | sourceTree = ""; 153 | }; 154 | /* End PBXGroup section */ 155 | 156 | /* Begin PBXNativeTarget section */ 157 | 00E356ED1AD99517003FC87E /* ExampleTests */ = { 158 | isa = PBXNativeTarget; 159 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ExampleTests" */; 160 | buildPhases = ( 161 | A55EABD7B0C7F3A422A6CC61 /* [CP] Check Pods Manifest.lock */, 162 | 00E356EA1AD99517003FC87E /* Sources */, 163 | 00E356EB1AD99517003FC87E /* Frameworks */, 164 | 00E356EC1AD99517003FC87E /* Resources */, 165 | C59DA0FBD6956966B86A3779 /* [CP] Embed Pods Frameworks */, 166 | F6A41C54EA430FDDC6A6ED99 /* [CP] Copy Pods Resources */, 167 | ); 168 | buildRules = ( 169 | ); 170 | dependencies = ( 171 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 172 | ); 173 | name = ExampleTests; 174 | productName = ExampleTests; 175 | productReference = 00E356EE1AD99517003FC87E /* ExampleTests.xctest */; 176 | productType = "com.apple.product-type.bundle.unit-test"; 177 | }; 178 | 13B07F861A680F5B00A75B9A /* Example */ = { 179 | isa = PBXNativeTarget; 180 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Example" */; 181 | buildPhases = ( 182 | C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */, 183 | 13B07F871A680F5B00A75B9A /* Sources */, 184 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 185 | 13B07F8E1A680F5B00A75B9A /* Resources */, 186 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 187 | 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */, 188 | E235C05ADACE081382539298 /* [CP] Copy Pods Resources */, 189 | ); 190 | buildRules = ( 191 | ); 192 | dependencies = ( 193 | ); 194 | name = Example; 195 | productName = Example; 196 | productReference = 13B07F961A680F5B00A75B9A /* Example.app */; 197 | productType = "com.apple.product-type.application"; 198 | }; 199 | /* End PBXNativeTarget section */ 200 | 201 | /* Begin PBXProject section */ 202 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 203 | isa = PBXProject; 204 | attributes = { 205 | LastUpgradeCheck = 1210; 206 | TargetAttributes = { 207 | 00E356ED1AD99517003FC87E = { 208 | CreatedOnToolsVersion = 6.2; 209 | TestTargetID = 13B07F861A680F5B00A75B9A; 210 | }; 211 | 13B07F861A680F5B00A75B9A = { 212 | LastSwiftMigration = 1120; 213 | }; 214 | }; 215 | }; 216 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Example" */; 217 | compatibilityVersion = "Xcode 12.0"; 218 | developmentRegion = en; 219 | hasScannedForEncodings = 0; 220 | knownRegions = ( 221 | en, 222 | Base, 223 | ); 224 | mainGroup = 83CBB9F61A601CBA00E9B192; 225 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 226 | projectDirPath = ""; 227 | projectRoot = ""; 228 | targets = ( 229 | 13B07F861A680F5B00A75B9A /* Example */, 230 | 00E356ED1AD99517003FC87E /* ExampleTests */, 231 | ); 232 | }; 233 | /* End PBXProject section */ 234 | 235 | /* Begin PBXResourcesBuildPhase section */ 236 | 00E356EC1AD99517003FC87E /* Resources */ = { 237 | isa = PBXResourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | }; 243 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 244 | isa = PBXResourcesBuildPhase; 245 | buildActionMask = 2147483647; 246 | files = ( 247 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */, 248 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 249 | 23C8E92FACEE21A27366D508 /* PrivacyInfo.xcprivacy in Resources */, 250 | ); 251 | runOnlyForDeploymentPostprocessing = 0; 252 | }; 253 | /* End PBXResourcesBuildPhase section */ 254 | 255 | /* Begin PBXShellScriptBuildPhase section */ 256 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 257 | isa = PBXShellScriptBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | ); 261 | inputPaths = ( 262 | "$(SRCROOT)/.xcode.env.local", 263 | "$(SRCROOT)/.xcode.env", 264 | ); 265 | name = "Bundle React Native code and images"; 266 | outputPaths = ( 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | shellPath = /bin/sh; 270 | shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n"; 271 | }; 272 | 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = { 273 | isa = PBXShellScriptBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | ); 277 | inputFileListPaths = ( 278 | "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks-${CONFIGURATION}-input-files.xcfilelist", 279 | ); 280 | name = "[CP] Embed Pods Frameworks"; 281 | outputFileListPaths = ( 282 | "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks-${CONFIGURATION}-output-files.xcfilelist", 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | shellPath = /bin/sh; 286 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n"; 287 | showEnvVarsInLog = 0; 288 | }; 289 | A55EABD7B0C7F3A422A6CC61 /* [CP] Check Pods Manifest.lock */ = { 290 | isa = PBXShellScriptBuildPhase; 291 | buildActionMask = 2147483647; 292 | files = ( 293 | ); 294 | inputFileListPaths = ( 295 | ); 296 | inputPaths = ( 297 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 298 | "${PODS_ROOT}/Manifest.lock", 299 | ); 300 | name = "[CP] Check Pods Manifest.lock"; 301 | outputFileListPaths = ( 302 | ); 303 | outputPaths = ( 304 | "$(DERIVED_FILE_DIR)/Pods-Example-ExampleTests-checkManifestLockResult.txt", 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | shellPath = /bin/sh; 308 | 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"; 309 | showEnvVarsInLog = 0; 310 | }; 311 | C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = { 312 | isa = PBXShellScriptBuildPhase; 313 | buildActionMask = 2147483647; 314 | files = ( 315 | ); 316 | inputFileListPaths = ( 317 | ); 318 | inputPaths = ( 319 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 320 | "${PODS_ROOT}/Manifest.lock", 321 | ); 322 | name = "[CP] Check Pods Manifest.lock"; 323 | outputFileListPaths = ( 324 | ); 325 | outputPaths = ( 326 | "$(DERIVED_FILE_DIR)/Pods-Example-checkManifestLockResult.txt", 327 | ); 328 | runOnlyForDeploymentPostprocessing = 0; 329 | shellPath = /bin/sh; 330 | 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"; 331 | showEnvVarsInLog = 0; 332 | }; 333 | C59DA0FBD6956966B86A3779 /* [CP] Embed Pods Frameworks */ = { 334 | isa = PBXShellScriptBuildPhase; 335 | buildActionMask = 2147483647; 336 | files = ( 337 | ); 338 | inputFileListPaths = ( 339 | "${PODS_ROOT}/Target Support Files/Pods-Example-ExampleTests/Pods-Example-ExampleTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", 340 | ); 341 | name = "[CP] Embed Pods Frameworks"; 342 | outputFileListPaths = ( 343 | "${PODS_ROOT}/Target Support Files/Pods-Example-ExampleTests/Pods-Example-ExampleTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", 344 | ); 345 | runOnlyForDeploymentPostprocessing = 0; 346 | shellPath = /bin/sh; 347 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example-ExampleTests/Pods-Example-ExampleTests-frameworks.sh\"\n"; 348 | showEnvVarsInLog = 0; 349 | }; 350 | E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = { 351 | isa = PBXShellScriptBuildPhase; 352 | buildActionMask = 2147483647; 353 | files = ( 354 | ); 355 | inputFileListPaths = ( 356 | "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-input-files.xcfilelist", 357 | ); 358 | name = "[CP] Copy Pods Resources"; 359 | outputFileListPaths = ( 360 | "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-output-files.xcfilelist", 361 | ); 362 | runOnlyForDeploymentPostprocessing = 0; 363 | shellPath = /bin/sh; 364 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n"; 365 | showEnvVarsInLog = 0; 366 | }; 367 | F6A41C54EA430FDDC6A6ED99 /* [CP] Copy Pods Resources */ = { 368 | isa = PBXShellScriptBuildPhase; 369 | buildActionMask = 2147483647; 370 | files = ( 371 | ); 372 | inputFileListPaths = ( 373 | "${PODS_ROOT}/Target Support Files/Pods-Example-ExampleTests/Pods-Example-ExampleTests-resources-${CONFIGURATION}-input-files.xcfilelist", 374 | ); 375 | name = "[CP] Copy Pods Resources"; 376 | outputFileListPaths = ( 377 | "${PODS_ROOT}/Target Support Files/Pods-Example-ExampleTests/Pods-Example-ExampleTests-resources-${CONFIGURATION}-output-files.xcfilelist", 378 | ); 379 | runOnlyForDeploymentPostprocessing = 0; 380 | shellPath = /bin/sh; 381 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example-ExampleTests/Pods-Example-ExampleTests-resources.sh\"\n"; 382 | showEnvVarsInLog = 0; 383 | }; 384 | /* End PBXShellScriptBuildPhase section */ 385 | 386 | /* Begin PBXSourcesBuildPhase section */ 387 | 00E356EA1AD99517003FC87E /* Sources */ = { 388 | isa = PBXSourcesBuildPhase; 389 | buildActionMask = 2147483647; 390 | files = ( 391 | 00E356F31AD99517003FC87E /* ExampleTests.m in Sources */, 392 | ); 393 | runOnlyForDeploymentPostprocessing = 0; 394 | }; 395 | 13B07F871A680F5B00A75B9A /* Sources */ = { 396 | isa = PBXSourcesBuildPhase; 397 | buildActionMask = 2147483647; 398 | files = ( 399 | 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */, 400 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 401 | ); 402 | runOnlyForDeploymentPostprocessing = 0; 403 | }; 404 | /* End PBXSourcesBuildPhase section */ 405 | 406 | /* Begin PBXTargetDependency section */ 407 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 408 | isa = PBXTargetDependency; 409 | target = 13B07F861A680F5B00A75B9A /* Example */; 410 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 411 | }; 412 | /* End PBXTargetDependency section */ 413 | 414 | /* Begin XCBuildConfiguration section */ 415 | 00E356F61AD99517003FC87E /* Debug */ = { 416 | isa = XCBuildConfiguration; 417 | baseConfigurationReference = 5B7EB9410499542E8C5724F5 /* Pods-Example-ExampleTests.debug.xcconfig */; 418 | buildSettings = { 419 | BUNDLE_LOADER = "$(TEST_HOST)"; 420 | GCC_PREPROCESSOR_DEFINITIONS = ( 421 | "DEBUG=1", 422 | "$(inherited)", 423 | ); 424 | INFOPLIST_FILE = ExampleTests/Info.plist; 425 | IPHONEOS_DEPLOYMENT_TARGET = 13.4; 426 | LD_RUNPATH_SEARCH_PATHS = ( 427 | "$(inherited)", 428 | "@executable_path/Frameworks", 429 | "@loader_path/Frameworks", 430 | ); 431 | OTHER_LDFLAGS = ( 432 | "-ObjC", 433 | "-lc++", 434 | "$(inherited)", 435 | ); 436 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 437 | PRODUCT_NAME = "$(TARGET_NAME)"; 438 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; 439 | }; 440 | name = Debug; 441 | }; 442 | 00E356F71AD99517003FC87E /* Release */ = { 443 | isa = XCBuildConfiguration; 444 | baseConfigurationReference = 89C6BE57DB24E9ADA2F236DE /* Pods-Example-ExampleTests.release.xcconfig */; 445 | buildSettings = { 446 | BUNDLE_LOADER = "$(TEST_HOST)"; 447 | COPY_PHASE_STRIP = NO; 448 | INFOPLIST_FILE = ExampleTests/Info.plist; 449 | IPHONEOS_DEPLOYMENT_TARGET = 13.4; 450 | LD_RUNPATH_SEARCH_PATHS = ( 451 | "$(inherited)", 452 | "@executable_path/Frameworks", 453 | "@loader_path/Frameworks", 454 | ); 455 | OTHER_LDFLAGS = ( 456 | "-ObjC", 457 | "-lc++", 458 | "$(inherited)", 459 | ); 460 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 461 | PRODUCT_NAME = "$(TARGET_NAME)"; 462 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; 463 | }; 464 | name = Release; 465 | }; 466 | 13B07F941A680F5B00A75B9A /* Debug */ = { 467 | isa = XCBuildConfiguration; 468 | baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-Example.debug.xcconfig */; 469 | buildSettings = { 470 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 471 | CLANG_ENABLE_MODULES = YES; 472 | CODE_SIGN_IDENTITY = "Apple Development"; 473 | CODE_SIGN_STYLE = Automatic; 474 | CURRENT_PROJECT_VERSION = 1; 475 | DEVELOPMENT_TEAM = N95RU98ZB3; 476 | ENABLE_BITCODE = NO; 477 | INFOPLIST_FILE = Example/Info.plist; 478 | INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools"; 479 | LD_RUNPATH_SEARCH_PATHS = ( 480 | "$(inherited)", 481 | "@executable_path/Frameworks", 482 | ); 483 | MARKETING_VERSION = 1.0; 484 | OTHER_LDFLAGS = ( 485 | "$(inherited)", 486 | "-ObjC", 487 | "-lc++", 488 | ); 489 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 490 | PRODUCT_NAME = Example; 491 | PROVISIONING_PROFILE_SPECIFIER = ""; 492 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 493 | SWIFT_VERSION = 5.0; 494 | VERSIONING_SYSTEM = "apple-generic"; 495 | }; 496 | name = Debug; 497 | }; 498 | 13B07F951A680F5B00A75B9A /* Release */ = { 499 | isa = XCBuildConfiguration; 500 | baseConfigurationReference = 5709B34CF0A7D63546082F79 /* Pods-Example.release.xcconfig */; 501 | buildSettings = { 502 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 503 | CLANG_ENABLE_MODULES = YES; 504 | CODE_SIGN_IDENTITY = "Apple Development"; 505 | CODE_SIGN_STYLE = Automatic; 506 | CURRENT_PROJECT_VERSION = 1; 507 | DEVELOPMENT_TEAM = N95RU98ZB3; 508 | INFOPLIST_FILE = Example/Info.plist; 509 | INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools"; 510 | LD_RUNPATH_SEARCH_PATHS = ( 511 | "$(inherited)", 512 | "@executable_path/Frameworks", 513 | ); 514 | MARKETING_VERSION = 1.0; 515 | OTHER_LDFLAGS = ( 516 | "$(inherited)", 517 | "-ObjC", 518 | "-lc++", 519 | ); 520 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 521 | PRODUCT_NAME = Example; 522 | PROVISIONING_PROFILE_SPECIFIER = ""; 523 | SWIFT_VERSION = 5.0; 524 | VERSIONING_SYSTEM = "apple-generic"; 525 | }; 526 | name = Release; 527 | }; 528 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 529 | isa = XCBuildConfiguration; 530 | buildSettings = { 531 | ALWAYS_SEARCH_USER_PATHS = NO; 532 | CC = ""; 533 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 534 | CLANG_CXX_LANGUAGE_STANDARD = "c++20"; 535 | CLANG_CXX_LIBRARY = "libc++"; 536 | CLANG_ENABLE_MODULES = YES; 537 | CLANG_ENABLE_OBJC_ARC = YES; 538 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 539 | CLANG_WARN_BOOL_CONVERSION = YES; 540 | CLANG_WARN_COMMA = YES; 541 | CLANG_WARN_CONSTANT_CONVERSION = YES; 542 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 543 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 544 | CLANG_WARN_EMPTY_BODY = YES; 545 | CLANG_WARN_ENUM_CONVERSION = YES; 546 | CLANG_WARN_INFINITE_RECURSION = YES; 547 | CLANG_WARN_INT_CONVERSION = YES; 548 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 549 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 550 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 551 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 552 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 553 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 554 | CLANG_WARN_STRICT_PROTOTYPES = YES; 555 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 556 | CLANG_WARN_UNREACHABLE_CODE = YES; 557 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 558 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 559 | COPY_PHASE_STRIP = NO; 560 | CXX = ""; 561 | ENABLE_STRICT_OBJC_MSGSEND = YES; 562 | ENABLE_TESTABILITY = YES; 563 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; 564 | GCC_C_LANGUAGE_STANDARD = gnu99; 565 | GCC_DYNAMIC_NO_PIC = NO; 566 | GCC_NO_COMMON_BLOCKS = YES; 567 | GCC_OPTIMIZATION_LEVEL = 0; 568 | GCC_PREPROCESSOR_DEFINITIONS = ( 569 | "DEBUG=1", 570 | "$(inherited)", 571 | ); 572 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 573 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 574 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 575 | GCC_WARN_UNDECLARED_SELECTOR = YES; 576 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 577 | GCC_WARN_UNUSED_FUNCTION = YES; 578 | GCC_WARN_UNUSED_VARIABLE = YES; 579 | IPHONEOS_DEPLOYMENT_TARGET = 13.4; 580 | LD = ""; 581 | LDPLUSPLUS = ""; 582 | LD_RUNPATH_SEARCH_PATHS = ( 583 | /usr/lib/swift, 584 | "$(inherited)", 585 | ); 586 | LIBRARY_SEARCH_PATHS = ( 587 | "\"$(SDKROOT)/usr/lib/swift\"", 588 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 589 | "\"$(inherited)\"", 590 | ); 591 | MTL_ENABLE_DEBUG_INFO = YES; 592 | ONLY_ACTIVE_ARCH = YES; 593 | OTHER_CFLAGS = "$(inherited)"; 594 | OTHER_CPLUSPLUSFLAGS = ( 595 | "$(OTHER_CFLAGS)", 596 | "-DFOLLY_NO_CONFIG", 597 | "-DFOLLY_MOBILE=1", 598 | "-DFOLLY_USE_LIBCPP=1", 599 | "-DFOLLY_CFG_NO_COROUTINES=1", 600 | ); 601 | OTHER_LDFLAGS = ( 602 | "$(inherited)", 603 | " ", 604 | ); 605 | REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; 606 | SDKROOT = iphoneos; 607 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; 608 | USE_HERMES = true; 609 | }; 610 | name = Debug; 611 | }; 612 | 83CBBA211A601CBA00E9B192 /* Release */ = { 613 | isa = XCBuildConfiguration; 614 | buildSettings = { 615 | ALWAYS_SEARCH_USER_PATHS = NO; 616 | CC = ""; 617 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 618 | CLANG_CXX_LANGUAGE_STANDARD = "c++20"; 619 | CLANG_CXX_LIBRARY = "libc++"; 620 | CLANG_ENABLE_MODULES = YES; 621 | CLANG_ENABLE_OBJC_ARC = YES; 622 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 623 | CLANG_WARN_BOOL_CONVERSION = YES; 624 | CLANG_WARN_COMMA = YES; 625 | CLANG_WARN_CONSTANT_CONVERSION = YES; 626 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 627 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 628 | CLANG_WARN_EMPTY_BODY = YES; 629 | CLANG_WARN_ENUM_CONVERSION = YES; 630 | CLANG_WARN_INFINITE_RECURSION = YES; 631 | CLANG_WARN_INT_CONVERSION = YES; 632 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 633 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 634 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 635 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 636 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 637 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 638 | CLANG_WARN_STRICT_PROTOTYPES = YES; 639 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 640 | CLANG_WARN_UNREACHABLE_CODE = YES; 641 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 642 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 643 | COPY_PHASE_STRIP = YES; 644 | CXX = ""; 645 | ENABLE_NS_ASSERTIONS = NO; 646 | ENABLE_STRICT_OBJC_MSGSEND = YES; 647 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; 648 | GCC_C_LANGUAGE_STANDARD = gnu99; 649 | GCC_NO_COMMON_BLOCKS = YES; 650 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 651 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 652 | GCC_WARN_UNDECLARED_SELECTOR = YES; 653 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 654 | GCC_WARN_UNUSED_FUNCTION = YES; 655 | GCC_WARN_UNUSED_VARIABLE = YES; 656 | IPHONEOS_DEPLOYMENT_TARGET = 13.4; 657 | LD = ""; 658 | LDPLUSPLUS = ""; 659 | LD_RUNPATH_SEARCH_PATHS = ( 660 | /usr/lib/swift, 661 | "$(inherited)", 662 | ); 663 | LIBRARY_SEARCH_PATHS = ( 664 | "\"$(SDKROOT)/usr/lib/swift\"", 665 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 666 | "\"$(inherited)\"", 667 | ); 668 | MTL_ENABLE_DEBUG_INFO = NO; 669 | OTHER_CFLAGS = "$(inherited)"; 670 | OTHER_CPLUSPLUSFLAGS = ( 671 | "$(OTHER_CFLAGS)", 672 | "-DFOLLY_NO_CONFIG", 673 | "-DFOLLY_MOBILE=1", 674 | "-DFOLLY_USE_LIBCPP=1", 675 | "-DFOLLY_CFG_NO_COROUTINES=1", 676 | ); 677 | OTHER_LDFLAGS = ( 678 | "$(inherited)", 679 | " ", 680 | ); 681 | REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; 682 | SDKROOT = iphoneos; 683 | USE_HERMES = true; 684 | VALIDATE_PRODUCT = YES; 685 | }; 686 | name = Release; 687 | }; 688 | /* End XCBuildConfiguration section */ 689 | 690 | /* Begin XCConfigurationList section */ 691 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ExampleTests" */ = { 692 | isa = XCConfigurationList; 693 | buildConfigurations = ( 694 | 00E356F61AD99517003FC87E /* Debug */, 695 | 00E356F71AD99517003FC87E /* Release */, 696 | ); 697 | defaultConfigurationIsVisible = 0; 698 | defaultConfigurationName = Release; 699 | }; 700 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Example" */ = { 701 | isa = XCConfigurationList; 702 | buildConfigurations = ( 703 | 13B07F941A680F5B00A75B9A /* Debug */, 704 | 13B07F951A680F5B00A75B9A /* Release */, 705 | ); 706 | defaultConfigurationIsVisible = 0; 707 | defaultConfigurationName = Release; 708 | }; 709 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Example" */ = { 710 | isa = XCConfigurationList; 711 | buildConfigurations = ( 712 | 83CBBA201A601CBA00E9B192 /* Debug */, 713 | 83CBBA211A601CBA00E9B192 /* Release */, 714 | ); 715 | defaultConfigurationIsVisible = 0; 716 | defaultConfigurationName = Release; 717 | }; 718 | /* End XCConfigurationList section */ 719 | }; 720 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 721 | } 722 | -------------------------------------------------------------------------------- /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/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : RCTAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /Example/ios/Example/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | 5 | @implementation AppDelegate 6 | 7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 8 | { 9 | self.moduleName = @"Example"; 10 | // You can add your custom initial props in the dictionary below. 11 | // They will be passed down to the ViewController used by React Native. 12 | self.initialProps = @{}; 13 | 14 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 15 | } 16 | 17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 18 | { 19 | return [self getBundleURL]; 20 | } 21 | 22 | - (NSURL *)getBundleURL 23 | { 24 | #if DEBUG 25 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; 26 | #else 27 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 28 | #endif 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Example/ios/Example/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "scale" : "1x", 46 | "size" : "1024x1024" 47 | } 48 | ], 49 | "info" : { 50 | "author" : "xcode", 51 | "version" : 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /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 | $(MARKETING_VERSION) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(CURRENT_PROJECT_VERSION) 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | 30 | NSAllowsArbitraryLoads 31 | 32 | NSAllowsLocalNetworking 33 | 34 | 35 | NSLocationWhenInUseUsageDescription 36 | 37 | UILaunchStoryboardName 38 | LaunchScreen 39 | UIRequiredDeviceCapabilities 40 | 41 | armv64 42 | 43 | UISupportedInterfaceOrientations 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | UIViewControllerBasedStatusBarAppearance 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Example/ios/Example/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Example/ios/Example/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /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( 38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 39 | if (level >= RCTLogLevelError) { 40 | redboxError = message; 41 | } 42 | }); 43 | #endif 44 | 45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 48 | 49 | foundElement = [self findSubviewInView:vc.view 50 | matching:^BOOL(UIView *view) { 51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 52 | return YES; 53 | } 54 | return NO; 55 | }]; 56 | } 57 | 58 | #ifdef DEBUG 59 | RCTSetLogFunction(RCTDefaultLogFunction); 60 | #endif 61 | 62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /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 | # Resolve react_native_pods.rb with node to allow for hoisting 2 | require Pod::Executable.execute_command('node', ['-p', 3 | 'require.resolve( 4 | "react-native/scripts/react_native_pods.rb", 5 | {paths: [process.argv[1]]}, 6 | )', __dir__]).strip 7 | 8 | platform :ios, min_ios_version_supported 9 | prepare_react_native_project! 10 | 11 | # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set. 12 | # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded 13 | # 14 | # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js` 15 | # ```js 16 | # module.exports = { 17 | # dependencies: { 18 | # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}), 19 | # ``` 20 | # flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled 21 | 22 | linkage = ENV['USE_FRAMEWORKS'] 23 | if linkage != nil 24 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green 25 | use_frameworks! :linkage => linkage.to_sym 26 | end 27 | 28 | target 'Example' do 29 | config = use_native_modules! 30 | 31 | use_react_native!( 32 | :path => config[:reactNativePath], 33 | # Enables Flipper. 34 | # 35 | # Note that if you have use_frameworks! enabled, Flipper will not work and 36 | # you should disable the next line. 37 | # :flipper_configuration => flipper_config, 38 | # An absolute path to your application root. 39 | :app_path => "#{Pod::Config.instance.installation_root}/.." 40 | ) 41 | 42 | target 'ExampleTests' do 43 | inherit! :complete 44 | # Pods for testing 45 | end 46 | 47 | post_install do |installer| 48 | # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 49 | react_native_post_install( 50 | installer, 51 | config[:reactNativePath], 52 | :mac_catalyst_enabled => false 53 | ) 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /Example/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'react-native', 3 | }; 4 | -------------------------------------------------------------------------------- /Example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # CocoaPods 2 | Pods/ 3 | -------------------------------------------------------------------------------- /Example/macos/.xcode.env: -------------------------------------------------------------------------------- 1 | export NODE_BINARY=$(command -v node) 2 | -------------------------------------------------------------------------------- /Example/macos/.xcode.env.local: -------------------------------------------------------------------------------- 1 | export NODE_BINARY=/Users/war-in/.nvm/versions/node/v20.10.0/bin/node 2 | 3 | -------------------------------------------------------------------------------- /Example/macos/Example-macOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : RCTAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /Example/macos/Example-macOS/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | 5 | @implementation AppDelegate 6 | 7 | - (void)applicationDidFinishLaunching:(NSNotification *)notification 8 | { 9 | self.moduleName = @"Example"; 10 | // You can add your custom initial props in the dictionary below. 11 | // They will be passed down to the ViewController used by React Native. 12 | self.initialProps = @{}; 13 | 14 | return [super applicationDidFinishLaunching:notification]; 15 | } 16 | 17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 18 | { 19 | #if DEBUG 20 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; 21 | #else 22 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 23 | #endif 24 | } 25 | 26 | /// This method controls whether the `concurrentRoot`feature of React18 is turned on or off. 27 | /// 28 | /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html 29 | /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture). 30 | /// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`. 31 | - (BOOL)concurrentRootEnabled 32 | { 33 | #ifdef RN_FABRIC_ENABLED 34 | return true; 35 | #else 36 | return false; 37 | #endif 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Example/macos/Example-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "size" : "16x16" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "size" : "16x16" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "scale" : "1x", 16 | "size" : "32x32" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "scale" : "2x", 21 | "size" : "32x32" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "scale" : "1x", 26 | "size" : "128x128" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "scale" : "2x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "scale" : "1x", 36 | "size" : "256x256" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "scale" : "2x", 41 | "size" : "256x256" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "scale" : "1x", 46 | "size" : "512x512" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "scale" : "2x", 51 | "size" : "512x512" 52 | } 53 | ], 54 | "info" : { 55 | "author" : "xcode", 56 | "version" : 1 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Example/macos/Example-macOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Example/macos/Example-macOS/Example.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | com.apple.security.network.client 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Example/macos/Example-macOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | NSExceptionDomains 30 | 31 | localhost 32 | 33 | NSExceptionAllowsInsecureHTTPLoads 34 | 35 | 36 | 37 | 38 | NSMainStoryboardFile 39 | Main 40 | NSPrincipalClass 41 | NSApplication 42 | NSSupportsAutomaticTermination 43 | 44 | NSSupportsSuddenTermination 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Example/macos/Example-macOS/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | int main(int argc, const char *argv[]) { 4 | return NSApplicationMain(argc, argv); 5 | } 6 | -------------------------------------------------------------------------------- /Example/macos/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5142014D2437B4B30078DB4F /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5142014C2437B4B30078DB4F /* AppDelegate.mm */; }; 11 | 514201522437B4B40078DB4F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 514201512437B4B40078DB4F /* Assets.xcassets */; }; 12 | 514201552437B4B40078DB4F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 514201532437B4B40078DB4F /* Main.storyboard */; }; 13 | 514201582437B4B40078DB4F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 514201572437B4B40078DB4F /* main.m */; }; 14 | D8B17AB11E83A56CCEC3D992 /* libPods-Example-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 973036BB4865BA49BF8AF43C /* libPods-Example-macOS.a */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 13B07F961A680F5B00A75B9A /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | 514201492437B4B30078DB4F /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 5142014B2437B4B30078DB4F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 21 | 5142014C2437B4B30078DB4F /* AppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = ""; }; 22 | 514201512437B4B40078DB4F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 23 | 514201542437B4B40078DB4F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 24 | 514201562437B4B40078DB4F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 25 | 514201572437B4B40078DB4F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 26 | 514201592437B4B40078DB4F /* Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Example.entitlements; sourceTree = ""; }; 27 | 973036BB4865BA49BF8AF43C /* libPods-Example-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | D2D1F27C29F636B48388D2C0 /* Pods-Example-macOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-macOS.debug.xcconfig"; path = "Target Support Files/Pods-Example-macOS/Pods-Example-macOS.debug.xcconfig"; sourceTree = ""; }; 29 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 30 | FBF8E9927EBDB8FF1C20F646 /* Pods-Example-macOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-macOS.release.xcconfig"; path = "Target Support Files/Pods-Example-macOS/Pods-Example-macOS.release.xcconfig"; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | 514201462437B4B30078DB4F /* Frameworks */ = { 42 | isa = PBXFrameworksBuildPhase; 43 | buildActionMask = 2147483647; 44 | files = ( 45 | D8B17AB11E83A56CCEC3D992 /* libPods-Example-macOS.a in Frameworks */, 46 | ); 47 | runOnlyForDeploymentPostprocessing = 0; 48 | }; 49 | /* End PBXFrameworksBuildPhase section */ 50 | 51 | /* Begin PBXGroup section */ 52 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 56 | 973036BB4865BA49BF8AF43C /* libPods-Example-macOS.a */, 57 | ); 58 | name = Frameworks; 59 | sourceTree = ""; 60 | }; 61 | 5142014A2437B4B30078DB4F /* Example-macOS */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | 5142014B2437B4B30078DB4F /* AppDelegate.h */, 65 | 5142014C2437B4B30078DB4F /* AppDelegate.mm */, 66 | 514201512437B4B40078DB4F /* Assets.xcassets */, 67 | 514201532437B4B40078DB4F /* Main.storyboard */, 68 | 514201562437B4B40078DB4F /* Info.plist */, 69 | 514201572437B4B40078DB4F /* main.m */, 70 | 514201592437B4B40078DB4F /* Example.entitlements */, 71 | ); 72 | path = "Example-macOS"; 73 | sourceTree = ""; 74 | }; 75 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | ); 79 | name = Libraries; 80 | sourceTree = ""; 81 | }; 82 | 83CBB9F61A601CBA00E9B192 = { 83 | isa = PBXGroup; 84 | children = ( 85 | 5142014A2437B4B30078DB4F /* Example-macOS */, 86 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 87 | 83CBBA001A601CBA00E9B192 /* Products */, 88 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 89 | AE2403C56C4ED3C2D693E2CD /* Pods */, 90 | ); 91 | indentWidth = 2; 92 | sourceTree = ""; 93 | tabWidth = 2; 94 | usesTabs = 0; 95 | }; 96 | 83CBBA001A601CBA00E9B192 /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 13B07F961A680F5B00A75B9A /* Example.app */, 100 | 514201492437B4B30078DB4F /* Example.app */, 101 | ); 102 | name = Products; 103 | sourceTree = ""; 104 | }; 105 | AE2403C56C4ED3C2D693E2CD /* Pods */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | D2D1F27C29F636B48388D2C0 /* Pods-Example-macOS.debug.xcconfig */, 109 | FBF8E9927EBDB8FF1C20F646 /* Pods-Example-macOS.release.xcconfig */, 110 | ); 111 | name = Pods; 112 | path = Pods; 113 | sourceTree = ""; 114 | }; 115 | /* End PBXGroup section */ 116 | 117 | /* Begin PBXNativeTarget section */ 118 | 13B07F861A680F5B00A75B9A /* Example-iOS */ = { 119 | isa = PBXNativeTarget; 120 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Example-iOS" */; 121 | buildPhases = ( 122 | 13B07F871A680F5B00A75B9A /* Sources */, 123 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 124 | 13B07F8E1A680F5B00A75B9A /* Resources */, 125 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 126 | ); 127 | buildRules = ( 128 | ); 129 | dependencies = ( 130 | ); 131 | name = "Example-iOS"; 132 | productName = Example; 133 | productReference = 13B07F961A680F5B00A75B9A /* Example.app */; 134 | productType = "com.apple.product-type.application"; 135 | }; 136 | 514201482437B4B30078DB4F /* Example-macOS */ = { 137 | isa = PBXNativeTarget; 138 | buildConfigurationList = 5142015A2437B4B40078DB4F /* Build configuration list for PBXNativeTarget "Example-macOS" */; 139 | buildPhases = ( 140 | 1A938104A937498D81B3BD3B /* [CP] Check Pods Manifest.lock */, 141 | 514201452437B4B30078DB4F /* Sources */, 142 | 514201462437B4B30078DB4F /* Frameworks */, 143 | 514201472437B4B30078DB4F /* Resources */, 144 | 381D8A6E24576A4E00465D17 /* Bundle React Native code and images */, 145 | 6E008F5656E8D01CF1438409 /* [CP] Copy Pods Resources */, 146 | ); 147 | buildRules = ( 148 | ); 149 | dependencies = ( 150 | ); 151 | name = "Example-macOS"; 152 | productName = Example; 153 | productReference = 514201492437B4B30078DB4F /* Example.app */; 154 | productType = "com.apple.product-type.application"; 155 | }; 156 | /* End PBXNativeTarget section */ 157 | 158 | /* Begin PBXProject section */ 159 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 160 | isa = PBXProject; 161 | attributes = { 162 | LastUpgradeCheck = 1130; 163 | TargetAttributes = { 164 | 13B07F861A680F5B00A75B9A = { 165 | LastSwiftMigration = 1120; 166 | }; 167 | 514201482437B4B30078DB4F = { 168 | CreatedOnToolsVersion = 11.4; 169 | ProvisioningStyle = Automatic; 170 | }; 171 | }; 172 | }; 173 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Example" */; 174 | compatibilityVersion = "Xcode 3.2"; 175 | developmentRegion = en; 176 | hasScannedForEncodings = 0; 177 | knownRegions = ( 178 | en, 179 | Base, 180 | ); 181 | mainGroup = 83CBB9F61A601CBA00E9B192; 182 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 183 | projectDirPath = ""; 184 | projectRoot = ""; 185 | targets = ( 186 | 13B07F861A680F5B00A75B9A /* Example-iOS */, 187 | 514201482437B4B30078DB4F /* Example-macOS */, 188 | ); 189 | }; 190 | /* End PBXProject section */ 191 | 192 | /* Begin PBXResourcesBuildPhase section */ 193 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 194 | isa = PBXResourcesBuildPhase; 195 | buildActionMask = 2147483647; 196 | files = ( 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | }; 200 | 514201472437B4B30078DB4F /* Resources */ = { 201 | isa = PBXResourcesBuildPhase; 202 | buildActionMask = 2147483647; 203 | files = ( 204 | 514201522437B4B40078DB4F /* Assets.xcassets in Resources */, 205 | 514201552437B4B40078DB4F /* Main.storyboard in Resources */, 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | }; 209 | /* End PBXResourcesBuildPhase section */ 210 | 211 | /* Begin PBXShellScriptBuildPhase section */ 212 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 213 | isa = PBXShellScriptBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | ); 217 | inputPaths = ( 218 | ); 219 | name = "Bundle React Native code and images"; 220 | outputPaths = ( 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | shellPath = /bin/sh; 224 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native-macos/scripts/react-native-xcode.sh\n"; 225 | }; 226 | 1A938104A937498D81B3BD3B /* [CP] Check Pods Manifest.lock */ = { 227 | isa = PBXShellScriptBuildPhase; 228 | buildActionMask = 2147483647; 229 | files = ( 230 | ); 231 | inputFileListPaths = ( 232 | ); 233 | inputPaths = ( 234 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 235 | "${PODS_ROOT}/Manifest.lock", 236 | ); 237 | name = "[CP] Check Pods Manifest.lock"; 238 | outputFileListPaths = ( 239 | ); 240 | outputPaths = ( 241 | "$(DERIVED_FILE_DIR)/Pods-Example-macOS-checkManifestLockResult.txt", 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | shellPath = /bin/sh; 245 | 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"; 246 | showEnvVarsInLog = 0; 247 | }; 248 | 381D8A6E24576A4E00465D17 /* Bundle React Native code and images */ = { 249 | isa = PBXShellScriptBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | ); 253 | inputFileListPaths = ( 254 | ); 255 | inputPaths = ( 256 | ); 257 | name = "Bundle React Native code and images"; 258 | outputFileListPaths = ( 259 | ); 260 | outputPaths = ( 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | shellPath = /bin/sh; 264 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native-macos/scripts/react-native-xcode.sh\n"; 265 | }; 266 | 6E008F5656E8D01CF1438409 /* [CP] Copy Pods Resources */ = { 267 | isa = PBXShellScriptBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | ); 271 | inputPaths = ( 272 | "${PODS_ROOT}/Target Support Files/Pods-Example-macOS/Pods-Example-macOS-resources.sh", 273 | "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/RCTI18nStrings.bundle", 274 | ); 275 | name = "[CP] Copy Pods Resources"; 276 | outputPaths = ( 277 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RCTI18nStrings.bundle", 278 | ); 279 | runOnlyForDeploymentPostprocessing = 0; 280 | shellPath = /bin/sh; 281 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example-macOS/Pods-Example-macOS-resources.sh\"\n"; 282 | showEnvVarsInLog = 0; 283 | }; 284 | /* End PBXShellScriptBuildPhase section */ 285 | 286 | /* Begin PBXSourcesBuildPhase section */ 287 | 13B07F871A680F5B00A75B9A /* Sources */ = { 288 | isa = PBXSourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | }; 294 | 514201452437B4B30078DB4F /* Sources */ = { 295 | isa = PBXSourcesBuildPhase; 296 | buildActionMask = 2147483647; 297 | files = ( 298 | 514201582437B4B40078DB4F /* main.m in Sources */, 299 | 5142014D2437B4B30078DB4F /* AppDelegate.mm in Sources */, 300 | ); 301 | runOnlyForDeploymentPostprocessing = 0; 302 | }; 303 | /* End PBXSourcesBuildPhase section */ 304 | 305 | /* Begin PBXVariantGroup section */ 306 | 514201532437B4B40078DB4F /* Main.storyboard */ = { 307 | isa = PBXVariantGroup; 308 | children = ( 309 | 514201542437B4B40078DB4F /* Base */, 310 | ); 311 | name = Main.storyboard; 312 | sourceTree = ""; 313 | }; 314 | /* End PBXVariantGroup section */ 315 | 316 | /* Begin XCBuildConfiguration section */ 317 | 13B07F941A680F5B00A75B9A /* Debug */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 321 | CLANG_ENABLE_MODULES = YES; 322 | CURRENT_PROJECT_VERSION = 1; 323 | ENABLE_BITCODE = NO; 324 | INFOPLIST_FILE = "Example-iOS/Info.plist"; 325 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 326 | OTHER_LDFLAGS = ( 327 | "$(inherited)", 328 | "-ObjC", 329 | "-lc++", 330 | ); 331 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.$(PRODUCT_NAME:rfc1034identifier)"; 332 | PRODUCT_NAME = Example; 333 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 334 | SWIFT_VERSION = 5.0; 335 | VERSIONING_SYSTEM = "apple-generic"; 336 | }; 337 | name = Debug; 338 | }; 339 | 13B07F951A680F5B00A75B9A /* Release */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 343 | CLANG_ENABLE_MODULES = YES; 344 | CURRENT_PROJECT_VERSION = 1; 345 | INFOPLIST_FILE = "Example-iOS/Info.plist"; 346 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 347 | OTHER_LDFLAGS = ( 348 | "$(inherited)", 349 | "-ObjC", 350 | "-lc++", 351 | ); 352 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.$(PRODUCT_NAME:rfc1034identifier)"; 353 | PRODUCT_NAME = Example; 354 | SWIFT_VERSION = 5.0; 355 | VERSIONING_SYSTEM = "apple-generic"; 356 | }; 357 | name = Release; 358 | }; 359 | 5142015B2437B4B40078DB4F /* Debug */ = { 360 | isa = XCBuildConfiguration; 361 | baseConfigurationReference = D2D1F27C29F636B48388D2C0 /* Pods-Example-macOS.debug.xcconfig */; 362 | buildSettings = { 363 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 364 | CLANG_ENABLE_MODULES = YES; 365 | CURRENT_PROJECT_VERSION = 1; 366 | DEAD_CODE_STRIPPING = NO; 367 | INFOPLIST_FILE = "Example-macos/Info.plist"; 368 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 369 | MACOSX_DEPLOYMENT_TARGET = 10.15; 370 | OTHER_LDFLAGS = ( 371 | "$(inherited)", 372 | "-ObjC", 373 | "-lc++", 374 | ); 375 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.$(PRODUCT_NAME:rfc1034identifier)"; 376 | PRODUCT_NAME = Example; 377 | SDKROOT = macosx; 378 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 379 | SWIFT_VERSION = 5.0; 380 | }; 381 | name = Debug; 382 | }; 383 | 5142015C2437B4B40078DB4F /* Release */ = { 384 | isa = XCBuildConfiguration; 385 | baseConfigurationReference = FBF8E9927EBDB8FF1C20F646 /* Pods-Example-macOS.release.xcconfig */; 386 | buildSettings = { 387 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 388 | CLANG_ENABLE_MODULES = YES; 389 | CURRENT_PROJECT_VERSION = 1; 390 | INFOPLIST_FILE = "Example-macos/Info.plist"; 391 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 392 | MACOSX_DEPLOYMENT_TARGET = 10.15; 393 | OTHER_LDFLAGS = ( 394 | "$(inherited)", 395 | "-ObjC", 396 | "-lc++", 397 | ); 398 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.$(PRODUCT_NAME:rfc1034identifier)"; 399 | PRODUCT_NAME = Example; 400 | SDKROOT = macosx; 401 | SWIFT_VERSION = 5.0; 402 | }; 403 | name = Release; 404 | }; 405 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 406 | isa = XCBuildConfiguration; 407 | buildSettings = { 408 | ALWAYS_SEARCH_USER_PATHS = NO; 409 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 410 | CLANG_CXX_LANGUAGE_STANDARD = "c++20"; 411 | CLANG_CXX_LIBRARY = "libc++"; 412 | CLANG_ENABLE_MODULES = YES; 413 | CLANG_ENABLE_OBJC_ARC = YES; 414 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 415 | CLANG_WARN_BOOL_CONVERSION = YES; 416 | CLANG_WARN_COMMA = YES; 417 | CLANG_WARN_CONSTANT_CONVERSION = YES; 418 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 419 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 420 | CLANG_WARN_EMPTY_BODY = YES; 421 | CLANG_WARN_ENUM_CONVERSION = YES; 422 | CLANG_WARN_INFINITE_RECURSION = YES; 423 | CLANG_WARN_INT_CONVERSION = YES; 424 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 425 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 426 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 427 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 428 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 429 | CLANG_WARN_STRICT_PROTOTYPES = YES; 430 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 431 | CLANG_WARN_UNREACHABLE_CODE = YES; 432 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 433 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 434 | COPY_PHASE_STRIP = NO; 435 | ENABLE_STRICT_OBJC_MSGSEND = YES; 436 | ENABLE_TESTABILITY = YES; 437 | GCC_C_LANGUAGE_STANDARD = gnu99; 438 | GCC_DYNAMIC_NO_PIC = NO; 439 | GCC_NO_COMMON_BLOCKS = YES; 440 | GCC_OPTIMIZATION_LEVEL = 0; 441 | GCC_PREPROCESSOR_DEFINITIONS = ( 442 | "DEBUG=1", 443 | "$(inherited)", 444 | ); 445 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 446 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 447 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 448 | GCC_WARN_UNDECLARED_SELECTOR = YES; 449 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 450 | GCC_WARN_UNUSED_FUNCTION = YES; 451 | GCC_WARN_UNUSED_VARIABLE = YES; 452 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 453 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 454 | LIBRARY_SEARCH_PATHS = ( 455 | "$(SDKROOT)/usr/lib/swift", 456 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 457 | "\"$(inherited)\"", 458 | ); 459 | MTL_ENABLE_DEBUG_INFO = YES; 460 | ONLY_ACTIVE_ARCH = YES; 461 | OTHER_CFLAGS = "$(inherited)"; 462 | OTHER_CPLUSPLUSFLAGS = "$(inherited)"; 463 | OTHER_LDFLAGS = ( 464 | "$(inherited)", 465 | " ", 466 | ); 467 | REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; 468 | SDKROOT = iphoneos; 469 | USE_HERMES = false; 470 | }; 471 | name = Debug; 472 | }; 473 | 83CBBA211A601CBA00E9B192 /* Release */ = { 474 | isa = XCBuildConfiguration; 475 | buildSettings = { 476 | ALWAYS_SEARCH_USER_PATHS = NO; 477 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 478 | CLANG_CXX_LANGUAGE_STANDARD = "c++20"; 479 | CLANG_CXX_LIBRARY = "libc++"; 480 | CLANG_ENABLE_MODULES = YES; 481 | CLANG_ENABLE_OBJC_ARC = YES; 482 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 483 | CLANG_WARN_BOOL_CONVERSION = YES; 484 | CLANG_WARN_COMMA = YES; 485 | CLANG_WARN_CONSTANT_CONVERSION = YES; 486 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 487 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 488 | CLANG_WARN_EMPTY_BODY = YES; 489 | CLANG_WARN_ENUM_CONVERSION = YES; 490 | CLANG_WARN_INFINITE_RECURSION = YES; 491 | CLANG_WARN_INT_CONVERSION = YES; 492 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 493 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 494 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 495 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 496 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 497 | CLANG_WARN_STRICT_PROTOTYPES = YES; 498 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 499 | CLANG_WARN_UNREACHABLE_CODE = YES; 500 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 501 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 502 | COPY_PHASE_STRIP = YES; 503 | ENABLE_NS_ASSERTIONS = NO; 504 | ENABLE_STRICT_OBJC_MSGSEND = YES; 505 | GCC_C_LANGUAGE_STANDARD = gnu99; 506 | GCC_NO_COMMON_BLOCKS = YES; 507 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 508 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 509 | GCC_WARN_UNDECLARED_SELECTOR = YES; 510 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 511 | GCC_WARN_UNUSED_FUNCTION = YES; 512 | GCC_WARN_UNUSED_VARIABLE = YES; 513 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 514 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 515 | LIBRARY_SEARCH_PATHS = ( 516 | "$(SDKROOT)/usr/lib/swift", 517 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 518 | "\"$(inherited)\"", 519 | ); 520 | MTL_ENABLE_DEBUG_INFO = NO; 521 | OTHER_CFLAGS = "$(inherited)"; 522 | OTHER_CPLUSPLUSFLAGS = "$(inherited)"; 523 | OTHER_LDFLAGS = ( 524 | "$(inherited)", 525 | " ", 526 | ); 527 | REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; 528 | SDKROOT = iphoneos; 529 | USE_HERMES = false; 530 | VALIDATE_PRODUCT = YES; 531 | }; 532 | name = Release; 533 | }; 534 | /* End XCBuildConfiguration section */ 535 | 536 | /* Begin XCConfigurationList section */ 537 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Example-iOS" */ = { 538 | isa = XCConfigurationList; 539 | buildConfigurations = ( 540 | 13B07F941A680F5B00A75B9A /* Debug */, 541 | 13B07F951A680F5B00A75B9A /* Release */, 542 | ); 543 | defaultConfigurationIsVisible = 0; 544 | defaultConfigurationName = Release; 545 | }; 546 | 5142015A2437B4B40078DB4F /* Build configuration list for PBXNativeTarget "Example-macOS" */ = { 547 | isa = XCConfigurationList; 548 | buildConfigurations = ( 549 | 5142015B2437B4B40078DB4F /* Debug */, 550 | 5142015C2437B4B40078DB4F /* Release */, 551 | ); 552 | defaultConfigurationIsVisible = 0; 553 | defaultConfigurationName = Release; 554 | }; 555 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Example" */ = { 556 | isa = XCConfigurationList; 557 | buildConfigurations = ( 558 | 83CBBA201A601CBA00E9B192 /* Debug */, 559 | 83CBBA211A601CBA00E9B192 /* Release */, 560 | ); 561 | defaultConfigurationIsVisible = 0; 562 | defaultConfigurationName = Release; 563 | }; 564 | /* End XCConfigurationList section */ 565 | }; 566 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 567 | } 568 | -------------------------------------------------------------------------------- /Example/macos/Example.xcodeproj/xcshareddata/xcschemes/Example-macOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /Example/macos/Example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/macos/Podfile: -------------------------------------------------------------------------------- 1 | require_relative '../node_modules/react-native-macos/scripts/react_native_pods' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | prepare_react_native_project! 5 | 6 | target 'Example-macOS' do 7 | platform :macos, '10.15' 8 | use_native_modules! 9 | 10 | # Flags change depending on the env values. 11 | flags = get_default_flags() 12 | 13 | use_react_native!( 14 | :path => '../node_modules/react-native-macos', 15 | :hermes_enabled => false, 16 | :fabric_enabled => ENV['RCT_NEW_ARCH_ENABLED'] == '1', 17 | # Flipper is not compatible w/ macOS 18 | :flipper_configuration => FlipperConfiguration.disabled, 19 | # An absolute path to your application root. 20 | :app_path => "#{Pod::Config.instance.installation_root}/.." 21 | ) 22 | 23 | post_install do |installer| 24 | react_native_post_install(installer) 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /Example/metro.config.js: -------------------------------------------------------------------------------- 1 | const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config'); 2 | 3 | /** 4 | * Metro configuration 5 | * https://facebook.github.io/metro/docs/configuration 6 | * 7 | * @type {import('metro-config').MetroConfig} 8 | */ 9 | const path = require('path'); 10 | const exclusionList = require('metro-config/src/defaults/exclusionList'); 11 | const escape = require('escape-string-regexp'); 12 | const pack = require('../package.json'); 13 | 14 | const root = path.resolve(__dirname, '..'); 15 | 16 | const modules = [...Object.keys(pack.peerDependencies), 'react-native-macos']; 17 | 18 | const config = { 19 | projectRoot: __dirname, 20 | watchFolders: [root], 21 | 22 | // We need to make sure that only one version is loaded for peerDependencies 23 | // So we exclude them at the root, and alias them to the versions in example's node_modules 24 | resolver: { 25 | blockList: exclusionList( 26 | modules.map( 27 | m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`), 28 | ), 29 | new RegExp(`${path.join(__dirname, 'macos').replace(/[/\\]+/g, '/')}.*`), 30 | ), 31 | 32 | extraNodeModules: modules.reduce((acc, name) => { 33 | acc[name] = path.join(__dirname, 'node_modules', name); 34 | return acc; 35 | }, {}), 36 | }, 37 | 38 | transformer: { 39 | getTransformOptions: async () => ({ 40 | transform: { 41 | experimentalImportSupport: false, 42 | }, 43 | }), 44 | }, 45 | }; 46 | 47 | module.exports = mergeConfig(getDefaultConfig(__dirname), config); 48 | -------------------------------------------------------------------------------- /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 | "web": "webpack serve", 9 | "macos": "react-native run-macos", 10 | "lint": "eslint .", 11 | "prettier": "prettier --write ./src/**/*.{tsx,ts}", 12 | "start": "react-native start", 13 | "test": "jest", 14 | "tsc": "tsc" 15 | }, 16 | "dependencies": { 17 | "@babel/plugin-proposal-export-namespace-from": "^7.18.9", 18 | "@svgr/webpack": "^8.1.0", 19 | "file-loader": "^6.2.0", 20 | "react": "18.3.1", 21 | "react-native": "^0.75.4", 22 | "react-native-macos": "^0.75.4", 23 | "react-native-qrcode-svg": "link:../", 24 | "react-native-svg": "^15.10.1", 25 | "react-native-web": "^0.19.10", 26 | "webpack": "^5.91.0" 27 | }, 28 | "devDependencies": { 29 | "@babel/core": "^7.20.0", 30 | "@babel/preset-env": "^7.20.0", 31 | "@babel/runtime": "^7.25.4", 32 | "@react-native/babel-preset": "^0.75.4", 33 | "@react-native/eslint-config": "0.75.4", 34 | "@react-native/metro-config": "0.75.4", 35 | "@react-native/typescript-config": "0.75.4", 36 | "@types/react": "^18.2.6", 37 | "@types/react-test-renderer": "^18.0.0", 38 | "babel-jest": "^29.6.3", 39 | "babel-loader": "^9.1.3", 40 | "eslint": "^8.19.0", 41 | "eslint-plugin-prettier": "^5.1.3", 42 | "jest": "^29.6.3", 43 | "prettier": "^3.2.5", 44 | "react-dom": "^18.2.0", 45 | "react-test-renderer": "18.2.0", 46 | "typescript": "5.0.4", 47 | "webpack-cli": "^5.1.4", 48 | "webpack-dev-server": "^5.0.4" 49 | }, 50 | "engines": { 51 | "node": ">=18" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Example/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {SafeAreaView, ScrollView, Text} from 'react-native'; 3 | import SVG from './assets/ruby.svg'; 4 | import Description from './components/Description'; 5 | import QRCode from 'react-native-qrcode-svg'; 6 | import styles from './styles'; 7 | 8 | const rubyUrl = 'https://www.ruby-lang.org/'; 9 | const googleUrl = 'https://www.google.com/'; 10 | const qrCodeSize = 200; 11 | const logoSize = 100; 12 | 13 | const defaultQRCode = ( 14 | 15 | 16 | 17 | ); 18 | 19 | const colorfulQRCODe = ( 20 | 21 | 27 | 28 | ); 29 | 30 | const urlPngQRCode = ( 31 | 32 | 39 | 40 | ); 41 | 42 | const localPngQRCode = ( 43 | 44 | 50 | 51 | ); 52 | 53 | const localPngBackgroundColorQRCode = ( 54 | 55 | 62 | 63 | ); 64 | 65 | const urlSvgQRCode = ( 66 | 67 | 73 | 74 | ); 75 | 76 | const xml = ` 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | `; 90 | 91 | const stringSvgQRCode = ( 92 | 93 | 99 | 100 | ); 101 | 102 | const localSvgQRCode = ( 103 | 104 | 110 | 111 | ); 112 | 113 | const App = () => { 114 | return ( 115 | 116 | 117 | Example usages of QRCode component 118 | {defaultQRCode} 119 | {colorfulQRCODe} 120 | {urlPngQRCode} 121 | {localPngQRCode} 122 | {localPngBackgroundColorQRCode} 123 | {urlSvgQRCode} 124 | {stringSvgQRCode} 125 | {localSvgQRCode} 126 | 127 | 128 | ); 129 | }; 130 | export default App; 131 | -------------------------------------------------------------------------------- /Example/src/assets/google.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/Example/src/assets/google.png -------------------------------------------------------------------------------- /Example/src/assets/ruby.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Example/src/components/Description.tsx: -------------------------------------------------------------------------------- 1 | import {Text, View} from 'react-native'; 2 | import React from 'react'; 3 | import styles from '../styles'; 4 | 5 | type DescriptionProps = { 6 | text: string; 7 | children: React.ReactNode; 8 | }; 9 | 10 | const Description = ({text, children}: DescriptionProps) => ( 11 | 12 | {text} 13 | {children} 14 | 15 | ); 16 | export default Description; 17 | -------------------------------------------------------------------------------- /Example/src/styles.ts: -------------------------------------------------------------------------------- 1 | import {StyleSheet} from 'react-native'; 2 | 3 | const styles = StyleSheet.create({ 4 | title: { 5 | marginTop: 6, 6 | fontSize: 36, 7 | fontWeight: 'bold', 8 | }, 9 | text: { 10 | fontSize: 24, 11 | }, 12 | scrollViewElement: { 13 | alignItems: 'center', 14 | margin: '1%', 15 | paddingVertical: 12, 16 | }, 17 | scrollViewContainer: { 18 | alignItems: 'center', 19 | }, 20 | }); 21 | export default styles; 22 | -------------------------------------------------------------------------------- /Example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@react-native/typescript-config/tsconfig.json", 3 | "include": ["src/**/*", "global.d.ts"], 4 | "esModuleInterop": true, 5 | "compilerOptions": { 6 | "jsx": "react", 7 | "skipLibCheck": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Example/webpack.config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require('path'); 4 | const fromRoot = _ => path.resolve(__dirname, _); 5 | 6 | module.exports = { 7 | mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', 8 | entry: fromRoot('index.js'), 9 | output: { 10 | path: fromRoot('dist'), 11 | filename: 'bundle.web.js', 12 | }, 13 | devServer: { 14 | static: {directory: fromRoot('dist')}, 15 | devMiddleware: {publicPath: '/'}, 16 | }, 17 | module: { 18 | rules: [ 19 | { 20 | test: /\.(jsx?|tsx?)$/, 21 | use: {loader: 'babel-loader'}, 22 | include: [ 23 | fromRoot('index.js'), 24 | fromRoot('src/'), 25 | fromRoot('node_modules/react-native-qrcode-svg'), 26 | ], 27 | }, 28 | { 29 | test: /\.(gif|jpe?g|png)$/i, 30 | use: [ 31 | { 32 | loader: 'file-loader', 33 | options: {esModule: false}, 34 | }, 35 | ], 36 | }, 37 | { 38 | test: /\.svg$/, 39 | use: ['@svgr/webpack'], 40 | }, 41 | ], 42 | }, 43 | resolve: { 44 | symlinks: false, 45 | alias: { 46 | 'react-native$': 'react-native-web', 47 | react: path.resolve('./node_modules/react'), 48 | }, 49 | extensions: [ 50 | '.web.ts', 51 | '.ts', 52 | '.web.tsx', 53 | '.tsx', 54 | '.web.js', 55 | '.js', 56 | '.web.jsx', 57 | '.jsx', 58 | ], 59 | }, 60 | }; 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 JerryShen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [![NPM](https://nodei.co/npm/react-native-qrcode-svg.png)](https://npmjs.org/package/react-native-qrcode-svg) 3 | 4 | # react-native-qrcode-svg 5 | 6 | A QR Code generator for React Native based on react-native-svg and javascript-qrcode. 7 | 8 | Discussion: https://discord.gg/RvFM97v 9 | 10 | ## Features 11 | 12 | * Easily render QR code images 13 | * Optionally embed a logotype 14 | 15 | | Android | iOS | 16 | | - | - | 17 | | | | 18 | 19 | ## Installation 20 | 21 | Install dependency packages 22 | 23 | ```bash 24 | yarn add react-native-svg react-native-qrcode-svg 25 | ``` 26 | Or 27 | ```bash 28 | npm i -S react-native-svg react-native-qrcode-svg 29 | ``` 30 | 31 | If you are using `React Native 0.60.+` go to the folder **your-project/ios** and run `pod install`, and you're done. 32 | 33 | If not, use one of the following method to link. 34 | 35 | ## Link with `react-native link` 36 | 37 | If you are using `React Native <= 0.59.X`, link the native project: 38 | 39 | ```bash 40 | react-native link react-native-svg 41 | ``` 42 | 43 | ## Examples 44 | 45 | ```jsx 46 | import QRCode from 'react-native-qrcode-svg'; 47 | 48 | // Simple usage, defaults for all but the value 49 | render() { 50 | return ( 51 | 54 | ); 55 | }; 56 | ``` 57 | 58 | ```jsx 59 | // 30px logo from base64 string with transparent background 60 | render() { 61 | let base64Logo = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAA..'; 62 | return ( 63 | 69 | ); 70 | }; 71 | ``` 72 | 73 | ```jsx 74 | // 20% (default) sized logo from local file string with white logo backdrop 75 | render() { 76 | let logoFromFile = require('../assets/logo.png'); 77 | return ( 78 | 82 | ); 83 | }; 84 | ``` 85 | 86 | ```jsx 87 | // get base64 string encode of the qrcode (currently logo is not included) 88 | getDataURL() { 89 | this.svg.toDataURL(this.callback); 90 | } 91 | 92 | callback(dataURL) { 93 | console.log(dataURL); 94 | } 95 | 96 | render() { 97 | return ( 98 | (this.svg = c)} 101 | /> 102 | ); 103 | } 104 | ``` 105 | 106 | ## Props 107 | 108 | Name | Default | Description 109 | ----------------|------------|-------------- 110 | size | 100 | Size of rendered image in pixels 111 | value | 'this is a QR code' | String Value of the QR code. Can also accept an array of segments as defined in [Manual mode](https://github.com/soldair/node-qrcode#manual-mode). Ex. [{ data: 'ABCDEFG', mode: 'alphanumeric' }, { data: '0123456', mode: 'numeric' }, { data: [253,254,255], mode: 'byte' }] 112 | color | 'black' | Color of the QR code 113 | backgroundColor | 'white' | Color of the background 114 | enableLinearGradient | false | enables or disables linear gradient 115 | linearGradient | ['rgb(255,0,0)','rgb(0,255,255)'] | array of 2 rgb colors used to create the linear gradient 116 | gradientDirection| [170,0,0,0] | the direction of the linear gradient 117 | logo | null | Image source object. Ex. {uri: 'base64string'} or {require('pathToImage')} 118 | logoSize | 20% of size | Size of the imprinted logo. Bigger logo = less error correction in QR code 119 | logoBackgroundColor | backgroundColor | The logo gets a filled quadratic background with this color. Use 'transparent' if your logo already has its own backdrop. 120 | logoMargin | 2 | logo's distance to its wrapper 121 | logoBorderRadius | 0 | the border-radius of logo image (Android is not supported) 122 | quietZone | 0 | quiet zone around the qr in pixels (useful when saving image to gallery) 123 | getRef | null | Get SVG ref for further usage 124 | ecl | 'M' | Error correction level 125 | onError(error) | undefined | Callback fired when exception happened during the code generating process 126 | 127 | 128 | ## Saving generated code to gallery 129 | _Note: Experimental only ( not tested on iOS) , uses getRef() and needs [RNFS module](https://github.com/itinance/react-native-fs)_ 130 | 131 | npm install --save react-native-fs 132 | 133 | ### Example for Android: 134 | 135 | ```js 136 | import { CameraRoll , ToastAndroid } from "react-native" 137 | import RNFS from "react-native-fs" 138 | ... 139 | 140 | saveQrToDisk() { 141 | this.svg.toDataURL((data) => { 142 | RNFS.writeFile(RNFS.CachesDirectoryPath+"/some-name.png", data, 'base64') 143 | .then((success) => { 144 | return CameraRoll.saveToCameraRoll(RNFS.CachesDirectoryPath+"/some-name.png", 'photo') 145 | }) 146 | .then(() => { 147 | this.setState({ busy: false, imageSaved: true }) 148 | ToastAndroid.show('Saved to gallery !!', ToastAndroid.SHORT) 149 | }) 150 | }) 151 | } 152 | ``` 153 | ## Development and testing 154 | This library comes with an Example App. You can find it in the directory `./Example`. 155 | Use the app to easily test your changes to `react-native-qrcode-svg` and when developing new features. 156 | 157 | Read more details in the dedicated [README](/Example/README.md). 158 | 159 | ## Dependencies 160 | 161 | ### PeerDependencies 162 | 163 | * [react-native-svg](https://github.com/magicismight/react-native-svg) 164 | 165 | ### Dependencies 166 | 167 | * [node-qrcode](https://github.com/soldair/node-qrcode) 168 | 169 | ### Integrating react-native-qrcode-svg with React Native versions below 0.75 170 | This library works seamlessly with React Native versions 0.75 and above. However, if you're using an older version of React Native (below 0.75), you might need to apply a custom transformation to your project's metro.config.js file to ensure compatibility with the TextEncoder API. 171 | 172 | Here's how to configure the transformer for both Expo and React Native projects: 173 | 174 | #### Setting Up the Transformer: 175 | Make sure your project has a `metro.config.js` file. If not, create one at the root of your project. 176 | 177 | #### Expo Projects: 178 | ```js 179 | const { getDefaultConfig } = require("expo/metro-config"); 180 | 181 | module.exports = (() => { 182 | const config = getDefaultConfig(__dirname); 183 | 184 | const { transformer } = config; 185 | 186 | config.transformer = { 187 | ...transformer, 188 | babelTransformerPath: require.resolve("react-native-qrcode-svg/textEncodingTransformation") 189 | }; 190 | 191 | return config; 192 | })(); 193 | ``` 194 | Merge the contents from your project's metro.config.js file with this config. 195 | 196 | #### React Native Projects: 197 | ```js 198 | const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config"); 199 | 200 | const defaultConfig = getDefaultConfig(__dirname); 201 | 202 | const config = { 203 | transformer: { 204 | babelTransformerPath: require.resolve("react-native-qrcode-svg/textEncodingTransformation"), 205 | }, 206 | }; 207 | 208 | module.exports = mergeConfig(defaultConfig, config); 209 | ``` 210 | 211 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: 3 | [ 4 | "module:metro-react-native-babel-preset", 5 | { 6 | disableImportExportTransform: true, 7 | }, 8 | ], 9 | }; 10 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import type {ImageSourcePropType} from "react-native"; 3 | import type {SvgProps} from "react-native-svg"; 4 | 5 | declare class QRCode extends React.PureComponent {} 6 | 7 | export interface QRCodeProps { 8 | /* what the qr code stands for */ 9 | value?: string; 10 | /* the whole component size */ 11 | size?: number; 12 | /* the color of the cell */ 13 | color?: string; 14 | /* the color of the background */ 15 | backgroundColor?: string; 16 | /* SVG to render as logo. 17 | * Can be either a svg string or a React component if you're using ex: '@svgr/webpack' or similar 18 | * In case both this prop and `logo` are provided, then this prop takes precedence and `logo` will be ignored. */ 19 | logoSVG?: React.FC | string; 20 | /* an image source object. example {uri: 'base64string'} or {require('pathToImage')} */ 21 | logo?: ImageSourcePropType | string; 22 | /* logo size in pixels */ 23 | logoSize?: number; 24 | /* the logo gets a filled rectangular background with this color. Use 'transparent' 25 | if your logo already has its own backdrop. Default = same as backgroundColor */ 26 | logoBackgroundColor?: string; 27 | /* If the logo is provided via `logoSVG` prop, this color will be set as it's `fill` property, 28 | * otherwise it does nothing */ 29 | logoColor?: string; 30 | /* logo's distance to its wrapper */ 31 | logoMargin?: number; 32 | /* the border-radius of logo image */ 33 | logoBorderRadius?: number; 34 | /* quiet zone in pixels */ 35 | quietZone?: number; 36 | /* enable linear gradient effect */ 37 | enableLinearGradient?: boolean; 38 | /* linear gradient direction */ 39 | gradientDirection?: string[]; 40 | /* linear gradient color */ 41 | linearGradient?: string[]; 42 | /* get svg ref for further usage */ 43 | getRef?: (c: any) => any; 44 | /* error correction level */ 45 | ecl?: "L" | "M" | "Q" | "H"; 46 | /* error handler called when matrix fails to generate */ 47 | onError?: Function; 48 | /** testID for testing */ 49 | testID?: string; 50 | } 51 | 52 | export default QRCode; 53 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | export { default } from './src/index.js' 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-qrcode-svg", 3 | "version": "6.3.15", 4 | "description": "A QR Code generator for React Native based on react-native-svg and javascript-qrcode.", 5 | "main": "index.js", 6 | "types": "index.d.ts", 7 | "scripts": { 8 | "prepack": "rm -rf example", 9 | "test": "jest", 10 | "test:update": "npm run test -- --updateSnapshot", 11 | "lint": "standard 'src/**/*.js'", 12 | "lint:fix": "standard 'src/**/*.js' --fix", 13 | "lint:staged": "lint-staged", 14 | "check:update": "npx npm-check-updates -u", 15 | "check:outdated": "npm outdated" 16 | }, 17 | "standard": { 18 | "env": [ 19 | "jest" 20 | ], 21 | "parser": "babel-eslint" 22 | }, 23 | "jest": { 24 | "testPathIgnorePatterns": [ 25 | "/node_modules/", 26 | "example/" 27 | ] 28 | }, 29 | "repository": { 30 | "type": "git", 31 | "url": "git+https://github.com/Expensify/react-native-qrcode-svg.git" 32 | }, 33 | "files": [ 34 | "Example", 35 | "screenshot", 36 | "src", 37 | "babel.config.js", 38 | "index.d.ts", 39 | "index.js", 40 | "textEncodingTransformation.js" 41 | ], 42 | "keywords": [ 43 | "react-native", 44 | "qrcode", 45 | "svg" 46 | ], 47 | "author": "Expensify", 48 | "license": "MIT", 49 | "bugs": { 50 | "url": "https://github.com/Expensify/react-native-qrcode-svg/issues" 51 | }, 52 | "homepage": "https://github.com/Expensify/react-native-qrcode-svg#readme", 53 | "peerDependencies": { 54 | "react": "*", 55 | "react-native": ">=0.63.4", 56 | "react-native-svg": ">=14.0.0" 57 | }, 58 | "dependencies": { 59 | "prop-types": "^15.8.0", 60 | "qrcode": "^1.5.4", 61 | "text-encoding": "^0.7.0" 62 | }, 63 | "devDependencies": { 64 | "@types/react": "^18.2.75", 65 | "babel-eslint": "^10.1.0", 66 | "babel-jest": "^27.4.2", 67 | "husky": "^7.0.4", 68 | "jest": "^27.4.3", 69 | "lint-staged": "^12.1.2", 70 | "metro-react-native-babel-preset": "^0.66.2", 71 | "react": "^18.1.0", 72 | "react-test-renderer": "^18.1.0", 73 | "standard": "^16.0.4" 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /screenshot/android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/screenshot/android.png -------------------------------------------------------------------------------- /screenshot/ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Expensify/react-native-qrcode-svg/9a81c9b11f8addc0d153338bf1d902e8c186d0cc/screenshot/ios.png -------------------------------------------------------------------------------- /src/LogoSVG/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Image } from "react-native-svg"; 3 | import { isString, isUrlString } from "../utils"; 4 | 5 | const LogoSVG = ({ svg, logoSize, logoColor }) => { 6 | if (isString(svg)) { 7 | const href = isUrlString(svg) 8 | ? svg 9 | : `data:image/svg+xml;base64,${window.btoa(svg)}`; 10 | 11 | return ; 12 | } 13 | 14 | // if `svg` prop is actually a svg asset wrapped in a React component, then we can just render it 15 | const LogoSVGComponent = svg; 16 | 17 | return ( 18 | 19 | ); 20 | }; 21 | 22 | export default LogoSVG; 23 | -------------------------------------------------------------------------------- /src/LogoSVG/index.native.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { LocalSvg } from "react-native-svg/css"; 3 | import { SvgUri, SvgXml } from "react-native-svg"; 4 | import { isString, isUrlString } from "../utils"; 5 | 6 | const LogoSVG = ({ svg, logoSize, logoColor }) => { 7 | if (isString(svg)) { 8 | if (isUrlString(svg)) { 9 | return ( 10 | 11 | ); 12 | } 13 | 14 | return ( 15 | 16 | ); 17 | } 18 | 19 | return ( 20 | 21 | ); 22 | }; 23 | 24 | export default LogoSVG; 25 | -------------------------------------------------------------------------------- /src/__mocks__/react-native-svg.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | export default function ({ children }) { 4 | return
{children}
5 | } 6 | 7 | export const Rect = props => { 8 | return Rect: {JSON.stringify(props)} 9 | } 10 | 11 | export const Path = props => { 12 | return Path: {JSON.stringify(props)} 13 | } 14 | 15 | export const G = ({ children, ...props }) => { 16 | return ( 17 | 18 | G: {JSON.stringify(props)} 19 | children: {children} 20 | 21 | ) 22 | } 23 | 24 | export const Defs = ({ children, ...props }) => { 25 | return ( 26 | 27 | Defs: {JSON.stringify(props)} 28 | children: {children} 29 | 30 | ) 31 | } 32 | 33 | export const Image = props => { 34 | return Image: {JSON.stringify(props)} 35 | } 36 | 37 | export const ClipPath = ({ children, ...props }) => { 38 | return ( 39 | 40 | ClipPath: {JSON.stringify(props)} 41 | children: {children} 42 | 43 | ) 44 | } 45 | 46 | export const LinearGradient = ({ children, ...props }) => { 47 | return ( 48 | 49 | LinearGradient: {JSON.stringify(props)} 50 | children: {children} 51 | 52 | ) 53 | } 54 | 55 | export const Stop = props => { 56 | return Stop: {JSON.stringify(props)} 57 | } 58 | -------------------------------------------------------------------------------- /src/__mocks__/react-native.js: -------------------------------------------------------------------------------- 1 | import PropTypes from 'prop-types' 2 | 3 | export const Image = { 4 | propTypes: { 5 | source: PropTypes.oneOfType([ 6 | PropTypes.number, 7 | PropTypes.shape({ 8 | uri: PropTypes.string 9 | }) 10 | ]) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/__tests__/Matrix-test.js: -------------------------------------------------------------------------------- 1 | import genMatrix from '../genMatrix' 2 | 3 | it('generates with ecl:M correctly', () => { 4 | const matrix = genMatrix('test') 5 | expect(matrix).toMatchSnapshot() 6 | }) 7 | 8 | it('generates with ecl:L correctly', () => { 9 | const matrix = genMatrix('test', 'L') 10 | expect(matrix).toMatchSnapshot() 11 | }) 12 | 13 | it('generates with ecl:H correctly', () => { 14 | const matrix = genMatrix('test', 'H') 15 | expect(matrix).toMatchSnapshot() 16 | }) 17 | 18 | it('generates with ecl:Q correctly', () => { 19 | const matrix = genMatrix('test', 'Q') 20 | expect(matrix).toMatchSnapshot() 21 | }) 22 | -------------------------------------------------------------------------------- /src/__tests__/QRCode-test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import QRCode from '../index' 3 | import renderer from 'react-test-renderer' 4 | 5 | describe('QRCode', () => { 6 | it('renders correctly', () => { 7 | const tree = renderer.create( 8 | 9 | ).toJSON() 10 | expect(tree).toMatchSnapshot() 11 | }) 12 | 13 | it('renders with logo correctly', () => { 14 | const tree = renderer.create( 15 | 18 | ).toJSON() 19 | expect(tree).toMatchSnapshot() 20 | }) 21 | 22 | // Let's simulate too big data passed to QRCode and check if onError Callback 23 | // Called properly 24 | it('calls onError in case of issue with code generating', () => { 25 | const onErrorMock = jest.fn() 26 | // Let's try to render with too big amount of data that should 27 | // throw an exception 28 | renderer.create( 29 | 33 | ) 34 | expect(onErrorMock.mock.calls.length).toBe(1) 35 | }) 36 | 37 | it('does not call onError in case if value is fine', () => { 38 | const onErrorMock = jest.fn() 39 | renderer.create( 40 | 44 | ) 45 | expect(onErrorMock.mock.calls.length).toBe(0) 46 | }) 47 | 48 | it('renders with segmented value', () => { 49 | const onErrorMock = jest.fn() 50 | const segs = [ 51 | { data: "ABCDEFG", mode: "alphanumeric" }, 52 | { data: "0123456", mode: "numeric" }, 53 | ]; 54 | const tree = renderer.create( 55 | 59 | ).toJSON() 60 | expect(onErrorMock.mock.calls.length).toBe(0) 61 | expect(tree).toMatchSnapshot() 62 | }) 63 | }) 64 | -------------------------------------------------------------------------------- /src/__tests__/__snapshots__/Matrix-test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`generates with ecl:H correctly 1`] = ` 4 | Array [ 5 | Array [ 6 | 1, 7 | 1, 8 | 1, 9 | 1, 10 | 1, 11 | 1, 12 | 1, 13 | 0, 14 | 0, 15 | 0, 16 | 1, 17 | 1, 18 | 1, 19 | 0, 20 | 1, 21 | 1, 22 | 1, 23 | 1, 24 | 1, 25 | 1, 26 | 1, 27 | ], 28 | Array [ 29 | 1, 30 | 0, 31 | 0, 32 | 0, 33 | 0, 34 | 0, 35 | 1, 36 | 0, 37 | 0, 38 | 0, 39 | 1, 40 | 1, 41 | 1, 42 | 0, 43 | 1, 44 | 0, 45 | 0, 46 | 0, 47 | 0, 48 | 0, 49 | 1, 50 | ], 51 | Array [ 52 | 1, 53 | 0, 54 | 1, 55 | 1, 56 | 1, 57 | 0, 58 | 1, 59 | 0, 60 | 1, 61 | 1, 62 | 1, 63 | 0, 64 | 0, 65 | 0, 66 | 1, 67 | 0, 68 | 1, 69 | 1, 70 | 1, 71 | 0, 72 | 1, 73 | ], 74 | Array [ 75 | 1, 76 | 0, 77 | 1, 78 | 1, 79 | 1, 80 | 0, 81 | 1, 82 | 0, 83 | 1, 84 | 1, 85 | 1, 86 | 0, 87 | 0, 88 | 0, 89 | 1, 90 | 0, 91 | 1, 92 | 1, 93 | 1, 94 | 0, 95 | 1, 96 | ], 97 | Array [ 98 | 1, 99 | 0, 100 | 1, 101 | 1, 102 | 1, 103 | 0, 104 | 1, 105 | 0, 106 | 0, 107 | 1, 108 | 0, 109 | 0, 110 | 0, 111 | 0, 112 | 1, 113 | 0, 114 | 1, 115 | 1, 116 | 1, 117 | 0, 118 | 1, 119 | ], 120 | Array [ 121 | 1, 122 | 0, 123 | 0, 124 | 0, 125 | 0, 126 | 0, 127 | 1, 128 | 0, 129 | 0, 130 | 0, 131 | 1, 132 | 1, 133 | 1, 134 | 0, 135 | 1, 136 | 0, 137 | 0, 138 | 0, 139 | 0, 140 | 0, 141 | 1, 142 | ], 143 | Array [ 144 | 1, 145 | 1, 146 | 1, 147 | 1, 148 | 1, 149 | 1, 150 | 1, 151 | 0, 152 | 1, 153 | 0, 154 | 1, 155 | 0, 156 | 1, 157 | 0, 158 | 1, 159 | 1, 160 | 1, 161 | 1, 162 | 1, 163 | 1, 164 | 1, 165 | ], 166 | Array [ 167 | 0, 168 | 0, 169 | 0, 170 | 0, 171 | 0, 172 | 0, 173 | 0, 174 | 0, 175 | 0, 176 | 0, 177 | 0, 178 | 1, 179 | 0, 180 | 0, 181 | 0, 182 | 0, 183 | 0, 184 | 0, 185 | 0, 186 | 0, 187 | 0, 188 | ], 189 | Array [ 190 | 0, 191 | 0, 192 | 0, 193 | 1, 194 | 1, 195 | 0, 196 | 1, 197 | 1, 198 | 0, 199 | 0, 200 | 0, 201 | 0, 202 | 0, 203 | 0, 204 | 0, 205 | 0, 206 | 0, 207 | 1, 208 | 1, 209 | 0, 210 | 0, 211 | ], 212 | Array [ 213 | 1, 214 | 1, 215 | 1, 216 | 0, 217 | 0, 218 | 1, 219 | 0, 220 | 0, 221 | 0, 222 | 1, 223 | 1, 224 | 1, 225 | 0, 226 | 1, 227 | 0, 228 | 0, 229 | 1, 230 | 1, 231 | 1, 232 | 0, 233 | 0, 234 | ], 235 | Array [ 236 | 1, 237 | 1, 238 | 1, 239 | 0, 240 | 0, 241 | 1, 242 | 1, 243 | 0, 244 | 1, 245 | 1, 246 | 1, 247 | 1, 248 | 1, 249 | 1, 250 | 1, 251 | 0, 252 | 1, 253 | 0, 254 | 1, 255 | 1, 256 | 1, 257 | ], 258 | Array [ 259 | 0, 260 | 0, 261 | 1, 262 | 0, 263 | 1, 264 | 1, 265 | 0, 266 | 1, 267 | 1, 268 | 0, 269 | 1, 270 | 1, 271 | 0, 272 | 1, 273 | 0, 274 | 0, 275 | 0, 276 | 0, 277 | 1, 278 | 0, 279 | 0, 280 | ], 281 | Array [ 282 | 1, 283 | 0, 284 | 0, 285 | 1, 286 | 0, 287 | 0, 288 | 1, 289 | 1, 290 | 1, 291 | 0, 292 | 1, 293 | 1, 294 | 0, 295 | 1, 296 | 0, 297 | 0, 298 | 0, 299 | 0, 300 | 0, 301 | 0, 302 | 1, 303 | ], 304 | Array [ 305 | 0, 306 | 0, 307 | 0, 308 | 0, 309 | 0, 310 | 0, 311 | 0, 312 | 0, 313 | 1, 314 | 1, 315 | 1, 316 | 0, 317 | 0, 318 | 0, 319 | 1, 320 | 1, 321 | 0, 322 | 0, 323 | 1, 324 | 0, 325 | 0, 326 | ], 327 | Array [ 328 | 1, 329 | 1, 330 | 1, 331 | 1, 332 | 1, 333 | 1, 334 | 1, 335 | 0, 336 | 1, 337 | 0, 338 | 1, 339 | 0, 340 | 0, 341 | 1, 342 | 1, 343 | 1, 344 | 1, 345 | 1, 346 | 0, 347 | 0, 348 | 0, 349 | ], 350 | Array [ 351 | 1, 352 | 0, 353 | 0, 354 | 0, 355 | 0, 356 | 0, 357 | 1, 358 | 0, 359 | 0, 360 | 0, 361 | 0, 362 | 1, 363 | 0, 364 | 1, 365 | 0, 366 | 1, 367 | 1, 368 | 1, 369 | 1, 370 | 0, 371 | 1, 372 | ], 373 | Array [ 374 | 1, 375 | 0, 376 | 1, 377 | 1, 378 | 1, 379 | 0, 380 | 1, 381 | 0, 382 | 1, 383 | 1, 384 | 0, 385 | 0, 386 | 0, 387 | 0, 388 | 1, 389 | 1, 390 | 0, 391 | 0, 392 | 0, 393 | 1, 394 | 1, 395 | ], 396 | Array [ 397 | 1, 398 | 0, 399 | 1, 400 | 1, 401 | 1, 402 | 0, 403 | 1, 404 | 0, 405 | 1, 406 | 0, 407 | 1, 408 | 0, 409 | 1, 410 | 1, 411 | 1, 412 | 0, 413 | 1, 414 | 0, 415 | 1, 416 | 0, 417 | 0, 418 | ], 419 | Array [ 420 | 1, 421 | 0, 422 | 1, 423 | 1, 424 | 1, 425 | 0, 426 | 1, 427 | 0, 428 | 0, 429 | 1, 430 | 0, 431 | 1, 432 | 1, 433 | 0, 434 | 0, 435 | 0, 436 | 0, 437 | 1, 438 | 1, 439 | 1, 440 | 1, 441 | ], 442 | Array [ 443 | 1, 444 | 0, 445 | 0, 446 | 0, 447 | 0, 448 | 0, 449 | 1, 450 | 0, 451 | 0, 452 | 0, 453 | 1, 454 | 0, 455 | 1, 456 | 1, 457 | 0, 458 | 0, 459 | 1, 460 | 0, 461 | 1, 462 | 1, 463 | 1, 464 | ], 465 | Array [ 466 | 1, 467 | 1, 468 | 1, 469 | 1, 470 | 1, 471 | 1, 472 | 1, 473 | 0, 474 | 0, 475 | 1, 476 | 1, 477 | 0, 478 | 0, 479 | 0, 480 | 0, 481 | 0, 482 | 0, 483 | 0, 484 | 1, 485 | 0, 486 | 0, 487 | ], 488 | ] 489 | `; 490 | 491 | exports[`generates with ecl:L correctly 1`] = ` 492 | Array [ 493 | Array [ 494 | 1, 495 | 1, 496 | 1, 497 | 1, 498 | 1, 499 | 1, 500 | 1, 501 | 0, 502 | 1, 503 | 1, 504 | 0, 505 | 0, 506 | 1, 507 | 0, 508 | 1, 509 | 1, 510 | 1, 511 | 1, 512 | 1, 513 | 1, 514 | 1, 515 | ], 516 | Array [ 517 | 1, 518 | 0, 519 | 0, 520 | 0, 521 | 0, 522 | 0, 523 | 1, 524 | 0, 525 | 0, 526 | 1, 527 | 0, 528 | 0, 529 | 1, 530 | 0, 531 | 1, 532 | 0, 533 | 0, 534 | 0, 535 | 0, 536 | 0, 537 | 1, 538 | ], 539 | Array [ 540 | 1, 541 | 0, 542 | 1, 543 | 1, 544 | 1, 545 | 0, 546 | 1, 547 | 0, 548 | 1, 549 | 0, 550 | 1, 551 | 0, 552 | 1, 553 | 0, 554 | 1, 555 | 0, 556 | 1, 557 | 1, 558 | 1, 559 | 0, 560 | 1, 561 | ], 562 | Array [ 563 | 1, 564 | 0, 565 | 1, 566 | 1, 567 | 1, 568 | 0, 569 | 1, 570 | 0, 571 | 1, 572 | 0, 573 | 0, 574 | 1, 575 | 0, 576 | 0, 577 | 1, 578 | 0, 579 | 1, 580 | 1, 581 | 1, 582 | 0, 583 | 1, 584 | ], 585 | Array [ 586 | 1, 587 | 0, 588 | 1, 589 | 1, 590 | 1, 591 | 0, 592 | 1, 593 | 0, 594 | 1, 595 | 1, 596 | 1, 597 | 0, 598 | 0, 599 | 0, 600 | 1, 601 | 0, 602 | 1, 603 | 1, 604 | 1, 605 | 0, 606 | 1, 607 | ], 608 | Array [ 609 | 1, 610 | 0, 611 | 0, 612 | 0, 613 | 0, 614 | 0, 615 | 1, 616 | 0, 617 | 0, 618 | 0, 619 | 0, 620 | 0, 621 | 0, 622 | 0, 623 | 1, 624 | 0, 625 | 0, 626 | 0, 627 | 0, 628 | 0, 629 | 1, 630 | ], 631 | Array [ 632 | 1, 633 | 1, 634 | 1, 635 | 1, 636 | 1, 637 | 1, 638 | 1, 639 | 0, 640 | 1, 641 | 0, 642 | 1, 643 | 0, 644 | 1, 645 | 0, 646 | 1, 647 | 1, 648 | 1, 649 | 1, 650 | 1, 651 | 1, 652 | 1, 653 | ], 654 | Array [ 655 | 0, 656 | 0, 657 | 0, 658 | 0, 659 | 0, 660 | 0, 661 | 0, 662 | 0, 663 | 0, 664 | 1, 665 | 1, 666 | 0, 667 | 0, 668 | 0, 669 | 0, 670 | 0, 671 | 0, 672 | 0, 673 | 0, 674 | 0, 675 | 0, 676 | ], 677 | Array [ 678 | 1, 679 | 1, 680 | 1, 681 | 1, 682 | 0, 683 | 0, 684 | 1, 685 | 0, 686 | 1, 687 | 0, 688 | 1, 689 | 0, 690 | 0, 691 | 1, 692 | 0, 693 | 0, 694 | 1, 695 | 1, 696 | 1, 697 | 0, 698 | 1, 699 | ], 700 | Array [ 701 | 1, 702 | 0, 703 | 0, 704 | 1, 705 | 1, 706 | 1, 707 | 0, 708 | 1, 709 | 0, 710 | 0, 711 | 1, 712 | 0, 713 | 1, 714 | 0, 715 | 0, 716 | 1, 717 | 0, 718 | 1, 719 | 1, 720 | 0, 721 | 1, 722 | ], 723 | Array [ 724 | 1, 725 | 0, 726 | 1, 727 | 0, 728 | 1, 729 | 1, 730 | 1, 731 | 0, 732 | 0, 733 | 0, 734 | 1, 735 | 0, 736 | 1, 737 | 1, 738 | 1, 739 | 1, 740 | 1, 741 | 0, 742 | 0, 743 | 1, 744 | 1, 745 | ], 746 | Array [ 747 | 1, 748 | 0, 749 | 1, 750 | 1, 751 | 0, 752 | 0, 753 | 0, 754 | 1, 755 | 1, 756 | 0, 757 | 1, 758 | 0, 759 | 1, 760 | 1, 761 | 0, 762 | 0, 763 | 0, 764 | 1, 765 | 0, 766 | 1, 767 | 0, 768 | ], 769 | Array [ 770 | 0, 771 | 1, 772 | 1, 773 | 0, 774 | 1, 775 | 0, 776 | 1, 777 | 0, 778 | 0, 779 | 1, 780 | 1, 781 | 1, 782 | 0, 783 | 1, 784 | 0, 785 | 0, 786 | 1, 787 | 1, 788 | 0, 789 | 1, 790 | 0, 791 | ], 792 | Array [ 793 | 0, 794 | 0, 795 | 0, 796 | 0, 797 | 0, 798 | 0, 799 | 0, 800 | 0, 801 | 1, 802 | 0, 803 | 1, 804 | 0, 805 | 0, 806 | 1, 807 | 0, 808 | 1, 809 | 0, 810 | 1, 811 | 0, 812 | 1, 813 | 0, 814 | ], 815 | Array [ 816 | 1, 817 | 1, 818 | 1, 819 | 1, 820 | 1, 821 | 1, 822 | 1, 823 | 0, 824 | 0, 825 | 0, 826 | 1, 827 | 0, 828 | 0, 829 | 1, 830 | 1, 831 | 0, 832 | 1, 833 | 1, 834 | 1, 835 | 0, 836 | 0, 837 | ], 838 | Array [ 839 | 1, 840 | 0, 841 | 0, 842 | 0, 843 | 0, 844 | 0, 845 | 1, 846 | 0, 847 | 0, 848 | 1, 849 | 0, 850 | 1, 851 | 1, 852 | 1, 853 | 1, 854 | 0, 855 | 0, 856 | 1, 857 | 1, 858 | 0, 859 | 0, 860 | ], 861 | Array [ 862 | 1, 863 | 0, 864 | 1, 865 | 1, 866 | 1, 867 | 0, 868 | 1, 869 | 0, 870 | 0, 871 | 1, 872 | 1, 873 | 1, 874 | 0, 875 | 0, 876 | 1, 877 | 0, 878 | 0, 879 | 0, 880 | 1, 881 | 1, 882 | 1, 883 | ], 884 | Array [ 885 | 1, 886 | 0, 887 | 1, 888 | 1, 889 | 1, 890 | 0, 891 | 1, 892 | 0, 893 | 1, 894 | 1, 895 | 0, 896 | 0, 897 | 0, 898 | 1, 899 | 0, 900 | 0, 901 | 1, 902 | 1, 903 | 0, 904 | 1, 905 | 0, 906 | ], 907 | Array [ 908 | 1, 909 | 0, 910 | 1, 911 | 1, 912 | 1, 913 | 0, 914 | 1, 915 | 0, 916 | 1, 917 | 0, 918 | 1, 919 | 1, 920 | 0, 921 | 1, 922 | 0, 923 | 0, 924 | 1, 925 | 0, 926 | 1, 927 | 0, 928 | 0, 929 | ], 930 | Array [ 931 | 1, 932 | 0, 933 | 0, 934 | 0, 935 | 0, 936 | 0, 937 | 1, 938 | 0, 939 | 1, 940 | 1, 941 | 1, 942 | 1, 943 | 1, 944 | 0, 945 | 1, 946 | 0, 947 | 1, 948 | 1, 949 | 0, 950 | 0, 951 | 1, 952 | ], 953 | Array [ 954 | 1, 955 | 1, 956 | 1, 957 | 1, 958 | 1, 959 | 1, 960 | 1, 961 | 0, 962 | 1, 963 | 1, 964 | 0, 965 | 1, 966 | 1, 967 | 0, 968 | 0, 969 | 1, 970 | 0, 971 | 0, 972 | 0, 973 | 0, 974 | 0, 975 | ], 976 | ] 977 | `; 978 | 979 | exports[`generates with ecl:M correctly 1`] = ` 980 | Array [ 981 | Array [ 982 | 1, 983 | 1, 984 | 1, 985 | 1, 986 | 1, 987 | 1, 988 | 1, 989 | 0, 990 | 0, 991 | 0, 992 | 1, 993 | 0, 994 | 0, 995 | 0, 996 | 1, 997 | 1, 998 | 1, 999 | 1, 1000 | 1, 1001 | 1, 1002 | 1, 1003 | ], 1004 | Array [ 1005 | 1, 1006 | 0, 1007 | 0, 1008 | 0, 1009 | 0, 1010 | 0, 1011 | 1, 1012 | 0, 1013 | 1, 1014 | 0, 1015 | 1, 1016 | 0, 1017 | 1, 1018 | 0, 1019 | 1, 1020 | 0, 1021 | 0, 1022 | 0, 1023 | 0, 1024 | 0, 1025 | 1, 1026 | ], 1027 | Array [ 1028 | 1, 1029 | 0, 1030 | 1, 1031 | 1, 1032 | 1, 1033 | 0, 1034 | 1, 1035 | 0, 1036 | 0, 1037 | 0, 1038 | 0, 1039 | 1, 1040 | 0, 1041 | 0, 1042 | 1, 1043 | 0, 1044 | 1, 1045 | 1, 1046 | 1, 1047 | 0, 1048 | 1, 1049 | ], 1050 | Array [ 1051 | 1, 1052 | 0, 1053 | 1, 1054 | 1, 1055 | 1, 1056 | 0, 1057 | 1, 1058 | 0, 1059 | 0, 1060 | 1, 1061 | 1, 1062 | 0, 1063 | 0, 1064 | 0, 1065 | 1, 1066 | 0, 1067 | 1, 1068 | 1, 1069 | 1, 1070 | 0, 1071 | 1, 1072 | ], 1073 | Array [ 1074 | 1, 1075 | 0, 1076 | 1, 1077 | 1, 1078 | 1, 1079 | 0, 1080 | 1, 1081 | 0, 1082 | 1, 1083 | 1, 1084 | 0, 1085 | 1, 1086 | 1, 1087 | 0, 1088 | 1, 1089 | 0, 1090 | 1, 1091 | 1, 1092 | 1, 1093 | 0, 1094 | 1, 1095 | ], 1096 | Array [ 1097 | 1, 1098 | 0, 1099 | 0, 1100 | 0, 1101 | 0, 1102 | 0, 1103 | 1, 1104 | 0, 1105 | 0, 1106 | 1, 1107 | 0, 1108 | 1, 1109 | 0, 1110 | 0, 1111 | 1, 1112 | 0, 1113 | 0, 1114 | 0, 1115 | 0, 1116 | 0, 1117 | 1, 1118 | ], 1119 | Array [ 1120 | 1, 1121 | 1, 1122 | 1, 1123 | 1, 1124 | 1, 1125 | 1, 1126 | 1, 1127 | 0, 1128 | 1, 1129 | 0, 1130 | 1, 1131 | 0, 1132 | 1, 1133 | 0, 1134 | 1, 1135 | 1, 1136 | 1, 1137 | 1, 1138 | 1, 1139 | 1, 1140 | 1, 1141 | ], 1142 | Array [ 1143 | 0, 1144 | 0, 1145 | 0, 1146 | 0, 1147 | 0, 1148 | 0, 1149 | 0, 1150 | 0, 1151 | 0, 1152 | 1, 1153 | 1, 1154 | 0, 1155 | 0, 1156 | 0, 1157 | 0, 1158 | 0, 1159 | 0, 1160 | 0, 1161 | 0, 1162 | 0, 1163 | 0, 1164 | ], 1165 | Array [ 1166 | 1, 1167 | 0, 1168 | 1, 1169 | 0, 1170 | 1, 1171 | 0, 1172 | 1, 1173 | 0, 1174 | 0, 1175 | 0, 1176 | 1, 1177 | 0, 1178 | 1, 1179 | 0, 1180 | 0, 1181 | 0, 1182 | 1, 1183 | 0, 1184 | 0, 1185 | 1, 1186 | 0, 1187 | ], 1188 | Array [ 1189 | 0, 1190 | 0, 1191 | 1, 1192 | 1, 1193 | 1, 1194 | 1, 1195 | 0, 1196 | 1, 1197 | 0, 1198 | 0, 1199 | 1, 1200 | 1, 1201 | 0, 1202 | 1, 1203 | 0, 1204 | 1, 1205 | 0, 1206 | 0, 1207 | 0, 1208 | 1, 1209 | 1, 1210 | ], 1211 | Array [ 1212 | 1, 1213 | 0, 1214 | 1, 1215 | 0, 1216 | 0, 1217 | 0, 1218 | 1, 1219 | 1, 1220 | 1, 1221 | 1, 1222 | 1, 1223 | 1, 1224 | 0, 1225 | 1, 1226 | 1, 1227 | 1, 1228 | 0, 1229 | 1, 1230 | 1, 1231 | 1, 1232 | 1, 1233 | ], 1234 | Array [ 1235 | 0, 1236 | 0, 1237 | 0, 1238 | 1, 1239 | 1, 1240 | 1, 1241 | 0, 1242 | 0, 1243 | 1, 1244 | 1, 1245 | 1, 1246 | 1, 1247 | 1, 1248 | 1, 1249 | 0, 1250 | 1, 1251 | 1, 1252 | 0, 1253 | 0, 1254 | 1, 1255 | 0, 1256 | ], 1257 | Array [ 1258 | 1, 1259 | 0, 1260 | 1, 1261 | 0, 1262 | 1, 1263 | 0, 1264 | 1, 1265 | 0, 1266 | 0, 1267 | 1, 1268 | 1, 1269 | 1, 1270 | 0, 1271 | 1, 1272 | 1, 1273 | 1, 1274 | 0, 1275 | 1, 1276 | 0, 1277 | 1, 1278 | 1, 1279 | ], 1280 | Array [ 1281 | 0, 1282 | 0, 1283 | 0, 1284 | 0, 1285 | 0, 1286 | 0, 1287 | 0, 1288 | 0, 1289 | 1, 1290 | 0, 1291 | 0, 1292 | 0, 1293 | 0, 1294 | 0, 1295 | 1, 1296 | 0, 1297 | 0, 1298 | 1, 1299 | 0, 1300 | 0, 1301 | 1, 1302 | ], 1303 | Array [ 1304 | 1, 1305 | 1, 1306 | 1, 1307 | 1, 1308 | 1, 1309 | 1, 1310 | 1, 1311 | 0, 1312 | 0, 1313 | 1, 1314 | 0, 1315 | 0, 1316 | 1, 1317 | 0, 1318 | 0, 1319 | 0, 1320 | 1, 1321 | 1, 1322 | 0, 1323 | 1, 1324 | 1, 1325 | ], 1326 | Array [ 1327 | 1, 1328 | 0, 1329 | 0, 1330 | 0, 1331 | 0, 1332 | 0, 1333 | 1, 1334 | 0, 1335 | 0, 1336 | 0, 1337 | 1, 1338 | 0, 1339 | 0, 1340 | 0, 1341 | 1, 1342 | 0, 1343 | 0, 1344 | 0, 1345 | 0, 1346 | 1, 1347 | 0, 1348 | ], 1349 | Array [ 1350 | 1, 1351 | 0, 1352 | 1, 1353 | 1, 1354 | 1, 1355 | 0, 1356 | 1, 1357 | 0, 1358 | 1, 1359 | 1, 1360 | 1, 1361 | 0, 1362 | 1, 1363 | 0, 1364 | 1, 1365 | 0, 1366 | 1, 1367 | 1, 1368 | 0, 1369 | 1, 1370 | 1, 1371 | ], 1372 | Array [ 1373 | 1, 1374 | 0, 1375 | 1, 1376 | 1, 1377 | 1, 1378 | 0, 1379 | 1, 1380 | 0, 1381 | 0, 1382 | 0, 1383 | 1, 1384 | 1, 1385 | 0, 1386 | 1, 1387 | 0, 1388 | 1, 1389 | 0, 1390 | 0, 1391 | 0, 1392 | 1, 1393 | 0, 1394 | ], 1395 | Array [ 1396 | 1, 1397 | 0, 1398 | 1, 1399 | 1, 1400 | 1, 1401 | 0, 1402 | 1, 1403 | 0, 1404 | 1, 1405 | 1, 1406 | 1, 1407 | 1, 1408 | 0, 1409 | 1, 1410 | 1, 1411 | 1, 1412 | 0, 1413 | 0, 1414 | 1, 1415 | 0, 1416 | 1, 1417 | ], 1418 | Array [ 1419 | 1, 1420 | 0, 1421 | 0, 1422 | 0, 1423 | 0, 1424 | 0, 1425 | 1, 1426 | 0, 1427 | 0, 1428 | 0, 1429 | 1, 1430 | 1, 1431 | 1, 1432 | 1, 1433 | 0, 1434 | 1, 1435 | 1, 1436 | 1, 1437 | 0, 1438 | 1, 1439 | 0, 1440 | ], 1441 | Array [ 1442 | 1, 1443 | 1, 1444 | 1, 1445 | 1, 1446 | 1, 1447 | 1, 1448 | 1, 1449 | 0, 1450 | 1, 1451 | 1, 1452 | 1, 1453 | 1, 1454 | 0, 1455 | 1, 1456 | 1, 1457 | 1, 1458 | 0, 1459 | 0, 1460 | 1, 1461 | 1, 1462 | 1, 1463 | ], 1464 | ] 1465 | `; 1466 | 1467 | exports[`generates with ecl:Q correctly 1`] = ` 1468 | Array [ 1469 | Array [ 1470 | 1, 1471 | 1, 1472 | 1, 1473 | 1, 1474 | 1, 1475 | 1, 1476 | 1, 1477 | 0, 1478 | 1, 1479 | 1, 1480 | 0, 1481 | 0, 1482 | 1, 1483 | 0, 1484 | 1, 1485 | 1, 1486 | 1, 1487 | 1, 1488 | 1, 1489 | 1, 1490 | 1, 1491 | ], 1492 | Array [ 1493 | 1, 1494 | 0, 1495 | 0, 1496 | 0, 1497 | 0, 1498 | 0, 1499 | 1, 1500 | 0, 1501 | 0, 1502 | 0, 1503 | 0, 1504 | 0, 1505 | 0, 1506 | 0, 1507 | 1, 1508 | 0, 1509 | 0, 1510 | 0, 1511 | 0, 1512 | 0, 1513 | 1, 1514 | ], 1515 | Array [ 1516 | 1, 1517 | 0, 1518 | 1, 1519 | 1, 1520 | 1, 1521 | 0, 1522 | 1, 1523 | 0, 1524 | 0, 1525 | 1, 1526 | 1, 1527 | 0, 1528 | 0, 1529 | 0, 1530 | 1, 1531 | 0, 1532 | 1, 1533 | 1, 1534 | 1, 1535 | 0, 1536 | 1, 1537 | ], 1538 | Array [ 1539 | 1, 1540 | 0, 1541 | 1, 1542 | 1, 1543 | 1, 1544 | 0, 1545 | 1, 1546 | 0, 1547 | 0, 1548 | 1, 1549 | 1, 1550 | 1, 1551 | 1, 1552 | 0, 1553 | 1, 1554 | 0, 1555 | 1, 1556 | 1, 1557 | 1, 1558 | 0, 1559 | 1, 1560 | ], 1561 | Array [ 1562 | 1, 1563 | 0, 1564 | 1, 1565 | 1, 1566 | 1, 1567 | 0, 1568 | 1, 1569 | 0, 1570 | 1, 1571 | 1, 1572 | 0, 1573 | 0, 1574 | 0, 1575 | 0, 1576 | 1, 1577 | 0, 1578 | 1, 1579 | 1, 1580 | 1, 1581 | 0, 1582 | 1, 1583 | ], 1584 | Array [ 1585 | 1, 1586 | 0, 1587 | 0, 1588 | 0, 1589 | 0, 1590 | 0, 1591 | 1, 1592 | 0, 1593 | 1, 1594 | 1, 1595 | 0, 1596 | 1, 1597 | 1, 1598 | 0, 1599 | 1, 1600 | 0, 1601 | 0, 1602 | 0, 1603 | 0, 1604 | 0, 1605 | 1, 1606 | ], 1607 | Array [ 1608 | 1, 1609 | 1, 1610 | 1, 1611 | 1, 1612 | 1, 1613 | 1, 1614 | 1, 1615 | 0, 1616 | 1, 1617 | 0, 1618 | 1, 1619 | 0, 1620 | 1, 1621 | 0, 1622 | 1, 1623 | 1, 1624 | 1, 1625 | 1, 1626 | 1, 1627 | 1, 1628 | 1, 1629 | ], 1630 | Array [ 1631 | 0, 1632 | 0, 1633 | 0, 1634 | 0, 1635 | 0, 1636 | 0, 1637 | 0, 1638 | 0, 1639 | 0, 1640 | 1, 1641 | 1, 1642 | 1, 1643 | 0, 1644 | 0, 1645 | 0, 1646 | 0, 1647 | 0, 1648 | 0, 1649 | 0, 1650 | 0, 1651 | 0, 1652 | ], 1653 | Array [ 1654 | 0, 1655 | 1, 1656 | 1, 1657 | 1, 1658 | 1, 1659 | 1, 1660 | 1, 1661 | 1, 1662 | 0, 1663 | 1, 1664 | 0, 1665 | 1, 1666 | 0, 1667 | 0, 1668 | 0, 1669 | 1, 1670 | 1, 1671 | 0, 1672 | 0, 1673 | 0, 1674 | 1, 1675 | ], 1676 | Array [ 1677 | 1, 1678 | 1, 1679 | 1, 1680 | 0, 1681 | 1, 1682 | 1, 1683 | 0, 1684 | 1, 1685 | 0, 1686 | 1, 1687 | 0, 1688 | 1, 1689 | 1, 1690 | 0, 1691 | 0, 1692 | 1, 1693 | 0, 1694 | 1, 1695 | 1, 1696 | 0, 1697 | 1, 1698 | ], 1699 | Array [ 1700 | 1, 1701 | 0, 1702 | 1, 1703 | 0, 1704 | 1, 1705 | 0, 1706 | 1, 1707 | 0, 1708 | 0, 1709 | 0, 1710 | 0, 1711 | 0, 1712 | 1, 1713 | 1, 1714 | 0, 1715 | 0, 1716 | 1, 1717 | 1, 1718 | 1, 1719 | 1, 1720 | 0, 1721 | ], 1722 | Array [ 1723 | 1, 1724 | 0, 1725 | 1, 1726 | 0, 1727 | 1, 1728 | 0, 1729 | 0, 1730 | 0, 1731 | 0, 1732 | 1, 1733 | 0, 1734 | 1, 1735 | 0, 1736 | 0, 1737 | 0, 1738 | 1, 1739 | 1, 1740 | 1, 1741 | 1, 1742 | 0, 1743 | 0, 1744 | ], 1745 | Array [ 1746 | 0, 1747 | 0, 1748 | 1, 1749 | 1, 1750 | 1, 1751 | 0, 1752 | 1, 1753 | 1, 1754 | 1, 1755 | 0, 1756 | 0, 1757 | 1, 1758 | 1, 1759 | 1, 1760 | 0, 1761 | 0, 1762 | 1, 1763 | 1, 1764 | 0, 1765 | 1, 1766 | 0, 1767 | ], 1768 | Array [ 1769 | 0, 1770 | 0, 1771 | 0, 1772 | 0, 1773 | 0, 1774 | 0, 1775 | 0, 1776 | 0, 1777 | 1, 1778 | 1, 1779 | 1, 1780 | 1, 1781 | 0, 1782 | 1, 1783 | 1, 1784 | 0, 1785 | 0, 1786 | 0, 1787 | 1, 1788 | 1, 1789 | 1, 1790 | ], 1791 | Array [ 1792 | 1, 1793 | 1, 1794 | 1, 1795 | 1, 1796 | 1, 1797 | 1, 1798 | 1, 1799 | 0, 1800 | 1, 1801 | 1, 1802 | 0, 1803 | 1, 1804 | 1, 1805 | 0, 1806 | 1, 1807 | 1, 1808 | 0, 1809 | 1, 1810 | 0, 1811 | 1, 1812 | 0, 1813 | ], 1814 | Array [ 1815 | 1, 1816 | 0, 1817 | 0, 1818 | 0, 1819 | 0, 1820 | 0, 1821 | 1, 1822 | 0, 1823 | 1, 1824 | 0, 1825 | 1, 1826 | 1, 1827 | 0, 1828 | 1, 1829 | 1, 1830 | 0, 1831 | 0, 1832 | 1, 1833 | 1, 1834 | 0, 1835 | 0, 1836 | ], 1837 | Array [ 1838 | 1, 1839 | 0, 1840 | 1, 1841 | 1, 1842 | 1, 1843 | 0, 1844 | 1, 1845 | 0, 1846 | 1, 1847 | 1, 1848 | 0, 1849 | 0, 1850 | 0, 1851 | 0, 1852 | 0, 1853 | 1, 1854 | 0, 1855 | 1, 1856 | 0, 1857 | 1, 1858 | 0, 1859 | ], 1860 | Array [ 1861 | 1, 1862 | 0, 1863 | 1, 1864 | 1, 1865 | 1, 1866 | 0, 1867 | 1, 1868 | 0, 1869 | 1, 1870 | 0, 1871 | 0, 1872 | 0, 1873 | 1, 1874 | 0, 1875 | 0, 1876 | 1, 1877 | 0, 1878 | 1, 1879 | 1, 1880 | 0, 1881 | 0, 1882 | ], 1883 | Array [ 1884 | 1, 1885 | 0, 1886 | 1, 1887 | 1, 1888 | 1, 1889 | 0, 1890 | 1, 1891 | 0, 1892 | 1, 1893 | 1, 1894 | 0, 1895 | 1, 1896 | 0, 1897 | 1, 1898 | 0, 1899 | 0, 1900 | 1, 1901 | 0, 1902 | 1, 1903 | 0, 1904 | 0, 1905 | ], 1906 | Array [ 1907 | 1, 1908 | 0, 1909 | 0, 1910 | 0, 1911 | 0, 1912 | 0, 1913 | 1, 1914 | 0, 1915 | 1, 1916 | 0, 1917 | 1, 1918 | 0, 1919 | 0, 1920 | 0, 1921 | 0, 1922 | 1, 1923 | 1, 1924 | 0, 1925 | 1, 1926 | 0, 1927 | 0, 1928 | ], 1929 | Array [ 1930 | 1, 1931 | 1, 1932 | 1, 1933 | 1, 1934 | 1, 1935 | 1, 1936 | 1, 1937 | 0, 1938 | 0, 1939 | 0, 1940 | 0, 1941 | 1, 1942 | 0, 1943 | 1, 1944 | 0, 1945 | 0, 1946 | 1, 1947 | 0, 1948 | 1, 1949 | 1, 1950 | 0, 1951 | ], 1952 | ] 1953 | `; 1954 | -------------------------------------------------------------------------------- /src/__tests__/__snapshots__/QRCode-test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`QRCode renders correctly 1`] = ` 4 |
5 | 6 | Defs: 7 | {} 8 | children: 9 | 10 | LinearGradient: 11 | {"id":"grad","x1":"0%","y1":"0%","x2":"100%","y2":"100%"} 12 | children: 13 | 14 | Stop: 15 | {"offset":"0","stopColor":"rgb(255,0,0)","stopOpacity":"1"} 16 | 17 | 18 | Stop: 19 | {"offset":"1","stopColor":"rgb(0,255,255)","stopOpacity":"1"} 20 | 21 | 22 | 23 | 24 | G: 25 | {} 26 | children: 27 | 28 | Rect: 29 | {"x":0,"y":0,"width":100,"height":100,"fill":"white"} 30 | 31 | 32 | 33 | G: 34 | {} 35 | children: 36 | 37 | Path: 38 | {"d":"M0 2 L28 2 M48 2 L60 2 M64 2 L68 2 M72 2 L100 2 M0 6 L4 6 M24 6 L28 6 M32 6 L52 6 M56 6 L68 6 M72 6 L76 6 M96 6 L100 6 M0 10 L4 10 M8 10 L20 10 M24 10 L28 10 M36 10 L40 10 M48 10 L60 10 M72 10 L76 10 M80 10 L92 10 M96 10 L100 10 M0 14 L4 14 M8 14 L20 14 M24 14 L28 14 M36 14 L40 14 M52 14 L64 14 M72 14 L76 14 M80 14 L92 14 M96 14 L100 14 M0 18 L4 18 M8 18 L20 18 M24 18 L28 18 M32 18 L36 18 M48 18 L52 18 M56 18 L64 18 M72 18 L76 18 M80 18 L92 18 M96 18 L100 18 M0 22 L4 22 M24 22 L28 22 M36 22 L40 22 M44 22 L48 22 M52 22 L56 22 M60 22 L64 22 M72 22 L76 22 M96 22 L100 22 M0 26 L28 26 M32 26 L36 26 M40 26 L44 26 M48 26 L52 26 M56 26 L60 26 M64 26 L68 26 M72 26 L100 26 M40 30 L44 30 M48 30 L68 30 M0 34 L4 34 M8 34 L12 34 M16 34 L20 34 M24 34 L28 34 M36 34 L40 34 M44 34 L48 34 M56 34 L60 34 M64 34 L68 34 M80 34 L84 34 M92 34 L96 34 M4 38 L8 38 M20 38 L24 38 M36 38 L44 38 M48 38 L52 38 M56 38 L60 38 M64 38 L80 38 M84 38 L100 38 M4 42 L8 42 M12 42 L20 42 M24 42 L28 42 M32 42 L36 42 M48 42 L56 42 M72 42 L100 42 M0 46 L24 46 M28 46 L32 46 M36 46 L44 46 M48 46 L52 46 M64 46 L72 46 M76 46 L80 46 M92 46 L96 46 M20 50 L40 50 M48 50 L52 50 M60 50 L76 50 M84 50 L88 50 M4 54 L24 54 M28 54 L32 54 M36 54 L40 54 M44 54 L56 54 M64 54 L68 54 M84 54 L88 54 M92 54 L100 54 M0 58 L4 58 M12 58 L32 58 M36 58 L40 58 M44 58 L52 58 M56 58 L60 58 M72 58 L76 58 M80 58 L88 58 M92 58 L100 58 M4 62 L24 62 M32 62 L44 62 M48 62 L60 62 M76 62 L80 62 M84 62 L88 62 M92 62 L96 62 M0 66 L4 66 M12 66 L16 66 M24 66 L32 66 M36 66 L40 66 M44 66 L48 66 M56 66 L60 66 M64 66 L84 66 M92 66 L100 66 M32 70 L40 70 M44 70 L48 70 M56 70 L68 70 M80 70 L88 70 M96 70 L100 70 M0 74 L28 74 M36 74 L44 74 M52 74 L56 74 M60 74 L68 74 M72 74 L76 74 M80 74 L84 74 M88 74 L100 74 M0 78 L4 78 M24 78 L28 78 M36 78 L40 78 M44 78 L48 78 M64 78 L68 78 M80 78 L84 78 M0 82 L4 82 M8 82 L20 82 M24 82 L28 82 M32 82 L44 82 M48 82 L52 82 M64 82 L84 82 M96 82 L100 82 M0 86 L4 86 M8 86 L20 86 M24 86 L28 86 M36 86 L40 86 M44 86 L56 86 M60 86 L64 86 M76 86 L92 86 M0 90 L4 90 M8 90 L20 90 M24 90 L28 90 M32 90 L36 90 M40 90 L52 90 M56 90 L60 90 M64 90 L76 90 M80 90 L92 90 M96 90 L100 90 M0 94 L4 94 M24 94 L28 94 M48 94 L72 94 M80 94 L84 94 M92 94 L96 94 M0 98 L28 98 M32 98 L48 98 M56 98 L60 98 M64 98 L68 98 M80 98 L88 98 M92 98 L100 98 ","strokeLinecap":"butt","stroke":"black","strokeWidth":4} 39 | 40 | 41 |
42 | `; 43 | 44 | exports[`QRCode renders with logo correctly 1`] = ` 45 |
46 | 47 | Defs: 48 | {} 49 | children: 50 | 51 | LinearGradient: 52 | {"id":"grad","x1":"0%","y1":"0%","x2":"100%","y2":"100%"} 53 | children: 54 | 55 | Stop: 56 | {"offset":"0","stopColor":"rgb(255,0,0)","stopOpacity":"1"} 57 | 58 | 59 | Stop: 60 | {"offset":"1","stopColor":"rgb(0,255,255)","stopOpacity":"1"} 61 | 62 | 63 | 64 | 65 | G: 66 | {} 67 | children: 68 | 69 | Rect: 70 | {"x":0,"y":0,"width":100,"height":100,"fill":"white"} 71 | 72 | 73 | 74 | G: 75 | {} 76 | children: 77 | 78 | Path: 79 | {"d":"M0 2 L28 2 M48 2 L60 2 M64 2 L68 2 M72 2 L100 2 M0 6 L4 6 M24 6 L28 6 M32 6 L52 6 M56 6 L68 6 M72 6 L76 6 M96 6 L100 6 M0 10 L4 10 M8 10 L20 10 M24 10 L28 10 M36 10 L40 10 M48 10 L60 10 M72 10 L76 10 M80 10 L92 10 M96 10 L100 10 M0 14 L4 14 M8 14 L20 14 M24 14 L28 14 M36 14 L40 14 M52 14 L64 14 M72 14 L76 14 M80 14 L92 14 M96 14 L100 14 M0 18 L4 18 M8 18 L20 18 M24 18 L28 18 M32 18 L36 18 M48 18 L52 18 M56 18 L64 18 M72 18 L76 18 M80 18 L92 18 M96 18 L100 18 M0 22 L4 22 M24 22 L28 22 M36 22 L40 22 M44 22 L48 22 M52 22 L56 22 M60 22 L64 22 M72 22 L76 22 M96 22 L100 22 M0 26 L28 26 M32 26 L36 26 M40 26 L44 26 M48 26 L52 26 M56 26 L60 26 M64 26 L68 26 M72 26 L100 26 M40 30 L44 30 M48 30 L68 30 M0 34 L4 34 M8 34 L12 34 M16 34 L20 34 M24 34 L28 34 M36 34 L40 34 M44 34 L48 34 M56 34 L60 34 M64 34 L68 34 M80 34 L84 34 M92 34 L96 34 M4 38 L8 38 M20 38 L24 38 M36 38 L44 38 M48 38 L52 38 M56 38 L60 38 M64 38 L80 38 M84 38 L100 38 M4 42 L8 42 M12 42 L20 42 M24 42 L28 42 M32 42 L36 42 M48 42 L56 42 M72 42 L100 42 M0 46 L24 46 M28 46 L32 46 M36 46 L44 46 M48 46 L52 46 M64 46 L72 46 M76 46 L80 46 M92 46 L96 46 M20 50 L40 50 M48 50 L52 50 M60 50 L76 50 M84 50 L88 50 M4 54 L24 54 M28 54 L32 54 M36 54 L40 54 M44 54 L56 54 M64 54 L68 54 M84 54 L88 54 M92 54 L100 54 M0 58 L4 58 M12 58 L32 58 M36 58 L40 58 M44 58 L52 58 M56 58 L60 58 M72 58 L76 58 M80 58 L88 58 M92 58 L100 58 M4 62 L24 62 M32 62 L44 62 M48 62 L60 62 M76 62 L80 62 M84 62 L88 62 M92 62 L96 62 M0 66 L4 66 M12 66 L16 66 M24 66 L32 66 M36 66 L40 66 M44 66 L48 66 M56 66 L60 66 M64 66 L84 66 M92 66 L100 66 M32 70 L40 70 M44 70 L48 70 M56 70 L68 70 M80 70 L88 70 M96 70 L100 70 M0 74 L28 74 M36 74 L44 74 M52 74 L56 74 M60 74 L68 74 M72 74 L76 74 M80 74 L84 74 M88 74 L100 74 M0 78 L4 78 M24 78 L28 78 M36 78 L40 78 M44 78 L48 78 M64 78 L68 78 M80 78 L84 78 M0 82 L4 82 M8 82 L20 82 M24 82 L28 82 M32 82 L44 82 M48 82 L52 82 M64 82 L84 82 M96 82 L100 82 M0 86 L4 86 M8 86 L20 86 M24 86 L28 86 M36 86 L40 86 M44 86 L56 86 M60 86 L64 86 M76 86 L92 86 M0 90 L4 90 M8 90 L20 90 M24 90 L28 90 M32 90 L36 90 M40 90 L52 90 M56 90 L60 90 M64 90 L76 90 M80 90 L92 90 M96 90 L100 90 M0 94 L4 94 M24 94 L28 94 M48 94 L72 94 M80 94 L84 94 M92 94 L96 94 M0 98 L28 98 M32 98 L48 98 M56 98 L60 98 M64 98 L68 98 M80 98 L88 98 M92 98 L100 98 ","strokeLinecap":"butt","stroke":"black","strokeWidth":4} 80 | 81 | 82 | 83 | G: 84 | {"x":38,"y":38} 85 | children: 86 | 87 | Defs: 88 | {} 89 | children: 90 | 91 | ClipPath: 92 | {"id":"clip-logo-background"} 93 | children: 94 | 95 | Rect: 96 | {"width":24,"height":24,"rx":0,"ry":0} 97 | 98 | 99 | 100 | ClipPath: 101 | {"id":"clip-logo"} 102 | children: 103 | 104 | Rect: 105 | {"width":20,"height":20,"rx":0,"ry":0} 106 | 107 | 108 | 109 | 110 | G: 111 | {} 112 | children: 113 | 114 | Rect: 115 | {"width":24,"height":24,"fill":"transparent","clipPath":"url(#clip-logo-background)"} 116 | 117 | 118 | 119 | G: 120 | {"x":2,"y":2} 121 | children: 122 | 123 | Image: 124 | {"width":20,"height":20,"preserveAspectRatio":"xMidYMid slice","href":{"uri":"fakeUri"},"clipPath":"url(#clip-logo)"} 125 | 126 | 127 | 128 |
129 | `; 130 | 131 | exports[`QRCode renders with segmented value 1`] = ` 132 |
133 | 134 | Defs: 135 | {} 136 | children: 137 | 138 | LinearGradient: 139 | {"id":"grad","x1":"0%","y1":"0%","x2":"100%","y2":"100%"} 140 | children: 141 | 142 | Stop: 143 | {"offset":"0","stopColor":"rgb(255,0,0)","stopOpacity":"1"} 144 | 145 | 146 | Stop: 147 | {"offset":"1","stopColor":"rgb(0,255,255)","stopOpacity":"1"} 148 | 149 | 150 | 151 | 152 | G: 153 | {} 154 | children: 155 | 156 | Rect: 157 | {"x":0,"y":0,"width":100,"height":100,"fill":"white"} 158 | 159 | 160 | 161 | G: 162 | {} 163 | children: 164 | 165 | Path: 166 | {"d":"M0 2.380952380952381 L33.333333333333336 2.380952380952381 M38.095238095238095 2.380952380952381 L42.857142857142854 2.380952380952381 M47.61904761904762 2.380952380952381 L61.904761904761905 2.380952380952381 M66.66666666666667 2.380952380952381 L100 2.380952380952381 M0 7.142857142857142 L4.761904761904762 7.142857142857142 M28.57142857142857 7.142857142857142 L33.333333333333336 7.142857142857142 M38.095238095238095 7.142857142857142 L57.14285714285714 7.142857142857142 M66.66666666666667 7.142857142857142 L71.42857142857143 7.142857142857142 M95.23809523809524 7.142857142857142 L100 7.142857142857142 M0 11.904761904761905 L4.761904761904762 11.904761904761905 M9.523809523809524 11.904761904761905 L23.80952380952381 11.904761904761905 M28.57142857142857 11.904761904761905 L33.333333333333336 11.904761904761905 M38.095238095238095 11.904761904761905 L47.61904761904762 11.904761904761905 M52.38095238095238 11.904761904761905 L61.904761904761905 11.904761904761905 M66.66666666666667 11.904761904761905 L71.42857142857143 11.904761904761905 M76.19047619047619 11.904761904761905 L90.47619047619048 11.904761904761905 M95.23809523809524 11.904761904761905 L100 11.904761904761905 M0 16.666666666666664 L4.761904761904762 16.666666666666664 M9.523809523809524 16.666666666666664 L23.80952380952381 16.666666666666664 M28.57142857142857 16.666666666666664 L33.333333333333336 16.666666666666664 M47.61904761904762 16.666666666666664 L52.38095238095238 16.666666666666664 M57.14285714285714 16.666666666666664 L61.904761904761905 16.666666666666664 M66.66666666666667 16.666666666666664 L71.42857142857143 16.666666666666664 M76.19047619047619 16.666666666666664 L90.47619047619048 16.666666666666664 M95.23809523809524 16.666666666666664 L100 16.666666666666664 M0 21.428571428571427 L4.761904761904762 21.428571428571427 M9.523809523809524 21.428571428571427 L23.80952380952381 21.428571428571427 M28.57142857142857 21.428571428571427 L33.333333333333336 21.428571428571427 M38.095238095238095 21.428571428571427 L47.61904761904762 21.428571428571427 M57.14285714285714 21.428571428571427 L61.904761904761905 21.428571428571427 M66.66666666666667 21.428571428571427 L71.42857142857143 21.428571428571427 M76.19047619047619 21.428571428571427 L90.47619047619048 21.428571428571427 M95.23809523809524 21.428571428571427 L100 21.428571428571427 M0 26.19047619047619 L4.761904761904762 26.19047619047619 M28.57142857142857 26.19047619047619 L33.333333333333336 26.19047619047619 M52.38095238095238 26.19047619047619 L61.904761904761905 26.19047619047619 M66.66666666666667 26.19047619047619 L71.42857142857143 26.19047619047619 M95.23809523809524 26.19047619047619 L100 26.19047619047619 M0 30.95238095238095 L33.333333333333336 30.95238095238095 M38.095238095238095 30.95238095238095 L42.857142857142854 30.95238095238095 M47.61904761904762 30.95238095238095 L52.38095238095238 30.95238095238095 M57.14285714285714 30.95238095238095 L61.904761904761905 30.95238095238095 M66.66666666666667 30.95238095238095 L100 30.95238095238095 M47.61904761904762 35.714285714285715 L61.904761904761905 35.714285714285715 M0 40.476190476190474 L4.761904761904762 40.476190476190474 M14.285714285714285 40.476190476190474 L42.857142857142854 40.476190476190474 M57.14285714285714 40.476190476190474 L66.66666666666667 40.476190476190474 M76.19047619047619 40.476190476190474 L80.95238095238095 40.476190476190474 M85.71428571428571 40.476190476190474 L100 40.476190476190474 M0 45.238095238095234 L4.761904761904762 45.238095238095234 M33.333333333333336 45.238095238095234 L38.095238095238095 45.238095238095234 M47.61904761904762 45.238095238095234 L52.38095238095238 45.238095238095234 M57.14285714285714 45.238095238095234 L66.66666666666667 45.238095238095234 M76.19047619047619 45.238095238095234 L100 45.238095238095234 M4.761904761904762 50 L23.80952380952381 50 M28.57142857142857 50 L33.333333333333336 50 M42.857142857142854 50 L47.61904761904762 50 M66.66666666666667 50 L76.19047619047619 50 M80.95238095238095 50 L95.23809523809524 50 M4.761904761904762 54.76190476190476 L28.57142857142857 54.76190476190476 M33.333333333333336 54.76190476190476 L38.095238095238095 54.76190476190476 M42.857142857142854 54.76190476190476 L57.14285714285714 54.76190476190476 M61.904761904761905 54.76190476190476 L66.66666666666667 54.76190476190476 M76.19047619047619 54.76190476190476 L80.95238095238095 54.76190476190476 M85.71428571428571 54.76190476190476 L90.47619047619048 54.76190476190476 M0 59.52380952380952 L9.523809523809524 59.52380952380952 M14.285714285714285 59.52380952380952 L19.047619047619047 59.52380952380952 M28.57142857142857 59.52380952380952 L42.857142857142854 59.52380952380952 M47.61904761904762 59.52380952380952 L52.38095238095238 59.52380952380952 M66.66666666666667 59.52380952380952 L71.42857142857143 59.52380952380952 M85.71428571428571 59.52380952380952 L90.47619047619048 59.52380952380952 M38.095238095238095 64.28571428571429 L42.857142857142854 64.28571428571429 M52.38095238095238 64.28571428571429 L61.904761904761905 64.28571428571429 M66.66666666666667 64.28571428571429 L76.19047619047619 64.28571428571429 M85.71428571428571 64.28571428571429 L90.47619047619048 64.28571428571429 M95.23809523809524 64.28571428571429 L100 64.28571428571429 M0 69.04761904761905 L33.333333333333336 69.04761904761905 M38.095238095238095 69.04761904761905 L42.857142857142854 69.04761904761905 M57.14285714285714 69.04761904761905 L80.95238095238095 69.04761904761905 M90.47619047619048 69.04761904761905 L100 69.04761904761905 M0 73.80952380952381 L4.761904761904762 73.80952380952381 M28.57142857142857 73.80952380952381 L33.333333333333336 73.80952380952381 M38.095238095238095 73.80952380952381 L47.61904761904762 73.80952380952381 M52.38095238095238 73.80952380952381 L71.42857142857143 73.80952380952381 M76.19047619047619 73.80952380952381 L80.95238095238095 73.80952380952381 M90.47619047619048 73.80952380952381 L95.23809523809524 73.80952380952381 M0 78.57142857142857 L4.761904761904762 78.57142857142857 M9.523809523809524 78.57142857142857 L23.80952380952381 78.57142857142857 M28.57142857142857 78.57142857142857 L33.333333333333336 78.57142857142857 M38.095238095238095 78.57142857142857 L76.19047619047619 78.57142857142857 M80.95238095238095 78.57142857142857 L85.71428571428571 78.57142857142857 M95.23809523809524 78.57142857142857 L100 78.57142857142857 M0 83.33333333333333 L4.761904761904762 83.33333333333333 M9.523809523809524 83.33333333333333 L23.80952380952381 83.33333333333333 M28.57142857142857 83.33333333333333 L33.333333333333336 83.33333333333333 M38.095238095238095 83.33333333333333 L42.857142857142854 83.33333333333333 M47.61904761904762 83.33333333333333 L61.904761904761905 83.33333333333333 M66.66666666666667 83.33333333333333 L90.47619047619048 83.33333333333333 M0 88.09523809523809 L4.761904761904762 88.09523809523809 M9.523809523809524 88.09523809523809 L23.80952380952381 88.09523809523809 M28.57142857142857 88.09523809523809 L33.333333333333336 88.09523809523809 M47.61904761904762 88.09523809523809 L52.38095238095238 88.09523809523809 M61.904761904761905 88.09523809523809 L80.95238095238095 88.09523809523809 M85.71428571428571 88.09523809523809 L100 88.09523809523809 M0 92.85714285714286 L4.761904761904762 92.85714285714286 M28.57142857142857 92.85714285714286 L33.333333333333336 92.85714285714286 M42.857142857142854 92.85714285714286 L52.38095238095238 92.85714285714286 M61.904761904761905 92.85714285714286 L71.42857142857143 92.85714285714286 M80.95238095238095 92.85714285714286 L95.23809523809524 92.85714285714286 M0 97.61904761904762 L33.333333333333336 97.61904761904762 M38.095238095238095 97.61904761904762 L42.857142857142854 97.61904761904762 M52.38095238095238 97.61904761904762 L57.14285714285714 97.61904761904762 M61.904761904761905 97.61904761904762 L66.66666666666667 97.61904761904762 M71.42857142857143 97.61904761904762 L95.23809523809524 97.61904761904762 ","strokeLinecap":"butt","stroke":"black","strokeWidth":4.761904761904762} 167 | 168 | 169 |
170 | `; 171 | -------------------------------------------------------------------------------- /src/genMatrix.js: -------------------------------------------------------------------------------- 1 | import QRCode from 'qrcode' 2 | 3 | export default (value, errorCorrectionLevel) => { 4 | const arr = Array.prototype.slice.call(QRCode.create(value, { errorCorrectionLevel }).modules.data, 0) 5 | const sqrt = Math.sqrt(arr.length) 6 | return arr.reduce((rows, key, index) => (index % sqrt === 0 ? rows.push([key]) : rows[rows.length - 1].push(key)) && rows, []) 7 | } 8 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React, { useMemo } from "react"; 2 | import Svg, { 3 | Defs, 4 | G, 5 | Path, 6 | Rect, 7 | Image, 8 | ClipPath, 9 | LinearGradient, 10 | Stop, 11 | } from "react-native-svg"; 12 | import genMatrix from "./genMatrix"; 13 | import transformMatrixIntoPath from "./transformMatrixIntoPath"; 14 | import LogoSVG from "./LogoSVG"; 15 | 16 | const renderLogo = ({ 17 | size, 18 | backgroundColor, 19 | logo, 20 | logoSVG, 21 | logoSize, 22 | logoBackgroundColor, 23 | logoColor, 24 | logoMargin, 25 | logoBorderRadius, 26 | }) => { 27 | const logoPosition = (size - logoSize - logoMargin * 2) / 2; 28 | const logoBackgroundSize = logoSize + logoMargin * 2; 29 | const logoBackgroundBorderRadius = 30 | logoBorderRadius + (logoMargin / logoSize) * logoBorderRadius; 31 | 32 | return ( 33 | 34 | 35 | 36 | 42 | 43 | 51 | 52 | 53 | 59 | 60 | 61 | 66 | {logoSVG ? ( 67 | 68 | ) : ( 69 | 76 | )} 77 | 78 | 79 | ); 80 | }; 81 | 82 | const QRCode = ({ 83 | value = "this is a QR code", 84 | size = 100, 85 | color = "black", 86 | backgroundColor = "white", 87 | logo, 88 | logoSVG, 89 | logoSize = size * 0.2, 90 | logoBackgroundColor = "transparent", 91 | logoColor, 92 | logoMargin = 2, 93 | logoBorderRadius = 0, 94 | quietZone = 0, 95 | enableLinearGradient = false, 96 | gradientDirection = ["0%", "0%", "100%", "100%"], 97 | linearGradient = ["rgb(255,0,0)", "rgb(0,255,255)"], 98 | ecl = "M", 99 | getRef, 100 | onError, 101 | testID, 102 | }) => { 103 | const result = useMemo(() => { 104 | try { 105 | return transformMatrixIntoPath(genMatrix(value, ecl), size); 106 | } catch (error) { 107 | if (onError && typeof onError === "function") { 108 | onError(error); 109 | } else { 110 | // Pass the error when no handler presented 111 | throw error; 112 | } 113 | } 114 | }, [value, size, ecl]); 115 | 116 | if (!result) { 117 | return null; 118 | } 119 | 120 | const { path, cellSize } = result; 121 | const displayLogo = logo || logoSVG; 122 | 123 | return ( 124 | 136 | 137 | 144 | 145 | 146 | 147 | 148 | 149 | 156 | 157 | 158 | 164 | 165 | {displayLogo && 166 | renderLogo({ 167 | size, 168 | backgroundColor, 169 | logo, 170 | logoSVG, 171 | logoSize, 172 | logoBackgroundColor, 173 | logoColor, 174 | logoMargin, 175 | logoBorderRadius, 176 | })} 177 | 178 | ); 179 | }; 180 | 181 | export default QRCode; 182 | -------------------------------------------------------------------------------- /src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-qrcode-svg", 3 | "description": "Add this file in order for `npm link` to work" 4 | } 5 | -------------------------------------------------------------------------------- /src/transformMatrixIntoPath.js: -------------------------------------------------------------------------------- 1 | export default (matrix, size) => { 2 | const cellSize = size / matrix.length 3 | let path = '' 4 | matrix.forEach((row, i) => { 5 | let needDraw = false 6 | row.forEach((column, j) => { 7 | if (column) { 8 | if (!needDraw) { 9 | path += `M${cellSize * j} ${cellSize / 2 + cellSize * i} ` 10 | needDraw = true 11 | } 12 | if (needDraw && j === matrix.length - 1) { 13 | path += `L${cellSize * (j + 1)} ${cellSize / 2 + cellSize * i} ` 14 | } 15 | } else { 16 | if (needDraw) { 17 | path += `L${cellSize * j} ${cellSize / 2 + cellSize * i} ` 18 | needDraw = false 19 | } 20 | } 21 | }) 22 | }) 23 | return { 24 | cellSize, 25 | path 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/utils.js: -------------------------------------------------------------------------------- 1 | export function isString(variable) { 2 | return typeof variable === "string"; 3 | } 4 | 5 | export function isUrlString(variable) { 6 | return isString(variable) && variable.startsWith("http"); 7 | } 8 | -------------------------------------------------------------------------------- /textEncodingTransformation.js: -------------------------------------------------------------------------------- 1 | const { readFileSync } = require('fs'); 2 | const semver = require('semver'); 3 | 4 | const fileToTransform = 'node_modules/react-native-qrcode-svg/src/index.js'; 5 | 6 | const upstreamTransformer = (() => { 7 | try { 8 | return require("@expo/metro-config/babel-transformer"); 9 | } catch (error) { 10 | try { 11 | return require("@react-native/metro-babel-transformer"); 12 | } catch (error) { 13 | return require("metro-react-native-babel-transformer"); 14 | } 15 | } 16 | })(); 17 | 18 | function createTransformer(transformer) { 19 | return async ({src, filename, ...rest}) => { 20 | if (filename === fileToTransform) { 21 | const packageJsonPath = require.resolve('react-native/package.json'); 22 | const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')); 23 | const ReactNativeVersion = packageJson.version; 24 | 25 | // React Native versions below 0.75 do not include a global TextEncoder implementation. 26 | // To ensure compatibility with these older versions, we add a polyfill using the 'text-encoding' library. 27 | if (semver.lt(ReactNativeVersion, '0.75.0')) { 28 | return transformer.transform({ 29 | src: `global.TextEncoder = require('text-encoding').TextEncoder;\n${src}`, 30 | filename, 31 | ...rest 32 | }); 33 | } 34 | } 35 | return transformer.transform({src, filename, ...rest}); 36 | }; 37 | } 38 | 39 | module.exports = { 40 | transform: createTransformer(upstreamTransformer), 41 | }; 42 | --------------------------------------------------------------------------------