├── LICENSE ├── adding-more-native-to-your-react-native-app.md ├── demo ├── .buckconfig ├── .eslintrc.js ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .prettierrc.js ├── .watchmanconfig ├── App.js ├── __tests__ │ └── App-test.js ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── build_defs.bzl │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── demo │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── animation.json ├── app.json ├── babel.config.js ├── index.js ├── ios │ ├── Podfile │ ├── Podfile.lock │ ├── demo-Bridging-Header.h │ ├── demo-tvOS │ │ └── Info.plist │ ├── demo-tvOSTests │ │ └── Info.plist │ ├── demo.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── demo-tvOS.xcscheme │ │ │ └── demo.xcscheme │ ├── demo.xcworkspace │ │ └── contents.xcworkspacedata │ ├── demo │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── demoTests │ │ ├── Info.plist │ │ └── demoTests.m ├── metro.config.js ├── package.json └── yarn.lock ├── demo59 ├── .buckconfig ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .watchmanconfig ├── App.js ├── __tests__ │ └── App-test.js ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── build_defs.bzl │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── demo59 │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── keystores │ │ ├── BUCK │ │ └── debug.keystore.properties │ └── settings.gradle ├── animation.json ├── app.json ├── babel.config.js ├── index.js ├── ios │ ├── demo59-tvOS │ │ └── Info.plist │ ├── demo59-tvOSTests │ │ └── Info.plist │ ├── demo59.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── demo59-tvOS.xcscheme │ │ │ └── demo59.xcscheme │ ├── demo59 │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── demo59Tests │ │ ├── Info.plist │ │ └── demo59Tests.m ├── metro.config.js ├── package.json └── yarn.lock └── presentation.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Eloy Durán 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 | -------------------------------------------------------------------------------- /adding-more-native-to-your-react-native-app.md: -------------------------------------------------------------------------------- 1 | # Adding more native to your React Native app 2 | 3 | ### Who are we? 4 | 5 | - Eloy Durán 6 | - @alloy 7 | - Author of CocoaPods 8 | - Engineer at Artsy, where we’ve been using React Native for 3.5 years in our brownfield app 9 | 10 | - Bartol Karuza 11 | - @bartolkaruza 12 | - Engineering Manager at Chargetrip 13 | - React Native advocate and contributor 14 | 15 | ### What will you learn from this presentation? 16 | 17 | - What native package ‘linking’ is 18 | - How to use it for iOS and Android platforms 19 | 20 | ## What is it and what problems does it solve? 21 | 22 | First, let’s talk about ‘linking’ _outside_ of the context of React Native. 23 | 24 | Perhaps you may have thought it was related to `npm link` / `yarn link`; however, beyond both making dependencies whose 25 | source exists on a local file-system available to a project, these tools are meant to allow one to _work_ on those 26 | dependencies and take their name from ‘symbolic link’, the manner in which they are made available to an application. In 27 | case you were not thinking this–never mind me, let’s carry on. 28 | 29 | Instead, the origins lie with tooling thats exist in native tool-chains, such as those used for languages like `C`, the 30 | term ‘linking’ refers to building up a working executable from various compiled modules–referred to as ‘object files’, 31 | that contain the compiled ‘object code’ corresponding to input source files. These can either be ‘statically’ linked, 32 | which basically just copies over the ‘object code’ into the executable; or they can be ‘dynamically’ linked, meaning the 33 | ‘object code’ is provided as a separate binary to the executable and loaded into memory at runtime. Why you would choose 34 | one over the other is beyond the scope of this presentation, but suffice it to say that for a native dependency’s code 35 | to be available to the application it needs to be linked in either of these manners. 36 | 37 | ‘Linking’ in the context of React Native _refers_ to this process, but in reality only covers _configuring_ your project 38 | for the actual linker machinery to be able to do its work at build time. This is the part that the rest of this 39 | presentation is concerned about. 40 | 41 | ## How was this done historically (for iOS)? 42 | 43 | Now that we understand what linking refers to in the context of React Native, let’s take a look at how this was done 44 | over the years in an iOS project. 45 | 46 | ### Manual 47 | 48 | As taken from [the React Native documentation](https://facebook.github.io/react-native/docs/linking-libraries-ios#manual-linking), 49 | a native package is expected to come with a Xcode project that instructs Xcode how to build a static library out of the 50 | package’s native source. 51 | 52 | 1. The user adds a reference to the package’s Xcode project to their own (app) Xcode project; 53 | 1. after which they are able to select the package’s static library from the list of libraries their application should 54 | link against; 55 | 1. and finally, where necessary, update build settings of the app Xcode project required by the dependency, such as 56 | including the correct C++ standard library. 57 | 1. If, at runtime, you are only using the package through JavaScript then you are done now. If you also need to use the 58 | package’s code from your own native code, you will need to setup header search paths so you can include the package’s 59 | headers in your source files. 60 | 1. If the package has any native dependencies of its own, you need to repeat the above steps for those dependencies. 61 | 62 | ### Automated 63 | 64 | An automated version of the exact same approach has existed for a while now, through the `link` command of the 65 | `react-native` command-line tool, in that it will actually edit your Xcode project on-disk. One limitation with this 66 | approach was that the tool doesn’t know about **native** transitive dependencies, and as such in those cases you would 67 | still have to perform the manual approach for those dependencies. 68 | 69 | ### What problems exist with this approach? 70 | 71 | 1. In an ideal scenario, you would have to perform 2 steps to manually integrate a single native package, at worst 72 | including additional build settings and multiplied by the number of **native** transitive dependencies the native 73 | package has. Even in the automated case, the inconsistency in handling **native** transitive dependencies isn’t the 74 | greatest developer-experience. 75 | 1. Needing to understand the build settings of Xcode and its underlying tooling. This isn’t necessarily a bad thing, 76 | things _can_ and _will_ break and it’s good to know how things work under the hood, but _having_ to do this each time 77 | even when on the happy path isn’t ideal. 78 | 1. Other than bookkeeping, there’s no easy way to track which build settings originated from what dependency, which 79 | becomes a maintenance burden when you want to upgrade or remove dependencies. 80 | 81 | ## Alternative and the future of React Native linking 82 | 83 | This is where relying on dependency managers comes in. Respective ecosystems already have dependency management 84 | solutions that are able to deal with all of the above, so in the spirit of standing on the shoulders of giants, let’s 85 | leverage those domain specific tools instead! 86 | 87 | In the case of iOS, the popular option is [CocoaPods](https://cocoapods.org)–which given a manifest that describes a 88 | project’s dependencies, similarly to a `package.json` file, will perform all of the aforementioned work _and_ do so in a 89 | maintainable manner. For instance, it is able to resolve and install transitive dependencies like any other dependency, 90 | it encapsulates dependency specific build settings in `xcconfig` files, and does so with minimal _one-time_ changes to 91 | your app’s Xcode project. 92 | 93 | Seeing as sooner or later most people will have to deal with linking native packages and the different ways in which you 94 | had to maintain your app’s Xcode project, the React Native maintainers decided to make utilizing CocoaPods the default 95 | since [version 0.60](https://facebook.github.io/react-native/blog/2019/07/03/version-60#cocoapods-by-default). (Gradle, 96 | for Android apps, was already the default.) 97 | 98 | So, great–now there’s a single place where you manage your native dependencies! But given this standardization, we can 99 | take it one step further and automate the process. 🐢s all the way down! 100 | 101 | ### Auto-linking 102 | 103 | Enter auto-linking, which is a new addition to the `react-native` command-line tool that discovers packages that have 104 | native requirements and offloads the responsibility of configuring the app project to the dependency manager for the 105 | respective platform. 106 | 107 | For iOS, this means that adding a native package boils down to: 108 | 109 | 1. Install the package, e.g. `yarn add lottie-react-native`. 110 | 1. Run `pod install`. 111 | 1. There’s no step 3. 112 | 113 | What this does under the hood, is that the CocoaPods manifest, the `Podfile`, includes a React Native specific helper, 114 | which on `pod install` will ask the `react-native` command-line tool for a list of all the native packages and their 115 | corresponding `podspec` files–which are the files that describe to CocoaPods how to build the library. It then 116 | **dynamically** includes those dependencies in its set of dependencies to resolve, as if they were all explicitly 117 | specified in the manifest. 118 | 119 | For instance, given a `Podfile` that includes the helper like so: 120 | 121 | ```ruby 122 | require_relative "../node_modules/@react-native-community/cli-platform-ios/native_modules" 123 | ``` 124 | 125 | …and with `lottie-react-native` as an example, this is what the helper will invoke: 126 | 127 | ``` 128 | $ npx --quiet react-native config 129 | ``` 130 | 131 | …and this is [part of] what `react-native` reports back to CocoaPods: 132 | 133 | ```json 134 | { 135 | "dependencies": { 136 | "lottie-react-native": { 137 | "root": "/path/to/project/node_modules/lottie-react-native", 138 | "name": "lottie-react-native", 139 | "platforms": { 140 | "ios": { 141 | "sourceDir": "/path/to/project/node_modules/lottie-react-native/src/ios", 142 | "folder": "/path/to/project/node_modules/lottie-react-native", 143 | "pbxprojPath": "/path/to/project/node_modules/lottie-react-native/src/ios/LottieReactNative.xcodeproj/project.pbxproj", 144 | "podfile": null, 145 | "podspecPath": "/path/to/project/node_modules/lottie-react-native/lottie-react-native.podspec", 146 | "projectPath": "/path/to/project/node_modules/lottie-react-native/src/ios/LottieReactNative.xcodeproj", 147 | "projectName": "LottieReactNative.xcodeproj", 148 | "libraryFolder": "Libraries", 149 | "sharedLibraries": [], 150 | "plist": [], 151 | "scriptPhases": [] 152 | }, 153 | "android": { 154 | "sourceDir": "/path/to/project/node_modules/lottie-react-native/src/android", 155 | "folder": "/path/to/project/node_modules/lottie-react-native", 156 | "packageImportPath": "import com.airbnb.android.react.lottie.LottiePackage;", 157 | "packageInstance": "new LottiePackage()" 158 | } 159 | }, 160 | "assets": [], 161 | "hooks": {}, 162 | "params": [] 163 | } 164 | } 165 | } 166 | ``` 167 | 168 | Given this, the helper will read the `podspec`: 169 | 170 | ```ruby 171 | Pod::Spec.new do |s| 172 | s.name = "lottie-react-native" 173 | s.source_files = "src/ios/**/*.{h,m,swift}" 174 | s.dependency "lottie-ios", "~> 3.1.3" 175 | end 176 | ``` 177 | 178 | …and dynamically add the native dependency, as if it were specified like so: 179 | 180 | ```ruby 181 | pod "lottie-react-native", :path => "../node_modules/lottie-react-native" 182 | ``` 183 | 184 | This will in turn resolve the dependency, its transitive dependencies, and setup the Xcode projects accordingly: 185 | 186 | ``` 187 | $ pod install 188 | Detected React Native module pod for lottie-react-native 189 | Analyzing dependencies 190 | Downloading dependencies 191 | Installing lottie-ios (3.1.3) 192 | Installing lottie-react-native (3.2.1) 193 | ``` 194 | 195 | ### Demo iOS 196 | 197 | ### Demo Android 198 | -------------------------------------------------------------------------------- /demo/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /demo/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native-community', 4 | }; 5 | -------------------------------------------------------------------------------- /demo/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore polyfills 9 | node_modules/react-native/Libraries/polyfills/.* 10 | 11 | ; These should not be required directly 12 | ; require from fbjs/lib instead: require('fbjs/lib/warning') 13 | node_modules/warning/.* 14 | 15 | ; Flow doesn't support platforms 16 | .*/Libraries/Utilities/LoadingView.js 17 | 18 | [untyped] 19 | .*/node_modules/@react-native-community/cli/.*/.* 20 | 21 | [include] 22 | 23 | [libs] 24 | node_modules/react-native/Libraries/react-native/react-native-interface.js 25 | node_modules/react-native/flow/ 26 | 27 | [options] 28 | emoji=true 29 | 30 | esproposal.optional_chaining=enable 31 | esproposal.nullish_coalescing=enable 32 | 33 | module.file_ext=.js 34 | module.file_ext=.json 35 | module.file_ext=.ios.js 36 | 37 | munge_underscores=true 38 | 39 | module.name_mapper='^react-native$' -> '/node_modules/react-native/Libraries/react-native/react-native-implementation' 40 | module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' 41 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' 42 | 43 | suppress_type=$FlowIssue 44 | suppress_type=$FlowFixMe 45 | suppress_type=$FlowFixMeProps 46 | suppress_type=$FlowFixMeState 47 | 48 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) 49 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ 50 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 51 | 52 | [lints] 53 | sketchy-null-number=warn 54 | sketchy-null-mixed=warn 55 | sketchy-number=warn 56 | untyped-type-import=warn 57 | nonstrict-import=warn 58 | deprecated-type=warn 59 | unsafe-getters-setters=warn 60 | inexact-spread=warn 61 | unnecessary-invariant=warn 62 | signature-verification-failure=warn 63 | deprecated-utility=error 64 | 65 | [strict] 66 | deprecated-type 67 | nonstrict-import 68 | sketchy-null 69 | unclear-type 70 | unsafe-getters-setters 71 | untyped-import 72 | untyped-type-import 73 | 74 | [version] 75 | ^0.105.0 76 | -------------------------------------------------------------------------------- /demo/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /demo/.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 | xcshareddata 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | !debug.keystore 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://docs.fastlane.tools/best-practices/source-control/ 51 | 52 | */fastlane/report.xml 53 | */fastlane/Preview.html 54 | */fastlane/screenshots 55 | 56 | # Bundle artifact 57 | *.jsbundle 58 | 59 | # CocoaPods 60 | /ios/Pods/ 61 | -------------------------------------------------------------------------------- /demo/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: false, 3 | jsxBracketSameLine: true, 4 | singleQuote: true, 5 | trailingComma: 'all', 6 | }; 7 | -------------------------------------------------------------------------------- /demo/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /demo/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import LottieView from 'lottie-react-native'; 3 | 4 | export default class BasicExample extends React.Component { 5 | render() { 6 | return ; 7 | } 8 | } -------------------------------------------------------------------------------- /demo/__tests__/App-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: test renderer must be required after react-native. 10 | import renderer from 'react-test-renderer'; 11 | 12 | it('renders correctly', () => { 13 | renderer.create(); 14 | }); 15 | -------------------------------------------------------------------------------- /demo/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.demo", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.demo", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /demo/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format 22 | * bundleCommand: "ram-bundle", 23 | * 24 | * // whether to bundle JS and assets in debug mode 25 | * bundleInDebug: false, 26 | * 27 | * // whether to bundle JS and assets in release mode 28 | * bundleInRelease: true, 29 | * 30 | * // whether to bundle JS and assets in another build variant (if configured). 31 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 32 | * // The configuration property can be in the following formats 33 | * // 'bundleIn${productFlavor}${buildType}' 34 | * // 'bundleIn${buildType}' 35 | * // bundleInFreeDebug: true, 36 | * // bundleInPaidRelease: true, 37 | * // bundleInBeta: true, 38 | * 39 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 40 | * // for example: to disable dev mode in the staging build type (if configured) 41 | * devDisabledInStaging: true, 42 | * // The configuration property can be in the following formats 43 | * // 'devDisabledIn${productFlavor}${buildType}' 44 | * // 'devDisabledIn${buildType}' 45 | * 46 | * // the root of your project, i.e. where "package.json" lives 47 | * root: "../../", 48 | * 49 | * // where to put the JS bundle asset in debug mode 50 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 51 | * 52 | * // where to put the JS bundle asset in release mode 53 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 54 | * 55 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 56 | * // require('./image.png')), in debug mode 57 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 58 | * 59 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 60 | * // require('./image.png')), in release mode 61 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 62 | * 63 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 64 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 65 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 66 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 67 | * // for example, you might want to remove it from here. 68 | * inputExcludes: ["android/**", "ios/**"], 69 | * 70 | * // override which node gets called and with what additional arguments 71 | * nodeExecutableAndArgs: ["node"], 72 | * 73 | * // supply additional arguments to the packager 74 | * extraPackagerArgs: [] 75 | * ] 76 | */ 77 | 78 | project.ext.react = [ 79 | entryFile: "index.js", 80 | enableHermes: false, // clean and rebuild if changing 81 | ] 82 | 83 | apply from: "../../node_modules/react-native/react.gradle" 84 | 85 | /** 86 | * Set this to true to create two separate APKs instead of one: 87 | * - An APK that only works on ARM devices 88 | * - An APK that only works on x86 devices 89 | * The advantage is the size of the APK is reduced by about 4MB. 90 | * Upload all the APKs to the Play Store and people will download 91 | * the correct one based on the CPU architecture of their device. 92 | */ 93 | def enableSeparateBuildPerCPUArchitecture = false 94 | 95 | /** 96 | * Run Proguard to shrink the Java bytecode in release builds. 97 | */ 98 | def enableProguardInReleaseBuilds = false 99 | 100 | /** 101 | * The preferred build flavor of JavaScriptCore. 102 | * 103 | * For example, to use the international variant, you can use: 104 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 105 | * 106 | * The international variant includes ICU i18n library and necessary data 107 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 108 | * give correct results when using with locales other than en-US. Note that 109 | * this variant is about 6MiB larger per architecture than default. 110 | */ 111 | def jscFlavor = 'org.webkit:android-jsc:+' 112 | 113 | /** 114 | * Whether to enable the Hermes VM. 115 | * 116 | * This should be set on project.ext.react and mirrored here. If it is not set 117 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 118 | * and the benefits of using Hermes will therefore be sharply reduced. 119 | */ 120 | def enableHermes = project.ext.react.get("enableHermes", false); 121 | 122 | android { 123 | compileSdkVersion rootProject.ext.compileSdkVersion 124 | 125 | compileOptions { 126 | sourceCompatibility JavaVersion.VERSION_1_8 127 | targetCompatibility JavaVersion.VERSION_1_8 128 | } 129 | 130 | defaultConfig { 131 | applicationId "com.demo" 132 | minSdkVersion rootProject.ext.minSdkVersion 133 | targetSdkVersion rootProject.ext.targetSdkVersion 134 | versionCode 1 135 | versionName "1.0" 136 | } 137 | splits { 138 | abi { 139 | reset() 140 | enable enableSeparateBuildPerCPUArchitecture 141 | universalApk false // If true, also generate a universal APK 142 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 143 | } 144 | } 145 | signingConfigs { 146 | debug { 147 | storeFile file('debug.keystore') 148 | storePassword 'android' 149 | keyAlias 'androiddebugkey' 150 | keyPassword 'android' 151 | } 152 | } 153 | buildTypes { 154 | debug { 155 | signingConfig signingConfigs.debug 156 | } 157 | release { 158 | // Caution! In production, you need to generate your own keystore file. 159 | // see https://facebook.github.io/react-native/docs/signed-apk-android. 160 | signingConfig signingConfigs.debug 161 | minifyEnabled enableProguardInReleaseBuilds 162 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 163 | } 164 | } 165 | // applicationVariants are e.g. debug, release 166 | applicationVariants.all { variant -> 167 | variant.outputs.each { output -> 168 | // For each separate APK per architecture, set a unique version code as described here: 169 | // https://developer.android.com/studio/build/configure-apk-splits.html 170 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 171 | def abi = output.getFilter(OutputFile.ABI) 172 | if (abi != null) { // null for the universal-debug, universal-release variants 173 | output.versionCodeOverride = 174 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 175 | } 176 | 177 | } 178 | } 179 | } 180 | 181 | dependencies { 182 | implementation fileTree(dir: "libs", include: ["*.jar"]) 183 | implementation "com.facebook.react:react-native:+" // From node_modules 184 | 185 | if (enableHermes) { 186 | def hermesPath = "../../node_modules/hermes-engine/android/"; 187 | debugImplementation files(hermesPath + "hermes-debug.aar") 188 | releaseImplementation files(hermesPath + "hermes-release.aar") 189 | } else { 190 | implementation jscFlavor 191 | } 192 | } 193 | 194 | // Run this once to be able to run the application with BUCK 195 | // puts all compile dependencies into folder libs for BUCK to use 196 | task copyDownloadableDepsToLibs(type: Copy) { 197 | from configurations.compile 198 | into 'libs' 199 | } 200 | 201 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 202 | -------------------------------------------------------------------------------- /demo/android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /demo/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo/android/app/debug.keystore -------------------------------------------------------------------------------- /demo/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 | -------------------------------------------------------------------------------- /demo/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /demo/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /demo/android/app/src/main/java/com/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.demo; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. This is used to schedule 9 | * rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "demo"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /demo/android/app/src/main/java/com/demo/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.demo; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.soloader.SoLoader; 10 | import java.lang.reflect.InvocationTargetException; 11 | import java.util.List; 12 | 13 | public class MainApplication extends Application implements ReactApplication { 14 | 15 | private final ReactNativeHost mReactNativeHost = 16 | new ReactNativeHost(this) { 17 | @Override 18 | public boolean getUseDeveloperSupport() { 19 | return BuildConfig.DEBUG; 20 | } 21 | 22 | @Override 23 | protected List getPackages() { 24 | @SuppressWarnings("UnnecessaryLocalVariable") 25 | List packages = new PackageList(this).getPackages(); 26 | // Packages that cannot be autolinked yet can be added manually here, for example: 27 | // packages.add(new MyReactNativePackage()); 28 | return packages; 29 | } 30 | 31 | @Override 32 | protected String getJSMainModuleName() { 33 | return "index"; 34 | } 35 | }; 36 | 37 | @Override 38 | public ReactNativeHost getReactNativeHost() { 39 | return mReactNativeHost; 40 | } 41 | 42 | @Override 43 | public void onCreate() { 44 | super.onCreate(); 45 | SoLoader.init(this, /* native exopackage */ false); 46 | initializeFlipper(this); // Remove this line if you don't want Flipper enabled 47 | } 48 | 49 | /** 50 | * Loads Flipper in React Native templates. 51 | * 52 | * @param context 53 | */ 54 | private static void initializeFlipper(Context context) { 55 | if (BuildConfig.DEBUG) { 56 | try { 57 | /* 58 | We use reflection here to pick up the class that initializes Flipper, 59 | since Flipper library is not available in release mode 60 | */ 61 | Class aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper"); 62 | aClass.getMethod("initializeFlipper", Context.class).invoke(null, context); 63 | } catch (ClassNotFoundException e) { 64 | e.printStackTrace(); 65 | } catch (NoSuchMethodException e) { 66 | e.printStackTrace(); 67 | } catch (IllegalAccessException e) { 68 | e.printStackTrace(); 69 | } catch (InvocationTargetException e) { 70 | e.printStackTrace(); 71 | } 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /demo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | demo 3 | 4 | -------------------------------------------------------------------------------- /demo/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /demo/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 28 8 | targetSdkVersion = 28 9 | } 10 | repositories { 11 | google() 12 | jcenter() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle:3.4.2") 16 | 17 | // NOTE: Do not place your application dependencies here; they belong 18 | // in the individual module build.gradle files 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | mavenLocal() 25 | maven { 26 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 27 | url("$rootDir/../node_modules/react-native/android") 28 | } 29 | maven { 30 | // Android JSC is installed from npm 31 | url("$rootDir/../node_modules/jsc-android/dist") 32 | } 33 | 34 | google() 35 | jcenter() 36 | maven { url 'https://jitpack.io' } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /demo/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useAndroidX=true 21 | android.enableJetifier=true 22 | -------------------------------------------------------------------------------- /demo/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /demo/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /demo/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin, switch paths to Windows format before running java 129 | if $cygwin ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /demo/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 http://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /demo/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'demo' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | -------------------------------------------------------------------------------- /demo/animation.json: -------------------------------------------------------------------------------- 1 | { 2 | "v": "4.6.3", 3 | "fr": 29.9700012207031, 4 | "ip": 0, 5 | "op": 141.000005743048, 6 | "w": 800, 7 | "h": 800, 8 | "nm": "Comp 1", 9 | "ddd": 0, 10 | "assets": [], 11 | "layers": [ 12 | { 13 | "ddd": 0, 14 | "ind": 1, 15 | "ty": 4, 16 | "nm": "center_circle", 17 | "ks": { 18 | "o": { "a": 0, "k": 100 }, 19 | "r": { "a": 0, "k": 0 }, 20 | "p": { "a": 0, "k": [401, 389, 0] }, 21 | "a": { "a": 0, "k": [-13.063, -22.86, 0] }, 22 | "s": { "a": 0, "k": [119.72, 119.72, 100] } 23 | }, 24 | "ao": 0, 25 | "shapes": [ 26 | { 27 | "ty": "gr", 28 | "it": [ 29 | { 30 | "d": 1, 31 | "ty": "el", 32 | "s": { "a": 0, "k": [77.344, 77.344] }, 33 | "p": { "a": 0, "k": [0, 0] }, 34 | "nm": "Ellipse Path 1", 35 | "mn": "ADBE Vector Shape - Ellipse" 36 | }, 37 | { 38 | "ty": "st", 39 | "c": { "a": 0, "k": [0.898039, 0.223529, 0.207843, 1] }, 40 | "o": { "a": 0, "k": 100 }, 41 | "w": { "a": 0, "k": 0 }, 42 | "lc": 1, 43 | "lj": 1, 44 | "ml": 4, 45 | "nm": "Stroke 1", 46 | "mn": "ADBE Vector Graphic - Stroke" 47 | }, 48 | { 49 | "ty": "fl", 50 | "c": { "a": 0, "k": [0.0196078, 0.6470588, 0.8196078, 1] }, 51 | "o": { "a": 0, "k": 100 }, 52 | "r": 1, 53 | "nm": "Fill 1", 54 | "mn": "ADBE Vector Graphic - Fill" 55 | }, 56 | { 57 | "ty": "tr", 58 | "p": { "a": 0, "k": [-14.328, -25.328], "ix": 2 }, 59 | "a": { "a": 0, "k": [0, 0], "ix": 1 }, 60 | "s": { 61 | "a": 1, 62 | "k": [ 63 | { 64 | "i": { "x": [0.667, 0.667], "y": [1, 1] }, 65 | "o": { "x": [0.333, 0.333], "y": [0, 0] }, 66 | "n": ["0p667_1_0p333_0", "0p667_1_0p333_0"], 67 | "t": 24, 68 | "s": [0, 0], 69 | "e": [160, 160] 70 | }, 71 | { 72 | "i": { "x": [0.667, 0.667], "y": [1, 1] }, 73 | "o": { "x": [0.333, 0.333], "y": [0, 0] }, 74 | "n": ["0p667_1_0p333_0", "0p667_1_0p333_0"], 75 | "t": 45, 76 | "s": [160, 160], 77 | "e": [70, 70] 78 | }, 79 | { 80 | "i": { "x": [0.667, 0.667], "y": [1, 1] }, 81 | "o": { "x": [0.333, 0.333], "y": [0, 0] }, 82 | "n": ["0p667_1_0p333_0", "0p667_1_0p333_0"], 83 | "t": 61, 84 | "s": [70, 70], 85 | "e": [130, 130] 86 | }, 87 | { 88 | "i": { "x": [0.667, 0.667], "y": [1, 1] }, 89 | "o": { "x": [0.333, 0.333], "y": [0, 0] }, 90 | "n": ["0p667_1_0p333_0", "0p667_1_0p333_0"], 91 | "t": 73, 92 | "s": [130, 130], 93 | "e": [80, 80] 94 | }, 95 | { 96 | "i": { "x": [0.667, 0.667], "y": [1, 1] }, 97 | "o": { "x": [0.333, 0.333], "y": [0, 0] }, 98 | "n": ["0p667_1_0p333_0", "0p667_1_0p333_0"], 99 | "t": 84, 100 | "s": [80, 80], 101 | "e": [110, 110] 102 | }, 103 | { 104 | "i": { "x": [0.667, 0.667], "y": [1, 1] }, 105 | "o": { "x": [0.333, 0.333], "y": [0, 0] }, 106 | "n": ["0p667_1_0p333_0", "0p667_1_0p333_0"], 107 | "t": 98, 108 | "s": [110, 110], 109 | "e": [100, 100] 110 | }, 111 | { "t": 116.000004724777 } 112 | ], 113 | "ix": 3 114 | }, 115 | "r": { "a": 0, "k": 0, "ix": 6 }, 116 | "o": { "a": 0, "k": 100, "ix": 7 }, 117 | "sk": { "a": 0, "k": 0, "ix": 4 }, 118 | "sa": { "a": 0, "k": 0, "ix": 5 }, 119 | "nm": "Transform" 120 | } 121 | ], 122 | "nm": "Ellipse 1", 123 | "np": 3, 124 | "cix": 2, 125 | "ix": 1, 126 | "mn": "ADBE Vector Group" 127 | } 128 | ], 129 | "ip": 0, 130 | "op": 900.000036657751, 131 | "st": 0, 132 | "bm": 0, 133 | "sr": 1 134 | }, 135 | { 136 | "ddd": 0, 137 | "ind": 2, 138 | "ty": 4, 139 | "nm": "circle3", 140 | "ks": { 141 | "o": { "a": 0, "k": 100 }, 142 | "r": { "a": 0, "k": -120.543 }, 143 | "p": { "a": 0, "k": [406, 375, 0] }, 144 | "a": { "a": 0, "k": [0, 0, 0] }, 145 | "s": { "a": 0, "k": [104.627, 108.478, 100] } 146 | }, 147 | "ao": 0, 148 | "shapes": [ 149 | { 150 | "ty": "gr", 151 | "it": [ 152 | { 153 | "d": 1, 154 | "ty": "el", 155 | "s": { "a": 0, "k": [497.445, 195.844] }, 156 | "p": { "a": 0, "k": [0, 0] }, 157 | "nm": "Ellipse Path 1", 158 | "mn": "ADBE Vector Shape - Ellipse" 159 | }, 160 | { 161 | "ty": "tm", 162 | "s": { 163 | "a": 1, 164 | "k": [ 165 | { 166 | "i": { "x": [0.833], "y": [1] }, 167 | "o": { "x": [0.333], "y": [0] }, 168 | "n": ["0p833_1_0p333_0"], 169 | "t": 64, 170 | "s": [100], 171 | "e": [0] 172 | }, 173 | { "t": 110.000004480392 } 174 | ], 175 | "ix": 1 176 | }, 177 | "e": { 178 | "a": 1, 179 | "k": [ 180 | { 181 | "i": { "x": [0.833], "y": [0.833] }, 182 | "o": { "x": [0.333], "y": [0.333] }, 183 | "n": ["0p833_0p833_0p333_0p333"], 184 | "t": 64, 185 | "s": [100], 186 | "e": [100] 187 | }, 188 | { "t": 110.000004480392 } 189 | ], 190 | "ix": 2 191 | }, 192 | "o": { 193 | "a": 1, 194 | "k": [ 195 | { 196 | "i": { "x": [0.69], "y": [3.268] }, 197 | "o": { "x": [0.294], "y": [0] }, 198 | "n": ["0p69_3p268_0p294_0"], 199 | "t": 64, 200 | "s": [1886.781], 201 | "e": [1765.781] 202 | }, 203 | { "t": 115.000004684046 } 204 | ], 205 | "ix": 3 206 | }, 207 | "m": 1, 208 | "ix": 2, 209 | "nm": "Trim Paths 1", 210 | "mn": "ADBE Vector Filter - Trim" 211 | }, 212 | { 213 | "ty": "st", 214 | "c": { "a": 0, "k": [0.0196078, 0.6470588, 0.8196078, 1] }, 215 | "o": { "a": 0, "k": 100 }, 216 | "w": { 217 | "a": 1, 218 | "k": [ 219 | { 220 | "i": { "x": [0.667], "y": [0.936] }, 221 | "o": { "x": [0.333], "y": [0] }, 222 | "n": ["0p667_0p936_0p333_0"], 223 | "t": 55, 224 | "s": [0], 225 | "e": [23.039] 226 | }, 227 | { 228 | "i": { "x": [0.667], "y": [1.13] }, 229 | "o": { "x": [0.333], "y": [-0.043] }, 230 | "n": ["0p667_1p13_0p333_-0p043"], 231 | "t": 74, 232 | "s": [23.039], 233 | "e": [3] 234 | }, 235 | { 236 | "i": { "x": [0.667], "y": [1] }, 237 | "o": { "x": [0.333], "y": [0.158] }, 238 | "n": ["0p667_1_0p333_0p158"], 239 | "t": 85, 240 | "s": [3], 241 | "e": [24] 242 | }, 243 | { "t": 99.0000040323527 } 244 | ] 245 | }, 246 | "lc": 2, 247 | "lj": 2, 248 | "nm": "Stroke 1", 249 | "mn": "ADBE Vector Graphic - Stroke" 250 | }, 251 | { 252 | "ty": "tr", 253 | "p": { "a": 0, "k": [-6.277, -10.078], "ix": 2 }, 254 | "a": { "a": 0, "k": [0, 0], "ix": 1 }, 255 | "s": { "a": 0, "k": [89.823, 86.077], "ix": 3 }, 256 | "r": { "a": 0, "k": 0, "ix": 6 }, 257 | "o": { "a": 0, "k": 100, "ix": 7 }, 258 | "sk": { "a": 0, "k": 0, "ix": 4 }, 259 | "sa": { "a": 0, "k": 0, "ix": 5 }, 260 | "nm": "Transform" 261 | } 262 | ], 263 | "nm": "Ellipse 1", 264 | "np": 3, 265 | "cix": 2, 266 | "ix": 1, 267 | "mn": "ADBE Vector Group" 268 | } 269 | ], 270 | "ip": 0, 271 | "op": 900.000036657751, 272 | "st": 0, 273 | "bm": 0, 274 | "sr": 1 275 | }, 276 | { 277 | "ddd": 0, 278 | "ind": 3, 279 | "ty": 4, 280 | "nm": "circle2", 281 | "ks": { 282 | "o": { "a": 0, "k": 100 }, 283 | "r": { "a": 0, "k": -59.94 }, 284 | "p": { "a": 0, "k": [413, 385, 0] }, 285 | "a": { "a": 0, "k": [0, 0, 0] }, 286 | "s": { "a": 0, "k": [104.627, 108.478, 100] } 287 | }, 288 | "ao": 0, 289 | "shapes": [ 290 | { 291 | "ty": "gr", 292 | "it": [ 293 | { 294 | "d": 1, 295 | "ty": "el", 296 | "s": { "a": 0, "k": [497.445, 195.844] }, 297 | "p": { "a": 0, "k": [0, 0] }, 298 | "nm": "Ellipse Path 1", 299 | "mn": "ADBE Vector Shape - Ellipse" 300 | }, 301 | { 302 | "ty": "tm", 303 | "s": { 304 | "a": 1, 305 | "k": [ 306 | { 307 | "i": { "x": [0.667], "y": [1] }, 308 | "o": { "x": [0.333], "y": [0] }, 309 | "n": ["0p667_1_0p333_0"], 310 | "t": 46, 311 | "s": [100], 312 | "e": [84.162] 313 | }, 314 | { 315 | "i": { "x": [0.833], "y": [1] }, 316 | "o": { "x": [0.333], "y": [-0.084] }, 317 | "n": ["0p833_1_0p333_-0p084"], 318 | "t": 73, 319 | "s": [84.162], 320 | "e": [100] 321 | }, 322 | { "t": 104.000004236007 } 323 | ], 324 | "ix": 1 325 | }, 326 | "e": { 327 | "a": 1, 328 | "k": [ 329 | { 330 | "i": { "x": [0.833], "y": [1] }, 331 | "o": { "x": [0.324], "y": [0] }, 332 | "n": ["0p833_1_0p324_0"], 333 | "t": 46, 334 | "s": [100], 335 | "e": [0] 336 | }, 337 | { "t": 104.000004236007 } 338 | ], 339 | "ix": 2 340 | }, 341 | "o": { 342 | "a": 1, 343 | "k": [ 344 | { 345 | "i": { "x": [0.667], "y": [0.953] }, 346 | "o": { "x": [0.327], "y": [0] }, 347 | "n": ["0p667_0p953_0p327_0"], 348 | "t": 46, 349 | "s": [50], 350 | "e": [2101.915] 351 | }, 352 | { "t": 105.000004276738 } 353 | ], 354 | "ix": 3 355 | }, 356 | "m": 1, 357 | "ix": 2, 358 | "nm": "Trim Paths 1", 359 | "mn": "ADBE Vector Filter - Trim" 360 | }, 361 | { 362 | "ty": "st", 363 | "c": { "a": 0, "k": [0.0196078, 0.6470588, 0.8196078, 1] }, 364 | "o": { "a": 0, "k": 100 }, 365 | "w": { 366 | "a": 1, 367 | "k": [ 368 | { 369 | "i": { "x": [0.667], "y": [0.91] }, 370 | "o": { "x": [0.333], "y": [0] }, 371 | "n": ["0p667_0p91_0p333_0"], 372 | "t": 60, 373 | "s": [0], 374 | "e": [13] 375 | }, 376 | { 377 | "i": { "x": [0.667], "y": [1.258] }, 378 | "o": { "x": [0.333], "y": [-0.085] }, 379 | "n": ["0p667_1p258_0p333_-0p085"], 380 | "t": 75, 381 | "s": [13], 382 | "e": [2] 383 | }, 384 | { 385 | "i": { "x": [0.667], "y": [1] }, 386 | "o": { "x": [0.333], "y": [0.183] }, 387 | "n": ["0p667_1_0p333_0p183"], 388 | "t": 87, 389 | "s": [2], 390 | "e": [24] 391 | }, 392 | { "t": 104.000004236007 } 393 | ] 394 | }, 395 | "lc": 2, 396 | "lj": 2, 397 | "nm": "Stroke 1", 398 | "mn": "ADBE Vector Graphic - Stroke" 399 | }, 400 | { 401 | "ty": "tr", 402 | "p": { "a": 0, "k": [-7.277, -10.078], "ix": 2 }, 403 | "a": { "a": 0, "k": [0, 0], "ix": 1 }, 404 | "s": { "a": 0, "k": [89.823, 86.077], "ix": 3 }, 405 | "r": { "a": 0, "k": 0, "ix": 6 }, 406 | "o": { "a": 0, "k": 100, "ix": 7 }, 407 | "sk": { "a": 0, "k": 0, "ix": 4 }, 408 | "sa": { "a": 0, "k": 0, "ix": 5 }, 409 | "nm": "Transform" 410 | } 411 | ], 412 | "nm": "Ellipse 1", 413 | "np": 3, 414 | "cix": 2, 415 | "ix": 1, 416 | "mn": "ADBE Vector Group" 417 | } 418 | ], 419 | "ip": 0, 420 | "op": 900.000036657751, 421 | "st": 0, 422 | "bm": 0, 423 | "sr": 1 424 | }, 425 | { 426 | "ddd": 0, 427 | "ind": 4, 428 | "ty": 4, 429 | "nm": "circle1", 430 | "ks": { 431 | "o": { "a": 0, "k": 100 }, 432 | "r": { "a": 0, "k": 0 }, 433 | "p": { "a": 0, "k": [407, 397, 0] }, 434 | "a": { "a": 0, "k": [0, 0, 0] }, 435 | "s": { "a": 0, "k": [104.627, 108.478, 100] } 436 | }, 437 | "ao": 0, 438 | "shapes": [ 439 | { 440 | "ty": "gr", 441 | "it": [ 442 | { 443 | "d": 1, 444 | "ty": "el", 445 | "s": { "a": 0, "k": [497.445, 195.844] }, 446 | "p": { "a": 0, "k": [0, 0] }, 447 | "nm": "Ellipse Path 1", 448 | "mn": "ADBE Vector Shape - Ellipse" 449 | }, 450 | { 451 | "ty": "tm", 452 | "s": { 453 | "a": 1, 454 | "k": [ 455 | { 456 | "i": { "x": [0.833], "y": [0.833] }, 457 | "o": { "x": [0.167], "y": [0.167] }, 458 | "n": ["0p833_0p833_0p167_0p167"], 459 | "t": 0, 460 | "s": [100], 461 | "e": [100] 462 | }, 463 | { 464 | "i": { "x": [0.667], "y": [1] }, 465 | "o": { "x": [0.333], "y": [0] }, 466 | "n": ["0p667_1_0p333_0"], 467 | "t": 53, 468 | "s": [100], 469 | "e": [55.162] 470 | }, 471 | { 472 | "i": { "x": [0.833], "y": [1] }, 473 | "o": { "x": [0.333], "y": [0.01] }, 474 | "n": ["0p833_1_0p333_0p01"], 475 | "t": 92, 476 | "s": [55.162], 477 | "e": [0] 478 | }, 479 | { "t": 105.000004276738 } 480 | ], 481 | "ix": 1 482 | }, 483 | "e": { 484 | "a": 1, 485 | "k": [ 486 | { 487 | "i": { "x": [0.833], "y": [0.833] }, 488 | "o": { "x": [0.167], "y": [0.167] }, 489 | "n": ["0p833_0p833_0p167_0p167"], 490 | "t": 0, 491 | "s": [100], 492 | "e": [100] 493 | }, 494 | { 495 | "i": { "x": [0.833], "y": [0.833] }, 496 | "o": { "x": [0.333], "y": [0.333] }, 497 | "n": ["0p833_0p833_0p333_0p333"], 498 | "t": 53, 499 | "s": [100], 500 | "e": [100] 501 | }, 502 | { "t": 103.000004195276 } 503 | ], 504 | "ix": 2 505 | }, 506 | "o": { 507 | "a": 1, 508 | "k": [ 509 | { 510 | "i": { "x": [0.833], "y": [1] }, 511 | "o": { "x": [0.167], "y": [0.167] }, 512 | "n": ["0p833_1_0p167_0p167"], 513 | "t": 0, 514 | "s": [100], 515 | "e": [50] 516 | }, 517 | { 518 | "i": { "x": [0.714], "y": [0.721] }, 519 | "o": { "x": [0.303], "y": [0] }, 520 | "n": ["0p714_0p721_0p303_0"], 521 | "t": 53, 522 | "s": [50], 523 | "e": [958.781] 524 | }, 525 | { "t": 104.000004236007 } 526 | ], 527 | "ix": 3 528 | }, 529 | "m": 1, 530 | "ix": 2, 531 | "nm": "Trim Paths 1", 532 | "mn": "ADBE Vector Filter - Trim" 533 | }, 534 | { 535 | "ty": "st", 536 | "c": { "a": 0, "k": [0.0196078, 0.6470588, 0.8196078, 1] }, 537 | "o": { "a": 0, "k": 100 }, 538 | "w": { 539 | "a": 1, 540 | "k": [ 541 | { 542 | "i": { "x": [0.667], "y": [0.908] }, 543 | "o": { "x": [0.333], "y": [0] }, 544 | "n": ["0p667_0p908_0p333_0"], 545 | "t": 52, 546 | "s": [0], 547 | "e": [16.039] 548 | }, 549 | { 550 | "i": { "x": [0.667], "y": [1.259] }, 551 | "o": { "x": [0.333], "y": [-0.085] }, 552 | "n": ["0p667_1p259_0p333_-0p085"], 553 | "t": 71, 554 | "s": [16.039], 555 | "e": [6] 556 | }, 557 | { 558 | "i": { "x": [0.667], "y": [1] }, 559 | "o": { "x": [0.333], "y": [0.184] }, 560 | "n": ["0p667_1_0p333_0p184"], 561 | "t": 82, 562 | "s": [6], 563 | "e": [24] 564 | }, 565 | { "t": 96.0000039101602 } 566 | ] 567 | }, 568 | "lc": 2, 569 | "lj": 2, 570 | "nm": "Stroke 1", 571 | "mn": "ADBE Vector Graphic - Stroke" 572 | }, 573 | { 574 | "ty": "tr", 575 | "p": { "a": 0, "k": [-7.277, -10.078], "ix": 2 }, 576 | "a": { "a": 0, "k": [0, 0], "ix": 1 }, 577 | "s": { "a": 0, "k": [89.823, 86.077], "ix": 3 }, 578 | "r": { "a": 0, "k": 0, "ix": 6 }, 579 | "o": { "a": 0, "k": 100, "ix": 7 }, 580 | "sk": { "a": 0, "k": 0, "ix": 4 }, 581 | "sa": { "a": 0, "k": 0, "ix": 5 }, 582 | "nm": "Transform" 583 | } 584 | ], 585 | "nm": "Ellipse 1", 586 | "np": 3, 587 | "cix": 2, 588 | "ix": 1, 589 | "mn": "ADBE Vector Group" 590 | } 591 | ], 592 | "ip": 0, 593 | "op": 900.000036657751, 594 | "st": 0, 595 | "bm": 0, 596 | "sr": 1 597 | } 598 | ] 599 | } 600 | -------------------------------------------------------------------------------- /demo/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo", 3 | "displayName": "demo" 4 | } -------------------------------------------------------------------------------- /demo/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /demo/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /demo/ios/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '9.0' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | target 'demo' do 5 | # Pods for demo 6 | pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" 7 | pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" 8 | pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" 9 | pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" 10 | pod 'React', :path => '../node_modules/react-native/' 11 | pod 'React-Core', :path => '../node_modules/react-native/' 12 | pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' 13 | pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' 14 | pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' 15 | pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' 16 | pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' 17 | pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' 18 | pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' 19 | pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' 20 | pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' 21 | pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' 22 | pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' 23 | pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' 24 | 25 | pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' 26 | pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' 27 | pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' 28 | pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' 29 | pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon" 30 | pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" 31 | pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga' 32 | 33 | pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' 34 | pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' 35 | pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' 36 | 37 | target 'demoTests' do 38 | inherit! :search_paths 39 | # Pods for testing 40 | end 41 | 42 | use_native_modules! 43 | end 44 | 45 | target 'demo-tvOS' do 46 | # Pods for demo-tvOS 47 | 48 | target 'demo-tvOSTests' do 49 | inherit! :search_paths 50 | # Pods for testing 51 | end 52 | 53 | end 54 | -------------------------------------------------------------------------------- /demo/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - boost-for-react-native (1.63.0) 3 | - DoubleConversion (1.1.6) 4 | - FBLazyVector (0.61.2) 5 | - FBReactNativeSpec (0.61.2): 6 | - Folly (= 2018.10.22.00) 7 | - RCTRequired (= 0.61.2) 8 | - RCTTypeSafety (= 0.61.2) 9 | - React-Core (= 0.61.2) 10 | - React-jsi (= 0.61.2) 11 | - ReactCommon/turbomodule/core (= 0.61.2) 12 | - Folly (2018.10.22.00): 13 | - boost-for-react-native 14 | - DoubleConversion 15 | - Folly/Default (= 2018.10.22.00) 16 | - glog 17 | - Folly/Default (2018.10.22.00): 18 | - boost-for-react-native 19 | - DoubleConversion 20 | - glog 21 | - glog (0.3.5) 22 | - RCTRequired (0.61.2) 23 | - RCTTypeSafety (0.61.2): 24 | - FBLazyVector (= 0.61.2) 25 | - Folly (= 2018.10.22.00) 26 | - RCTRequired (= 0.61.2) 27 | - React-Core (= 0.61.2) 28 | - React (0.61.2): 29 | - React-Core (= 0.61.2) 30 | - React-Core/DevSupport (= 0.61.2) 31 | - React-Core/RCTWebSocket (= 0.61.2) 32 | - React-RCTActionSheet (= 0.61.2) 33 | - React-RCTAnimation (= 0.61.2) 34 | - React-RCTBlob (= 0.61.2) 35 | - React-RCTImage (= 0.61.2) 36 | - React-RCTLinking (= 0.61.2) 37 | - React-RCTNetwork (= 0.61.2) 38 | - React-RCTSettings (= 0.61.2) 39 | - React-RCTText (= 0.61.2) 40 | - React-RCTVibration (= 0.61.2) 41 | - React-Core (0.61.2): 42 | - Folly (= 2018.10.22.00) 43 | - glog 44 | - React-Core/Default (= 0.61.2) 45 | - React-cxxreact (= 0.61.2) 46 | - React-jsi (= 0.61.2) 47 | - React-jsiexecutor (= 0.61.2) 48 | - Yoga 49 | - React-Core/CoreModulesHeaders (0.61.2): 50 | - Folly (= 2018.10.22.00) 51 | - glog 52 | - React-Core/Default 53 | - React-cxxreact (= 0.61.2) 54 | - React-jsi (= 0.61.2) 55 | - React-jsiexecutor (= 0.61.2) 56 | - Yoga 57 | - React-Core/Default (0.61.2): 58 | - Folly (= 2018.10.22.00) 59 | - glog 60 | - React-cxxreact (= 0.61.2) 61 | - React-jsi (= 0.61.2) 62 | - React-jsiexecutor (= 0.61.2) 63 | - Yoga 64 | - React-Core/DevSupport (0.61.2): 65 | - Folly (= 2018.10.22.00) 66 | - glog 67 | - React-Core/Default (= 0.61.2) 68 | - React-Core/RCTWebSocket (= 0.61.2) 69 | - React-cxxreact (= 0.61.2) 70 | - React-jsi (= 0.61.2) 71 | - React-jsiexecutor (= 0.61.2) 72 | - React-jsinspector (= 0.61.2) 73 | - Yoga 74 | - React-Core/RCTActionSheetHeaders (0.61.2): 75 | - Folly (= 2018.10.22.00) 76 | - glog 77 | - React-Core/Default 78 | - React-cxxreact (= 0.61.2) 79 | - React-jsi (= 0.61.2) 80 | - React-jsiexecutor (= 0.61.2) 81 | - Yoga 82 | - React-Core/RCTAnimationHeaders (0.61.2): 83 | - Folly (= 2018.10.22.00) 84 | - glog 85 | - React-Core/Default 86 | - React-cxxreact (= 0.61.2) 87 | - React-jsi (= 0.61.2) 88 | - React-jsiexecutor (= 0.61.2) 89 | - Yoga 90 | - React-Core/RCTBlobHeaders (0.61.2): 91 | - Folly (= 2018.10.22.00) 92 | - glog 93 | - React-Core/Default 94 | - React-cxxreact (= 0.61.2) 95 | - React-jsi (= 0.61.2) 96 | - React-jsiexecutor (= 0.61.2) 97 | - Yoga 98 | - React-Core/RCTImageHeaders (0.61.2): 99 | - Folly (= 2018.10.22.00) 100 | - glog 101 | - React-Core/Default 102 | - React-cxxreact (= 0.61.2) 103 | - React-jsi (= 0.61.2) 104 | - React-jsiexecutor (= 0.61.2) 105 | - Yoga 106 | - React-Core/RCTLinkingHeaders (0.61.2): 107 | - Folly (= 2018.10.22.00) 108 | - glog 109 | - React-Core/Default 110 | - React-cxxreact (= 0.61.2) 111 | - React-jsi (= 0.61.2) 112 | - React-jsiexecutor (= 0.61.2) 113 | - Yoga 114 | - React-Core/RCTNetworkHeaders (0.61.2): 115 | - Folly (= 2018.10.22.00) 116 | - glog 117 | - React-Core/Default 118 | - React-cxxreact (= 0.61.2) 119 | - React-jsi (= 0.61.2) 120 | - React-jsiexecutor (= 0.61.2) 121 | - Yoga 122 | - React-Core/RCTSettingsHeaders (0.61.2): 123 | - Folly (= 2018.10.22.00) 124 | - glog 125 | - React-Core/Default 126 | - React-cxxreact (= 0.61.2) 127 | - React-jsi (= 0.61.2) 128 | - React-jsiexecutor (= 0.61.2) 129 | - Yoga 130 | - React-Core/RCTTextHeaders (0.61.2): 131 | - Folly (= 2018.10.22.00) 132 | - glog 133 | - React-Core/Default 134 | - React-cxxreact (= 0.61.2) 135 | - React-jsi (= 0.61.2) 136 | - React-jsiexecutor (= 0.61.2) 137 | - Yoga 138 | - React-Core/RCTVibrationHeaders (0.61.2): 139 | - Folly (= 2018.10.22.00) 140 | - glog 141 | - React-Core/Default 142 | - React-cxxreact (= 0.61.2) 143 | - React-jsi (= 0.61.2) 144 | - React-jsiexecutor (= 0.61.2) 145 | - Yoga 146 | - React-Core/RCTWebSocket (0.61.2): 147 | - Folly (= 2018.10.22.00) 148 | - glog 149 | - React-Core/Default (= 0.61.2) 150 | - React-cxxreact (= 0.61.2) 151 | - React-jsi (= 0.61.2) 152 | - React-jsiexecutor (= 0.61.2) 153 | - Yoga 154 | - React-CoreModules (0.61.2): 155 | - FBReactNativeSpec (= 0.61.2) 156 | - Folly (= 2018.10.22.00) 157 | - RCTTypeSafety (= 0.61.2) 158 | - React-Core/CoreModulesHeaders (= 0.61.2) 159 | - React-RCTImage (= 0.61.2) 160 | - ReactCommon/turbomodule/core (= 0.61.2) 161 | - React-cxxreact (0.61.2): 162 | - boost-for-react-native (= 1.63.0) 163 | - DoubleConversion 164 | - Folly (= 2018.10.22.00) 165 | - glog 166 | - React-jsinspector (= 0.61.2) 167 | - React-jsi (0.61.2): 168 | - boost-for-react-native (= 1.63.0) 169 | - DoubleConversion 170 | - Folly (= 2018.10.22.00) 171 | - glog 172 | - React-jsi/Default (= 0.61.2) 173 | - React-jsi/Default (0.61.2): 174 | - boost-for-react-native (= 1.63.0) 175 | - DoubleConversion 176 | - Folly (= 2018.10.22.00) 177 | - glog 178 | - React-jsiexecutor (0.61.2): 179 | - DoubleConversion 180 | - Folly (= 2018.10.22.00) 181 | - glog 182 | - React-cxxreact (= 0.61.2) 183 | - React-jsi (= 0.61.2) 184 | - React-jsinspector (0.61.2) 185 | - React-RCTActionSheet (0.61.2): 186 | - React-Core/RCTActionSheetHeaders (= 0.61.2) 187 | - React-RCTAnimation (0.61.2): 188 | - React-Core/RCTAnimationHeaders (= 0.61.2) 189 | - React-RCTBlob (0.61.2): 190 | - React-Core/RCTBlobHeaders (= 0.61.2) 191 | - React-Core/RCTWebSocket (= 0.61.2) 192 | - React-jsi (= 0.61.2) 193 | - React-RCTNetwork (= 0.61.2) 194 | - React-RCTImage (0.61.2): 195 | - React-Core/RCTImageHeaders (= 0.61.2) 196 | - React-RCTNetwork (= 0.61.2) 197 | - React-RCTLinking (0.61.2): 198 | - React-Core/RCTLinkingHeaders (= 0.61.2) 199 | - React-RCTNetwork (0.61.2): 200 | - React-Core/RCTNetworkHeaders (= 0.61.2) 201 | - React-RCTSettings (0.61.2): 202 | - React-Core/RCTSettingsHeaders (= 0.61.2) 203 | - React-RCTText (0.61.2): 204 | - React-Core/RCTTextHeaders (= 0.61.2) 205 | - React-RCTVibration (0.61.2): 206 | - React-Core/RCTVibrationHeaders (= 0.61.2) 207 | - ReactCommon/jscallinvoker (0.61.2): 208 | - DoubleConversion 209 | - Folly (= 2018.10.22.00) 210 | - glog 211 | - React-cxxreact (= 0.61.2) 212 | - ReactCommon/turbomodule/core (0.61.2): 213 | - DoubleConversion 214 | - Folly (= 2018.10.22.00) 215 | - glog 216 | - React-Core (= 0.61.2) 217 | - React-cxxreact (= 0.61.2) 218 | - React-jsi (= 0.61.2) 219 | - ReactCommon/jscallinvoker (= 0.61.2) 220 | - Yoga (1.14.0) 221 | 222 | DEPENDENCIES: 223 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) 224 | - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) 225 | - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`) 226 | - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`) 227 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) 228 | - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) 229 | - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) 230 | - React (from `../node_modules/react-native/`) 231 | - React-Core (from `../node_modules/react-native/`) 232 | - React-Core/DevSupport (from `../node_modules/react-native/`) 233 | - React-Core/RCTWebSocket (from `../node_modules/react-native/`) 234 | - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) 235 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) 236 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) 237 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) 238 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) 239 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) 240 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) 241 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) 242 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`) 243 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) 244 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) 245 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) 246 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`) 247 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) 248 | - ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`) 249 | - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) 250 | - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) 251 | 252 | SPEC REPOS: 253 | trunk: 254 | - boost-for-react-native 255 | 256 | EXTERNAL SOURCES: 257 | DoubleConversion: 258 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" 259 | FBLazyVector: 260 | :path: "../node_modules/react-native/Libraries/FBLazyVector" 261 | FBReactNativeSpec: 262 | :path: "../node_modules/react-native/Libraries/FBReactNativeSpec" 263 | Folly: 264 | :podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec" 265 | glog: 266 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" 267 | RCTRequired: 268 | :path: "../node_modules/react-native/Libraries/RCTRequired" 269 | RCTTypeSafety: 270 | :path: "../node_modules/react-native/Libraries/TypeSafety" 271 | React: 272 | :path: "../node_modules/react-native/" 273 | React-Core: 274 | :path: "../node_modules/react-native/" 275 | React-CoreModules: 276 | :path: "../node_modules/react-native/React/CoreModules" 277 | React-cxxreact: 278 | :path: "../node_modules/react-native/ReactCommon/cxxreact" 279 | React-jsi: 280 | :path: "../node_modules/react-native/ReactCommon/jsi" 281 | React-jsiexecutor: 282 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor" 283 | React-jsinspector: 284 | :path: "../node_modules/react-native/ReactCommon/jsinspector" 285 | React-RCTActionSheet: 286 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS" 287 | React-RCTAnimation: 288 | :path: "../node_modules/react-native/Libraries/NativeAnimation" 289 | React-RCTBlob: 290 | :path: "../node_modules/react-native/Libraries/Blob" 291 | React-RCTImage: 292 | :path: "../node_modules/react-native/Libraries/Image" 293 | React-RCTLinking: 294 | :path: "../node_modules/react-native/Libraries/LinkingIOS" 295 | React-RCTNetwork: 296 | :path: "../node_modules/react-native/Libraries/Network" 297 | React-RCTSettings: 298 | :path: "../node_modules/react-native/Libraries/Settings" 299 | React-RCTText: 300 | :path: "../node_modules/react-native/Libraries/Text" 301 | React-RCTVibration: 302 | :path: "../node_modules/react-native/Libraries/Vibration" 303 | ReactCommon: 304 | :path: "../node_modules/react-native/ReactCommon" 305 | Yoga: 306 | :path: "../node_modules/react-native/ReactCommon/yoga" 307 | 308 | SPEC CHECKSUMS: 309 | boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c 310 | DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2 311 | FBLazyVector: 68b6a76960fbd8ecd9fb7ce0aadd3329c3340a99 312 | FBReactNativeSpec: 5a764c60abdc3336a213e5310c40b74741f32839 313 | Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51 314 | glog: 1f3da668190260b06b429bb211bfbee5cd790c28 315 | RCTRequired: c639d59ed389cfb1f1203f65c2ea946d8ec586e2 316 | RCTTypeSafety: dc23fb655d6c77667c78e327bf661bc11e3b8aec 317 | React: 7e586e5d7bec12b91c1a096826b0fc9ab1da7865 318 | React-Core: 8ddb9770b4a30a6ab4a754e6ed5ec76454e3d699 319 | React-CoreModules: b3d9eece8ad7df36c917a41f05c1168c52fe0b34 320 | React-cxxreact: 1f972757c0bd08d962ef78068e06613c27489a3f 321 | React-jsi: 32285a21b1b24c36060493ed3057a34677d58d09 322 | React-jsiexecutor: 8909917ff7d8f21a57e443a866fd8d4560e50c65 323 | React-jsinspector: 111d7d342b07a904c400592e02a2b958f1098b60 324 | React-RCTActionSheet: 89b037c0fb7d2671607cb645760164e7e0c013f6 325 | React-RCTAnimation: e3cefa93c38c004c318f7ec04b883eb14b8b8235 326 | React-RCTBlob: d26ac0e313fbf14e7203473fd593ccaaeee8329e 327 | React-RCTImage: 4bdd9588783fa9e48ef669ccd4f747224e208edf 328 | React-RCTLinking: 65f0088ff463babd3d5d567964a65b74141eff3b 329 | React-RCTNetwork: 0c1a73576c1cfeafe68396556de1b17d93c0c595 330 | React-RCTSettings: 4194f1f0edbddf3fd44d1714dc6578bb20379b60 331 | React-RCTText: e3ef6191cdb627855ff7fe8fa0c1e14094967fb8 332 | React-RCTVibration: fb54c732fd20405a76598e431aa2f8c2bf527de9 333 | ReactCommon: 5848032ed2f274fcb40f6b9ec24067787c42d479 334 | Yoga: 14927e37bd25376d216b150ab2a561773d57911f 335 | 336 | PODFILE CHECKSUM: eae004b1deb19cf458545a3b07ebe6ca0e6e0556 337 | 338 | COCOAPODS: 1.8.3 339 | -------------------------------------------------------------------------------- /demo/ios/demo-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /demo/ios/demo-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSExceptionDomains 28 | 29 | localhost 30 | 31 | NSExceptionAllowsInsecureHTTPLoads 32 | 33 | 34 | 35 | 36 | NSLocationWhenInUseUsageDescription 37 | 38 | UILaunchStoryboardName 39 | LaunchScreen 40 | UIRequiredDeviceCapabilities 41 | 42 | armv7 43 | 44 | UISupportedInterfaceOrientations 45 | 46 | UIInterfaceOrientationPortrait 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | UIViewControllerBasedStatusBarAppearance 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /demo/ios/demo-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 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 | -------------------------------------------------------------------------------- /demo/ios/demo.xcodeproj/xcshareddata/xcschemes/demo-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /demo/ios/demo.xcodeproj/xcshareddata/xcschemes/demo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /demo/ios/demo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /demo/ios/demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /demo/ios/demo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | #import 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 19 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 20 | moduleName:@"demo" 21 | initialProperties:nil]; 22 | 23 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 24 | 25 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 26 | UIViewController *rootViewController = [UIViewController new]; 27 | rootViewController.view = rootView; 28 | self.window.rootViewController = rootViewController; 29 | [self.window makeKeyAndVisible]; 30 | return YES; 31 | } 32 | 33 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 34 | { 35 | #if DEBUG 36 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 37 | #else 38 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 39 | #endif 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /demo/ios/demo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /demo/ios/demo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /demo/ios/demo/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /demo/ios/demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | demo 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSExceptionDomains 32 | 33 | localhost 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | 38 | 39 | 40 | NSLocationWhenInUseUsageDescription 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UIViewControllerBasedStatusBarAppearance 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /demo/ios/demo/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /demo/ios/demoTests/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 | -------------------------------------------------------------------------------- /demo/ios/demoTests/demoTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | #import 12 | #import 13 | 14 | #define TIMEOUT_SECONDS 600 15 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 16 | 17 | @interface demoTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation demoTests 22 | 23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 24 | { 25 | if (test(view)) { 26 | return YES; 27 | } 28 | for (UIView *subview in [view subviews]) { 29 | if ([self findSubviewInView:subview matching:test]) { 30 | return YES; 31 | } 32 | } 33 | return NO; 34 | } 35 | 36 | - (void)testRendersWelcomeScreen 37 | { 38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 40 | BOOL foundElement = NO; 41 | 42 | __block NSString *redboxError = nil; 43 | #ifdef DEBUG 44 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 45 | if (level >= RCTLogLevelError) { 46 | redboxError = message; 47 | } 48 | }); 49 | #endif 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | #ifdef DEBUG 64 | RCTSetLogFunction(RCTDefaultLogFunction); 65 | #endif 66 | 67 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 68 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 69 | } 70 | 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /demo/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: false, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios", 8 | "start": "react-native start", 9 | "test": "jest", 10 | "lint": "eslint ." 11 | }, 12 | "dependencies": { 13 | "react": "16.9.0", 14 | "react-native": "0.61.2" 15 | }, 16 | "devDependencies": { 17 | "@babel/core": "^7.6.4", 18 | "@babel/runtime": "^7.6.3", 19 | "@react-native-community/eslint-config": "^0.0.5", 20 | "babel-jest": "^24.9.0", 21 | "eslint": "^6.6.0", 22 | "jest": "^24.9.0", 23 | "metro-react-native-babel-preset": "^0.56.3", 24 | "react-test-renderer": "16.9.0" 25 | }, 26 | "jest": { 27 | "preset": "react-native" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /demo59/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /demo59/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | .*/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | .*/Libraries/polyfills/.* 18 | 19 | ; Ignore metro 20 | .*/node_modules/metro/.* 21 | 22 | [include] 23 | 24 | [libs] 25 | node_modules/react-native/Libraries/react-native/react-native-interface.js 26 | node_modules/react-native/flow/ 27 | 28 | [options] 29 | emoji=true 30 | 31 | esproposal.optional_chaining=enable 32 | esproposal.nullish_coalescing=enable 33 | 34 | module.system=haste 35 | module.system.haste.use_name_reducers=true 36 | # get basename 37 | module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' 38 | # strip .js or .js.flow suffix 39 | module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' 40 | # strip .ios suffix 41 | module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' 42 | module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' 43 | module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' 44 | module.system.haste.paths.blacklist=.*/__tests__/.* 45 | module.system.haste.paths.blacklist=.*/__mocks__/.* 46 | module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* 47 | module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* 48 | 49 | munge_underscores=true 50 | 51 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 52 | 53 | module.file_ext=.js 54 | module.file_ext=.jsx 55 | module.file_ext=.json 56 | module.file_ext=.native.js 57 | 58 | suppress_type=$FlowIssue 59 | suppress_type=$FlowFixMe 60 | suppress_type=$FlowFixMeProps 61 | suppress_type=$FlowFixMeState 62 | 63 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 64 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 65 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 66 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 67 | 68 | [version] 69 | ^0.92.0 70 | -------------------------------------------------------------------------------- /demo59/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /demo59/.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 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | -------------------------------------------------------------------------------- /demo59/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /demo59/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import LottieView from "lottie-react-native"; 3 | 4 | export default class BasicExample extends React.Component { 5 | render() { 6 | return ; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /demo59/__tests__/App-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: test renderer must be required after react-native. 10 | import renderer from 'react-test-renderer'; 11 | 12 | it('renders correctly', () => { 13 | renderer.create(); 14 | }); 15 | -------------------------------------------------------------------------------- /demo59/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.demo59", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.demo59", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /demo59/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // whether to bundle JS and assets in debug mode 22 | * bundleInDebug: false, 23 | * 24 | * // whether to bundle JS and assets in release mode 25 | * bundleInRelease: true, 26 | * 27 | * // whether to bundle JS and assets in another build variant (if configured). 28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 29 | * // The configuration property can be in the following formats 30 | * // 'bundleIn${productFlavor}${buildType}' 31 | * // 'bundleIn${buildType}' 32 | * // bundleInFreeDebug: true, 33 | * // bundleInPaidRelease: true, 34 | * // bundleInBeta: true, 35 | * 36 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 37 | * // for example: to disable dev mode in the staging build type (if configured) 38 | * devDisabledInStaging: true, 39 | * // The configuration property can be in the following formats 40 | * // 'devDisabledIn${productFlavor}${buildType}' 41 | * // 'devDisabledIn${buildType}' 42 | * 43 | * // the root of your project, i.e. where "package.json" lives 44 | * root: "../../", 45 | * 46 | * // where to put the JS bundle asset in debug mode 47 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 48 | * 49 | * // where to put the JS bundle asset in release mode 50 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 51 | * 52 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 53 | * // require('./image.png')), in debug mode 54 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 55 | * 56 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 57 | * // require('./image.png')), in release mode 58 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 59 | * 60 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 61 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 62 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 63 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 64 | * // for example, you might want to remove it from here. 65 | * inputExcludes: ["android/**", "ios/**"], 66 | * 67 | * // override which node gets called and with what additional arguments 68 | * nodeExecutableAndArgs: ["node"], 69 | * 70 | * // supply additional arguments to the packager 71 | * extraPackagerArgs: [] 72 | * ] 73 | */ 74 | 75 | project.ext.react = [ 76 | entryFile: "index.js" 77 | ] 78 | 79 | apply from: "../../node_modules/react-native/react.gradle" 80 | 81 | /** 82 | * Set this to true to create two separate APKs instead of one: 83 | * - An APK that only works on ARM devices 84 | * - An APK that only works on x86 devices 85 | * The advantage is the size of the APK is reduced by about 4MB. 86 | * Upload all the APKs to the Play Store and people will download 87 | * the correct one based on the CPU architecture of their device. 88 | */ 89 | def enableSeparateBuildPerCPUArchitecture = false 90 | 91 | /** 92 | * Run Proguard to shrink the Java bytecode in release builds. 93 | */ 94 | def enableProguardInReleaseBuilds = false 95 | 96 | android { 97 | compileSdkVersion rootProject.ext.compileSdkVersion 98 | 99 | compileOptions { 100 | sourceCompatibility JavaVersion.VERSION_1_8 101 | targetCompatibility JavaVersion.VERSION_1_8 102 | } 103 | 104 | defaultConfig { 105 | applicationId "com.demo59" 106 | minSdkVersion rootProject.ext.minSdkVersion 107 | targetSdkVersion rootProject.ext.targetSdkVersion 108 | versionCode 1 109 | versionName "1.0" 110 | } 111 | splits { 112 | abi { 113 | reset() 114 | enable enableSeparateBuildPerCPUArchitecture 115 | universalApk false // If true, also generate a universal APK 116 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 117 | } 118 | } 119 | buildTypes { 120 | release { 121 | minifyEnabled enableProguardInReleaseBuilds 122 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 123 | } 124 | } 125 | // applicationVariants are e.g. debug, release 126 | applicationVariants.all { variant -> 127 | variant.outputs.each { output -> 128 | // For each separate APK per architecture, set a unique version code as described here: 129 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 130 | def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4] 131 | def abi = output.getFilter(OutputFile.ABI) 132 | if (abi != null) { // null for the universal-debug, universal-release variants 133 | output.versionCodeOverride = 134 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 135 | } 136 | } 137 | } 138 | } 139 | 140 | dependencies { 141 | implementation fileTree(dir: "libs", include: ["*.jar"]) 142 | implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" 143 | implementation "com.facebook.react:react-native:+" // From node_modules 144 | } 145 | 146 | // Run this once to be able to run the application with BUCK 147 | // puts all compile dependencies into folder libs for BUCK to use 148 | task copyDownloadableDepsToLibs(type: Copy) { 149 | from configurations.compile 150 | into 'libs' 151 | } 152 | -------------------------------------------------------------------------------- /demo59/android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /demo59/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 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /demo59/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /demo59/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /demo59/android/app/src/main/java/com/demo59/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.demo59; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "demo59"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /demo59/android/app/src/main/java/com/demo59/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.demo59; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.facebook.react.ReactNativeHost; 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.shell.MainReactPackage; 9 | import com.facebook.soloader.SoLoader; 10 | 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | 16 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 17 | @Override 18 | public boolean getUseDeveloperSupport() { 19 | return BuildConfig.DEBUG; 20 | } 21 | 22 | @Override 23 | protected List getPackages() { 24 | return Arrays.asList( 25 | new MainReactPackage() 26 | ); 27 | } 28 | 29 | @Override 30 | protected String getJSMainModuleName() { 31 | return "index"; 32 | } 33 | }; 34 | 35 | @Override 36 | public ReactNativeHost getReactNativeHost() { 37 | return mReactNativeHost; 38 | } 39 | 40 | @Override 41 | public void onCreate() { 42 | super.onCreate(); 43 | SoLoader.init(this, /* native exopackage */ false); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /demo59/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo59/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo59/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo59/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo59/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo59/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo59/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo59/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo59/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo59/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo59/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo59/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo59/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo59/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo59/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo59/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo59/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo59/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo59/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo59/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo59/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | demo59 3 | 4 | -------------------------------------------------------------------------------- /demo59/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /demo59/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 28 8 | targetSdkVersion = 28 9 | supportLibVersion = "28.0.0" 10 | } 11 | repositories { 12 | google() 13 | jcenter() 14 | } 15 | dependencies { 16 | classpath("com.android.tools.build:gradle:3.4.0") 17 | 18 | // NOTE: Do not place your application dependencies here; they belong 19 | // in the individual module build.gradle files 20 | } 21 | } 22 | 23 | allprojects { 24 | repositories { 25 | mavenLocal() 26 | google() 27 | jcenter() 28 | maven { 29 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 30 | url "$rootDir/../node_modules/react-native/android" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /demo59/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | -------------------------------------------------------------------------------- /demo59/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alloy/adding-more-native-to-your-react-native-app/a8cadb30e0418709e2e1825edd1ae60542358c73/demo59/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /demo59/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /demo59/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin, switch paths to Windows format before running java 129 | if $cygwin ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /demo59/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 http://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /demo59/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /demo59/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /demo59/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'demo59' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /demo59/animation.json: -------------------------------------------------------------------------------- 1 | { 2 | "v": "4.6.3", 3 | "fr": 29.9700012207031, 4 | "ip": 0, 5 | "op": 141.000005743048, 6 | "w": 800, 7 | "h": 800, 8 | "nm": "Comp 1", 9 | "ddd": 0, 10 | "assets": [], 11 | "layers": [ 12 | { 13 | "ddd": 0, 14 | "ind": 1, 15 | "ty": 4, 16 | "nm": "center_circle", 17 | "ks": { 18 | "o": { "a": 0, "k": 100 }, 19 | "r": { "a": 0, "k": 0 }, 20 | "p": { "a": 0, "k": [401, 389, 0] }, 21 | "a": { "a": 0, "k": [-13.063, -22.86, 0] }, 22 | "s": { "a": 0, "k": [119.72, 119.72, 100] } 23 | }, 24 | "ao": 0, 25 | "shapes": [ 26 | { 27 | "ty": "gr", 28 | "it": [ 29 | { 30 | "d": 1, 31 | "ty": "el", 32 | "s": { "a": 0, "k": [77.344, 77.344] }, 33 | "p": { "a": 0, "k": [0, 0] }, 34 | "nm": "Ellipse Path 1", 35 | "mn": "ADBE Vector Shape - Ellipse" 36 | }, 37 | { 38 | "ty": "st", 39 | "c": { "a": 0, "k": [0.898039, 0.223529, 0.207843, 1] }, 40 | "o": { "a": 0, "k": 100 }, 41 | "w": { "a": 0, "k": 0 }, 42 | "lc": 1, 43 | "lj": 1, 44 | "ml": 4, 45 | "nm": "Stroke 1", 46 | "mn": "ADBE Vector Graphic - Stroke" 47 | }, 48 | { 49 | "ty": "fl", 50 | "c": { "a": 0, "k": [0.0196078, 0.6470588, 0.8196078, 1] }, 51 | "o": { "a": 0, "k": 100 }, 52 | "r": 1, 53 | "nm": "Fill 1", 54 | "mn": "ADBE Vector Graphic - Fill" 55 | }, 56 | { 57 | "ty": "tr", 58 | "p": { "a": 0, "k": [-14.328, -25.328], "ix": 2 }, 59 | "a": { "a": 0, "k": [0, 0], "ix": 1 }, 60 | "s": { 61 | "a": 1, 62 | "k": [ 63 | { 64 | "i": { "x": [0.667, 0.667], "y": [1, 1] }, 65 | "o": { "x": [0.333, 0.333], "y": [0, 0] }, 66 | "n": ["0p667_1_0p333_0", "0p667_1_0p333_0"], 67 | "t": 24, 68 | "s": [0, 0], 69 | "e": [160, 160] 70 | }, 71 | { 72 | "i": { "x": [0.667, 0.667], "y": [1, 1] }, 73 | "o": { "x": [0.333, 0.333], "y": [0, 0] }, 74 | "n": ["0p667_1_0p333_0", "0p667_1_0p333_0"], 75 | "t": 45, 76 | "s": [160, 160], 77 | "e": [70, 70] 78 | }, 79 | { 80 | "i": { "x": [0.667, 0.667], "y": [1, 1] }, 81 | "o": { "x": [0.333, 0.333], "y": [0, 0] }, 82 | "n": ["0p667_1_0p333_0", "0p667_1_0p333_0"], 83 | "t": 61, 84 | "s": [70, 70], 85 | "e": [130, 130] 86 | }, 87 | { 88 | "i": { "x": [0.667, 0.667], "y": [1, 1] }, 89 | "o": { "x": [0.333, 0.333], "y": [0, 0] }, 90 | "n": ["0p667_1_0p333_0", "0p667_1_0p333_0"], 91 | "t": 73, 92 | "s": [130, 130], 93 | "e": [80, 80] 94 | }, 95 | { 96 | "i": { "x": [0.667, 0.667], "y": [1, 1] }, 97 | "o": { "x": [0.333, 0.333], "y": [0, 0] }, 98 | "n": ["0p667_1_0p333_0", "0p667_1_0p333_0"], 99 | "t": 84, 100 | "s": [80, 80], 101 | "e": [110, 110] 102 | }, 103 | { 104 | "i": { "x": [0.667, 0.667], "y": [1, 1] }, 105 | "o": { "x": [0.333, 0.333], "y": [0, 0] }, 106 | "n": ["0p667_1_0p333_0", "0p667_1_0p333_0"], 107 | "t": 98, 108 | "s": [110, 110], 109 | "e": [100, 100] 110 | }, 111 | { "t": 116.000004724777 } 112 | ], 113 | "ix": 3 114 | }, 115 | "r": { "a": 0, "k": 0, "ix": 6 }, 116 | "o": { "a": 0, "k": 100, "ix": 7 }, 117 | "sk": { "a": 0, "k": 0, "ix": 4 }, 118 | "sa": { "a": 0, "k": 0, "ix": 5 }, 119 | "nm": "Transform" 120 | } 121 | ], 122 | "nm": "Ellipse 1", 123 | "np": 3, 124 | "cix": 2, 125 | "ix": 1, 126 | "mn": "ADBE Vector Group" 127 | } 128 | ], 129 | "ip": 0, 130 | "op": 900.000036657751, 131 | "st": 0, 132 | "bm": 0, 133 | "sr": 1 134 | }, 135 | { 136 | "ddd": 0, 137 | "ind": 2, 138 | "ty": 4, 139 | "nm": "circle3", 140 | "ks": { 141 | "o": { "a": 0, "k": 100 }, 142 | "r": { "a": 0, "k": -120.543 }, 143 | "p": { "a": 0, "k": [406, 375, 0] }, 144 | "a": { "a": 0, "k": [0, 0, 0] }, 145 | "s": { "a": 0, "k": [104.627, 108.478, 100] } 146 | }, 147 | "ao": 0, 148 | "shapes": [ 149 | { 150 | "ty": "gr", 151 | "it": [ 152 | { 153 | "d": 1, 154 | "ty": "el", 155 | "s": { "a": 0, "k": [497.445, 195.844] }, 156 | "p": { "a": 0, "k": [0, 0] }, 157 | "nm": "Ellipse Path 1", 158 | "mn": "ADBE Vector Shape - Ellipse" 159 | }, 160 | { 161 | "ty": "tm", 162 | "s": { 163 | "a": 1, 164 | "k": [ 165 | { 166 | "i": { "x": [0.833], "y": [1] }, 167 | "o": { "x": [0.333], "y": [0] }, 168 | "n": ["0p833_1_0p333_0"], 169 | "t": 64, 170 | "s": [100], 171 | "e": [0] 172 | }, 173 | { "t": 110.000004480392 } 174 | ], 175 | "ix": 1 176 | }, 177 | "e": { 178 | "a": 1, 179 | "k": [ 180 | { 181 | "i": { "x": [0.833], "y": [0.833] }, 182 | "o": { "x": [0.333], "y": [0.333] }, 183 | "n": ["0p833_0p833_0p333_0p333"], 184 | "t": 64, 185 | "s": [100], 186 | "e": [100] 187 | }, 188 | { "t": 110.000004480392 } 189 | ], 190 | "ix": 2 191 | }, 192 | "o": { 193 | "a": 1, 194 | "k": [ 195 | { 196 | "i": { "x": [0.69], "y": [3.268] }, 197 | "o": { "x": [0.294], "y": [0] }, 198 | "n": ["0p69_3p268_0p294_0"], 199 | "t": 64, 200 | "s": [1886.781], 201 | "e": [1765.781] 202 | }, 203 | { "t": 115.000004684046 } 204 | ], 205 | "ix": 3 206 | }, 207 | "m": 1, 208 | "ix": 2, 209 | "nm": "Trim Paths 1", 210 | "mn": "ADBE Vector Filter - Trim" 211 | }, 212 | { 213 | "ty": "st", 214 | "c": { "a": 0, "k": [0.0196078, 0.6470588, 0.8196078, 1] }, 215 | "o": { "a": 0, "k": 100 }, 216 | "w": { 217 | "a": 1, 218 | "k": [ 219 | { 220 | "i": { "x": [0.667], "y": [0.936] }, 221 | "o": { "x": [0.333], "y": [0] }, 222 | "n": ["0p667_0p936_0p333_0"], 223 | "t": 55, 224 | "s": [0], 225 | "e": [23.039] 226 | }, 227 | { 228 | "i": { "x": [0.667], "y": [1.13] }, 229 | "o": { "x": [0.333], "y": [-0.043] }, 230 | "n": ["0p667_1p13_0p333_-0p043"], 231 | "t": 74, 232 | "s": [23.039], 233 | "e": [3] 234 | }, 235 | { 236 | "i": { "x": [0.667], "y": [1] }, 237 | "o": { "x": [0.333], "y": [0.158] }, 238 | "n": ["0p667_1_0p333_0p158"], 239 | "t": 85, 240 | "s": [3], 241 | "e": [24] 242 | }, 243 | { "t": 99.0000040323527 } 244 | ] 245 | }, 246 | "lc": 2, 247 | "lj": 2, 248 | "nm": "Stroke 1", 249 | "mn": "ADBE Vector Graphic - Stroke" 250 | }, 251 | { 252 | "ty": "tr", 253 | "p": { "a": 0, "k": [-6.277, -10.078], "ix": 2 }, 254 | "a": { "a": 0, "k": [0, 0], "ix": 1 }, 255 | "s": { "a": 0, "k": [89.823, 86.077], "ix": 3 }, 256 | "r": { "a": 0, "k": 0, "ix": 6 }, 257 | "o": { "a": 0, "k": 100, "ix": 7 }, 258 | "sk": { "a": 0, "k": 0, "ix": 4 }, 259 | "sa": { "a": 0, "k": 0, "ix": 5 }, 260 | "nm": "Transform" 261 | } 262 | ], 263 | "nm": "Ellipse 1", 264 | "np": 3, 265 | "cix": 2, 266 | "ix": 1, 267 | "mn": "ADBE Vector Group" 268 | } 269 | ], 270 | "ip": 0, 271 | "op": 900.000036657751, 272 | "st": 0, 273 | "bm": 0, 274 | "sr": 1 275 | }, 276 | { 277 | "ddd": 0, 278 | "ind": 3, 279 | "ty": 4, 280 | "nm": "circle2", 281 | "ks": { 282 | "o": { "a": 0, "k": 100 }, 283 | "r": { "a": 0, "k": -59.94 }, 284 | "p": { "a": 0, "k": [413, 385, 0] }, 285 | "a": { "a": 0, "k": [0, 0, 0] }, 286 | "s": { "a": 0, "k": [104.627, 108.478, 100] } 287 | }, 288 | "ao": 0, 289 | "shapes": [ 290 | { 291 | "ty": "gr", 292 | "it": [ 293 | { 294 | "d": 1, 295 | "ty": "el", 296 | "s": { "a": 0, "k": [497.445, 195.844] }, 297 | "p": { "a": 0, "k": [0, 0] }, 298 | "nm": "Ellipse Path 1", 299 | "mn": "ADBE Vector Shape - Ellipse" 300 | }, 301 | { 302 | "ty": "tm", 303 | "s": { 304 | "a": 1, 305 | "k": [ 306 | { 307 | "i": { "x": [0.667], "y": [1] }, 308 | "o": { "x": [0.333], "y": [0] }, 309 | "n": ["0p667_1_0p333_0"], 310 | "t": 46, 311 | "s": [100], 312 | "e": [84.162] 313 | }, 314 | { 315 | "i": { "x": [0.833], "y": [1] }, 316 | "o": { "x": [0.333], "y": [-0.084] }, 317 | "n": ["0p833_1_0p333_-0p084"], 318 | "t": 73, 319 | "s": [84.162], 320 | "e": [100] 321 | }, 322 | { "t": 104.000004236007 } 323 | ], 324 | "ix": 1 325 | }, 326 | "e": { 327 | "a": 1, 328 | "k": [ 329 | { 330 | "i": { "x": [0.833], "y": [1] }, 331 | "o": { "x": [0.324], "y": [0] }, 332 | "n": ["0p833_1_0p324_0"], 333 | "t": 46, 334 | "s": [100], 335 | "e": [0] 336 | }, 337 | { "t": 104.000004236007 } 338 | ], 339 | "ix": 2 340 | }, 341 | "o": { 342 | "a": 1, 343 | "k": [ 344 | { 345 | "i": { "x": [0.667], "y": [0.953] }, 346 | "o": { "x": [0.327], "y": [0] }, 347 | "n": ["0p667_0p953_0p327_0"], 348 | "t": 46, 349 | "s": [50], 350 | "e": [2101.915] 351 | }, 352 | { "t": 105.000004276738 } 353 | ], 354 | "ix": 3 355 | }, 356 | "m": 1, 357 | "ix": 2, 358 | "nm": "Trim Paths 1", 359 | "mn": "ADBE Vector Filter - Trim" 360 | }, 361 | { 362 | "ty": "st", 363 | "c": { "a": 0, "k": [0.0196078, 0.6470588, 0.8196078, 1] }, 364 | "o": { "a": 0, "k": 100 }, 365 | "w": { 366 | "a": 1, 367 | "k": [ 368 | { 369 | "i": { "x": [0.667], "y": [0.91] }, 370 | "o": { "x": [0.333], "y": [0] }, 371 | "n": ["0p667_0p91_0p333_0"], 372 | "t": 60, 373 | "s": [0], 374 | "e": [13] 375 | }, 376 | { 377 | "i": { "x": [0.667], "y": [1.258] }, 378 | "o": { "x": [0.333], "y": [-0.085] }, 379 | "n": ["0p667_1p258_0p333_-0p085"], 380 | "t": 75, 381 | "s": [13], 382 | "e": [2] 383 | }, 384 | { 385 | "i": { "x": [0.667], "y": [1] }, 386 | "o": { "x": [0.333], "y": [0.183] }, 387 | "n": ["0p667_1_0p333_0p183"], 388 | "t": 87, 389 | "s": [2], 390 | "e": [24] 391 | }, 392 | { "t": 104.000004236007 } 393 | ] 394 | }, 395 | "lc": 2, 396 | "lj": 2, 397 | "nm": "Stroke 1", 398 | "mn": "ADBE Vector Graphic - Stroke" 399 | }, 400 | { 401 | "ty": "tr", 402 | "p": { "a": 0, "k": [-7.277, -10.078], "ix": 2 }, 403 | "a": { "a": 0, "k": [0, 0], "ix": 1 }, 404 | "s": { "a": 0, "k": [89.823, 86.077], "ix": 3 }, 405 | "r": { "a": 0, "k": 0, "ix": 6 }, 406 | "o": { "a": 0, "k": 100, "ix": 7 }, 407 | "sk": { "a": 0, "k": 0, "ix": 4 }, 408 | "sa": { "a": 0, "k": 0, "ix": 5 }, 409 | "nm": "Transform" 410 | } 411 | ], 412 | "nm": "Ellipse 1", 413 | "np": 3, 414 | "cix": 2, 415 | "ix": 1, 416 | "mn": "ADBE Vector Group" 417 | } 418 | ], 419 | "ip": 0, 420 | "op": 900.000036657751, 421 | "st": 0, 422 | "bm": 0, 423 | "sr": 1 424 | }, 425 | { 426 | "ddd": 0, 427 | "ind": 4, 428 | "ty": 4, 429 | "nm": "circle1", 430 | "ks": { 431 | "o": { "a": 0, "k": 100 }, 432 | "r": { "a": 0, "k": 0 }, 433 | "p": { "a": 0, "k": [407, 397, 0] }, 434 | "a": { "a": 0, "k": [0, 0, 0] }, 435 | "s": { "a": 0, "k": [104.627, 108.478, 100] } 436 | }, 437 | "ao": 0, 438 | "shapes": [ 439 | { 440 | "ty": "gr", 441 | "it": [ 442 | { 443 | "d": 1, 444 | "ty": "el", 445 | "s": { "a": 0, "k": [497.445, 195.844] }, 446 | "p": { "a": 0, "k": [0, 0] }, 447 | "nm": "Ellipse Path 1", 448 | "mn": "ADBE Vector Shape - Ellipse" 449 | }, 450 | { 451 | "ty": "tm", 452 | "s": { 453 | "a": 1, 454 | "k": [ 455 | { 456 | "i": { "x": [0.833], "y": [0.833] }, 457 | "o": { "x": [0.167], "y": [0.167] }, 458 | "n": ["0p833_0p833_0p167_0p167"], 459 | "t": 0, 460 | "s": [100], 461 | "e": [100] 462 | }, 463 | { 464 | "i": { "x": [0.667], "y": [1] }, 465 | "o": { "x": [0.333], "y": [0] }, 466 | "n": ["0p667_1_0p333_0"], 467 | "t": 53, 468 | "s": [100], 469 | "e": [55.162] 470 | }, 471 | { 472 | "i": { "x": [0.833], "y": [1] }, 473 | "o": { "x": [0.333], "y": [0.01] }, 474 | "n": ["0p833_1_0p333_0p01"], 475 | "t": 92, 476 | "s": [55.162], 477 | "e": [0] 478 | }, 479 | { "t": 105.000004276738 } 480 | ], 481 | "ix": 1 482 | }, 483 | "e": { 484 | "a": 1, 485 | "k": [ 486 | { 487 | "i": { "x": [0.833], "y": [0.833] }, 488 | "o": { "x": [0.167], "y": [0.167] }, 489 | "n": ["0p833_0p833_0p167_0p167"], 490 | "t": 0, 491 | "s": [100], 492 | "e": [100] 493 | }, 494 | { 495 | "i": { "x": [0.833], "y": [0.833] }, 496 | "o": { "x": [0.333], "y": [0.333] }, 497 | "n": ["0p833_0p833_0p333_0p333"], 498 | "t": 53, 499 | "s": [100], 500 | "e": [100] 501 | }, 502 | { "t": 103.000004195276 } 503 | ], 504 | "ix": 2 505 | }, 506 | "o": { 507 | "a": 1, 508 | "k": [ 509 | { 510 | "i": { "x": [0.833], "y": [1] }, 511 | "o": { "x": [0.167], "y": [0.167] }, 512 | "n": ["0p833_1_0p167_0p167"], 513 | "t": 0, 514 | "s": [100], 515 | "e": [50] 516 | }, 517 | { 518 | "i": { "x": [0.714], "y": [0.721] }, 519 | "o": { "x": [0.303], "y": [0] }, 520 | "n": ["0p714_0p721_0p303_0"], 521 | "t": 53, 522 | "s": [50], 523 | "e": [958.781] 524 | }, 525 | { "t": 104.000004236007 } 526 | ], 527 | "ix": 3 528 | }, 529 | "m": 1, 530 | "ix": 2, 531 | "nm": "Trim Paths 1", 532 | "mn": "ADBE Vector Filter - Trim" 533 | }, 534 | { 535 | "ty": "st", 536 | "c": { "a": 0, "k": [0.0196078, 0.6470588, 0.8196078, 1] }, 537 | "o": { "a": 0, "k": 100 }, 538 | "w": { 539 | "a": 1, 540 | "k": [ 541 | { 542 | "i": { "x": [0.667], "y": [0.908] }, 543 | "o": { "x": [0.333], "y": [0] }, 544 | "n": ["0p667_0p908_0p333_0"], 545 | "t": 52, 546 | "s": [0], 547 | "e": [16.039] 548 | }, 549 | { 550 | "i": { "x": [0.667], "y": [1.259] }, 551 | "o": { "x": [0.333], "y": [-0.085] }, 552 | "n": ["0p667_1p259_0p333_-0p085"], 553 | "t": 71, 554 | "s": [16.039], 555 | "e": [6] 556 | }, 557 | { 558 | "i": { "x": [0.667], "y": [1] }, 559 | "o": { "x": [0.333], "y": [0.184] }, 560 | "n": ["0p667_1_0p333_0p184"], 561 | "t": 82, 562 | "s": [6], 563 | "e": [24] 564 | }, 565 | { "t": 96.0000039101602 } 566 | ] 567 | }, 568 | "lc": 2, 569 | "lj": 2, 570 | "nm": "Stroke 1", 571 | "mn": "ADBE Vector Graphic - Stroke" 572 | }, 573 | { 574 | "ty": "tr", 575 | "p": { "a": 0, "k": [-7.277, -10.078], "ix": 2 }, 576 | "a": { "a": 0, "k": [0, 0], "ix": 1 }, 577 | "s": { "a": 0, "k": [89.823, 86.077], "ix": 3 }, 578 | "r": { "a": 0, "k": 0, "ix": 6 }, 579 | "o": { "a": 0, "k": 100, "ix": 7 }, 580 | "sk": { "a": 0, "k": 0, "ix": 4 }, 581 | "sa": { "a": 0, "k": 0, "ix": 5 }, 582 | "nm": "Transform" 583 | } 584 | ], 585 | "nm": "Ellipse 1", 586 | "np": 3, 587 | "cix": 2, 588 | "ix": 1, 589 | "mn": "ADBE Vector Group" 590 | } 591 | ], 592 | "ip": 0, 593 | "op": 900.000036657751, 594 | "st": 0, 595 | "bm": 0, 596 | "sr": 1 597 | } 598 | ] 599 | } 600 | -------------------------------------------------------------------------------- /demo59/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo59", 3 | "displayName": "demo59" 4 | } -------------------------------------------------------------------------------- /demo59/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /demo59/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /demo59/ios/demo59-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /demo59/ios/demo59-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 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 | -------------------------------------------------------------------------------- /demo59/ios/demo59.xcodeproj/xcshareddata/xcschemes/demo59-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /demo59/ios/demo59.xcodeproj/xcshareddata/xcschemes/demo59.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /demo59/ios/demo59/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /demo59/ios/demo59/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | #import 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 19 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 20 | moduleName:@"demo59" 21 | initialProperties:nil]; 22 | 23 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 24 | 25 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 26 | UIViewController *rootViewController = [UIViewController new]; 27 | rootViewController.view = rootView; 28 | self.window.rootViewController = rootViewController; 29 | [self.window makeKeyAndVisible]; 30 | return YES; 31 | } 32 | 33 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 34 | { 35 | #if DEBUG 36 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 37 | #else 38 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 39 | #endif 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /demo59/ios/demo59/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /demo59/ios/demo59/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /demo59/ios/demo59/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /demo59/ios/demo59/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | demo59 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSLocationWhenInUseUsageDescription 28 | 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UIViewControllerBasedStatusBarAppearance 42 | 43 | NSLocationWhenInUseUsageDescription 44 | 45 | NSAppTransportSecurity 46 | 47 | 48 | NSAllowsArbitraryLoads 49 | 50 | NSExceptionDomains 51 | 52 | localhost 53 | 54 | NSExceptionAllowsInsecureHTTPLoads 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /demo59/ios/demo59/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /demo59/ios/demo59Tests/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 | -------------------------------------------------------------------------------- /demo59/ios/demo59Tests/demo59Tests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | #import 12 | #import 13 | 14 | #define TIMEOUT_SECONDS 600 15 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 16 | 17 | @interface demo59Tests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation demo59Tests 22 | 23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 24 | { 25 | if (test(view)) { 26 | return YES; 27 | } 28 | for (UIView *subview in [view subviews]) { 29 | if ([self findSubviewInView:subview matching:test]) { 30 | return YES; 31 | } 32 | } 33 | return NO; 34 | } 35 | 36 | - (void)testRendersWelcomeScreen 37 | { 38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 40 | BOOL foundElement = NO; 41 | 42 | __block NSString *redboxError = nil; 43 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 44 | if (level >= RCTLogLevelError) { 45 | redboxError = message; 46 | } 47 | }); 48 | 49 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 50 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 51 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 52 | 53 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 54 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 55 | return YES; 56 | } 57 | return NO; 58 | }]; 59 | } 60 | 61 | RCTSetLogFunction(RCTDefaultLogFunction); 62 | 63 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 64 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 65 | } 66 | 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /demo59/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: false, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /demo59/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo59", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "react": "16.8.3", 11 | "react-native": "0.59.10" 12 | }, 13 | "devDependencies": { 14 | "@babel/core": "^7.6.4", 15 | "@babel/runtime": "^7.6.3", 16 | "babel-jest": "^24.9.0", 17 | "jest": "^24.9.0", 18 | "metro-react-native-babel-preset": "^0.56.3", 19 | "react-test-renderer": "16.8.3" 20 | }, 21 | "jest": { 22 | "preset": "react-native" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /presentation.md: -------------------------------------------------------------------------------- 1 | # [fit] Adding more native to 2 | 3 | # [fit] your React Native app 4 | 5 | --- 6 | 7 | ### Who are we? 8 | 9 | - Eloy Durán 10 | - @alloy 11 | - Author of CocoaPods 12 | - Director of Engineering at Artsy 13 | 14 | ^ Where we’ve been using React Native for 3.5 years in our brownfield app 15 | 16 | --- 17 | 18 | ### Who are we? 19 | 20 | - Bartol Karuza 21 | - @bartolkaruza 22 | - Engineering Manager at Chargetrip 23 | - React Native advocate and contributor 24 | 25 | --- 26 | 27 | ### What will you learn from this presentation? 28 | 29 | - What native package ‘linking’ is 30 | - How to use it for iOS and Android platforms 31 | 32 | --- 33 | 34 | ## [fit] What is it and what 35 | 36 | ## [fit] problems does it solve? 37 | 38 | ^ First, let’s talk about ‘linking’ _outside_ of the context of React Native. 39 | 40 | ^ Perhaps you may have thought it was related to `npm link` / `yarn link`; however, beyond both making dependencies whose source exists on a local file-system available to a project, these tools are meant to allow one to _work_ on those dependencies and take their name from ‘symbolic link’, the manner in which they are made available to an application. In case you were not thinking this–never mind me, let’s carry on. 41 | 42 | ^ Instead, the origins lie with tooling thats exist in native tool-chains, such as those used for languages like `C`, the term ‘linking’ refers to building up a working executable from various compiled modules–referred to as ‘object files’, that contain the compiled ‘object code’ corresponding to input source files. These can either be ‘statically’ linked, which basically just copies over the ‘object code’ into the executable; or they can be ‘dynamically’ linked, meaning the ‘object code’ is provided as a separate binary to the executable and loaded into memory at runtime. Why you would choose one over the other is beyond the scope of this presentation, but suffice it to say that for a native dependency’s code to be available to the application it needs to be linked in either of these manners. 43 | 44 | ^ ‘Linking’ in the context of React Native _refers_ to this process, but in reality only covers _configuring_ your project for the actual linker machinery to be able to do its work at build time. This is the part that the rest of this presentation is concerned about. 45 | 46 | --- 47 | 48 | ## [fit] How was this done 49 | 50 | ## [fit] historically (for iOS)? 51 | 52 | ^ Now that we understand what linking refers to in the context of React Native, let’s take a look at how this was done over the years in an iOS project. 53 | 54 | --- 55 | 56 | ### Manual 57 | 58 | https://facebook.github.io/react-native/docs/linking-libraries-ios#manual-linking 59 | 60 | ^ As taken from the React Native documentation, a native package is expected to come with a Xcode project that instructs Xcode how to build a static library out of the package’s native source. 61 | 62 | --- 63 | 64 | ### Manual 65 | 66 | 1. Add to project 67 | 68 | ^ The user adds a reference to the package’s Xcode project to their own (app) Xcode project; 69 | 70 | --- 71 | 72 | ### Manual 73 | 74 | 1. Add to project 75 | 2. Setup linkage 76 | 77 | ^ after which they are able to select the package’s static library from the list of libraries their application should link against; 78 | 79 | --- 80 | 81 | ### Manual 82 | 83 | 1. Add to project 84 | 2. Setup linkage 85 | 3. Build settings 86 | 87 | ^ and finally, where necessary, update build settings of the app Xcode project required by the dependency, such as including the correct C++ standard library. 88 | 89 | --- 90 | 91 | ### Manual 92 | 93 | 1. Add to project 94 | 2. Setup linkage 95 | 3. Build settings 96 | 4. Setup for native code 97 | 98 | ^ If, at runtime, you are only using the package through JavaScript then you are done now. If you also need to use the package’s code from your own native code, you will need to setup header search paths so you can include the package’s headers in your source files. 99 | 100 | --- 101 | 102 | ### Manual 103 | 104 | 1. Add project 105 | 2. Setup linkage 106 | 3. Configure build settings 107 | 4. Setup for use in native code 108 | 5. Repeat for transitive dependencies 109 | 110 | ^ If the package has any native dependencies of its own, you need to repeat the above steps for those dependencies. 111 | 112 | --- 113 | 114 | ### Automated 115 | 116 | `react-native link` 117 | 118 | ^ An automated version of the exact same approach has existed for a while now, through the `link` command of the `react-native` command-line tool, in that it will actually edit your Xcode project on-disk. One limitation with this approach was that the tool doesn’t know about **native** transitive dependencies, and as such in those cases you would still have to perform the manual approach for those dependencies. 119 | 120 | --- 121 | 122 | ### What problems exist with this approach? 123 | 124 | 1. Number of steps 125 | 126 | ^ In an ideal scenario, you would have to perform 2 steps to manually integrate a single native package, at worst including additional build settings and multiplied by the number of **native** transitive dependencies the native package has. Even in the automated case, the inconsistency in handling **native** transitive dependencies isn’t the greatest developer-experience. 127 | 128 | --- 129 | 130 | ### What problems exist with this approach? 131 | 132 | 1. Number of steps 133 | 2. Required knowledge 134 | 135 | ^ Needing to understand the build settings of Xcode and its underlying tooling. This isn’t necessarily a bad thing, things _can_ and _will_ break and it’s good to know how things work under the hood, but _having_ to do this each time even when on the happy path isn’t ideal. 136 | 137 | --- 138 | 139 | ### What problems exist with this approach? 140 | 141 | 1. Number of steps 142 | 2. Required knowledge 143 | 3. Maintenance burden 144 | 145 | ^ Other than bookkeeping, there’s no easy way to track which build settings originated from what dependency, which becomes a maintenance burden when you want to upgrade or remove dependencies. 146 | 147 | --- 148 | 149 | ## [fit] Alternative and the future 150 | 151 | ## [fit] of React Native linking 152 | 153 | ^ This is where relying on dependency managers comes in. Respective ecosystems already have dependency management solutions that are able to deal with all of the above, so in the spirit of standing on the shoulders of giants, let’s leverage those domain specific tools instead! 154 | 155 | ^ In the case of iOS, the popular option is [CocoaPods](https://cocoapods.org)–which given a manifest that describes a project’s dependencies, similarly to a `package.json` file, will perform all of the aforementioned work _and_ do so in a maintainable manner. For instance, it is able to resolve and install transitive dependencies like any other dependency, it encapsulates dependency specific build settings in `xcconfig` files, and does so with minimal _one-time_ changes to your app’s Xcode project. 156 | 157 | ^ Seeing as sooner or later most people will have to deal with linking native packages and the different ways in which you had to maintain your app’s Xcode project, the React Native maintainers decided to make utilizing CocoaPods the default since [version 0.60](https://facebook.github.io/react-native/blog/2019/07/03/version-60#cocoapods-by-default). (Gradle, for Android apps, was already the default.) 158 | 159 | ^ So, great–now there’s a single place where you manage your native dependencies! But given this standardization, we can take it one step further and automate the process. 🐢s all the way down! 160 | 161 | --- 162 | 163 | ### Auto-linking 164 | 165 | ^ Enter auto-linking, which is a new addition to the `react-native` command-line tool that discovers packages that have native requirements and offloads the responsibility of configuring the app project to the dependency manager for the respective platform. 166 | 167 | ^ For iOS, this means that adding a native package boils down to: 168 | 169 | --- 170 | 171 | ### Auto-linking 172 | 173 | 1. Install the package 174 | 1. Run `pod install` 175 | 1. There’s no step 3 176 | 177 | ^ What this does under the hood, is that the CocoaPods manifest, the `Podfile`, includes a React Native specific helper, which on `pod install` will ask the `react-native` command-line tool for a list of all the native packages and their corresponding `podspec` files–which are the files that describe to CocoaPods how to build the library. It then **dynamically** includes those dependencies in its set of dependencies to resolve, as if they were all explicitly specified in the manifest. 178 | 179 | --- 180 | 181 | ### Auto-linking 182 | 183 | ```ruby 184 | require_relative "../node_modules/@react-native-community/cli-platform-ios/native_modules" 185 | ``` 186 | 187 | ^ For instance, given a `Podfile` that includes the helper like so: 188 | 189 | --- 190 | 191 | ### Auto-linking 192 | 193 | ``` 194 | $ npx --quiet react-native config 195 | ``` 196 | 197 | ^ …and with `lottie-react-native` as an example, this is what the helper will invoke: 198 | 199 | --- 200 | 201 | ### Auto-linking 202 | 203 | ```json 204 | { 205 | "dependencies": { 206 | "lottie-react-native": { 207 | "root": "/path/to/project/node_modules/lottie-react-native", 208 | "name": "lottie-react-native", 209 | "platforms": { 210 | "ios": { 211 | "sourceDir": "/path/to/project/node_modules/lottie-react-native/src/ios", 212 | "folder": "/path/to/project/node_modules/lottie-react-native", 213 | "pbxprojPath": "/path/to/project/node_modules/lottie-react-native/src/ios/LottieReactNative.xcodeproj/project.pbxproj", 214 | "podfile": null, 215 | "podspecPath": "/path/to/project/node_modules/lottie-react-native/lottie-react-native.podspec", 216 | "projectPath": "/path/to/project/node_modules/lottie-react-native/src/ios/LottieReactNative.xcodeproj", 217 | "projectName": "LottieReactNative.xcodeproj", 218 | "libraryFolder": "Libraries", 219 | "sharedLibraries": [], 220 | "plist": [], 221 | "scriptPhases": [] 222 | }, 223 | "android": { 224 | "sourceDir": "/path/to/project/node_modules/lottie-react-native/src/android", 225 | "folder": "/path/to/project/node_modules/lottie-react-native", 226 | "packageImportPath": "import com.airbnb.android.react.lottie.LottiePackage;", 227 | "packageInstance": "new LottiePackage()" 228 | } 229 | }, 230 | "assets": [], 231 | "hooks": {}, 232 | "params": [] 233 | } 234 | } 235 | } 236 | ``` 237 | 238 | ^ …and this is [part of] what `react-native` reports back to CocoaPods: 239 | 240 | --- 241 | 242 | ### Auto-linking 243 | 244 | ```ruby 245 | Pod::Spec.new do |s| 246 | s.name = "lottie-react-native" 247 | s.source_files = "src/ios/**/*.{h,m,swift}" 248 | s.dependency "lottie-ios", "~> 3.1.3" 249 | end 250 | ``` 251 | 252 | ^ Given this, the helper will read the `podspec`: 253 | 254 | --- 255 | 256 | ### Auto-linking 257 | 258 | ```ruby 259 | pod "lottie-react-native", :path => "../node_modules/lottie-react-native" 260 | ``` 261 | 262 | ^ …and dynamically add the native dependency, as if it were specified like so: 263 | 264 | --- 265 | 266 | ### Auto-linking 267 | 268 | ``` 269 | $ pod install 270 | Detected React Native module pod for lottie-react-native 271 | Analyzing dependencies 272 | Downloading dependencies 273 | Installing lottie-ios (3.1.3) 274 | Installing lottie-react-native (3.2.1) 275 | ``` 276 | 277 | ^ This will in turn resolve the dependency, its transitive dependencies, and setup the Xcode projects accordingly: 278 | 279 | --- 280 | 281 | ## [fit] Demo time 282 | 283 | --- 284 | 285 | ## QA 286 | 287 | Eloy Durán / @alloy 288 | 289 | Bartol Karuza / @bartolkaruza 290 | 291 | https://github.com/alloy/adding-more-native-to-your-react-native-app 292 | --------------------------------------------------------------------------------