Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move react-native-unimodules to the monorepo (#8537)
- Loading branch information
Showing
18 changed files
with
737 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule react-native-unimodules
deleted from
68313e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// @generated by expo-module-scripts | ||
module.exports = require('expo-module-scripts/eslintrc.base.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# @generated by expo-module-scripts | ||
babel.config.js | ||
__tests__ | ||
__mocks__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Changelog | ||
|
||
## 0.10.0 | ||
|
||
### 📚 Library updates | ||
|
||
- Updated dependencies to match versions included in Expo SDK38. | ||
|
||
## 0.9.0 | ||
|
||
### 📚 Library updates | ||
|
||
- Updated `@unimodules/react-native-adapter` to version `5.2.0`. | ||
|
||
## 0.8.1 | ||
|
||
### 🎉 New features | ||
|
||
- Added `unimodules-app-loader` to dependencies. | ||
|
||
## 0.8.0 | ||
|
||
### 🛠 Breaking changes | ||
|
||
- Updated core packages, please refer to [their changelogs](https://github.com/expo/expo/blob/master/CHANGELOG.md) to see the diff. | ||
- Removed `expo-app-loader-provider` from dependencies. | ||
|
||
### 🎉 New features | ||
|
||
- Added `expo-image-loader` to dependencies. | ||
|
||
### 🐛 Bug fixes | ||
|
||
- Fix `pod install --deployment` failing due to pathname object being used instead of a string. ([#96](https://github.com/unimodules/react-native-unimodules/pull/96) by [@tsapeta](https://github.com/tsapeta)) | ||
|
||
## 0.7.0 | ||
|
||
### 📚 Library updates | ||
|
||
- Updated `@unimodules/react-native-adapter` to version `5.0.0`. | ||
|
||
### 🛠 Breaking changes | ||
|
||
- Updated core packages, please refer to [their changelogs](https://github.com/expo/expo/blob/master/CHANGELOG.md) to see the diff. | ||
|
||
### 🎉 New features | ||
|
||
- Allow passing custom pod flags to the unimodules. | ||
|
||
## 0.6.0 | ||
|
||
### 🛠 Breaking changes | ||
|
||
- Updated core packages, please refer to [their changelogs](https://github.com/expo/expo/blob/master/CHANGELOG.md) to see the diff. | ||
|
||
## 0.5.3 | ||
|
||
## 0.5.2 | ||
|
||
### 🐛 Bug fixes | ||
|
||
- Updated `@unimodules/core` to version `3.0.2` including proper ProGuard rules. | ||
|
||
## 0.5.0 | ||
|
||
### 🛠 Breaking changes | ||
|
||
- Updated core packages, please refer to [their changelogs](https://github.com/expo/expo/blob/master/CHANGELOG.md) to see the diff | ||
|
||
## 0.4.2 | ||
|
||
### 🐛 Bug fixes | ||
|
||
- Fixed MainApplication.kt not being recognized correctly. ([#46](https://github.com/unimodules/react-native-unimodules/pull/46) by [@geovannimp](https://github.com/geovannimp)) | ||
|
||
## 0.4.1 | ||
|
||
### 🐛 Bug fixes | ||
|
||
- Added support for Kotlin ([#39](https://github.com/unimodules/react-native-unimodules/pull/39) by [@bbarthec](https://github.com/bbarthec)) | ||
|
||
## 0.4.0 | ||
|
||
### 🛠 Breaking changes | ||
|
||
- Updated core packages, please refer to [their changelogs](https://github.com/expo/expo/blob/master/CHANGELOG.md) to see the diff | ||
|
||
### 🐛 Bug fixes | ||
|
||
- Support version tags when adding dependencies for unimodules | ||
|
||
## 0.3.1 | ||
|
||
### 🐛 Bug fixes | ||
|
||
- Fixed TypeScript definitions of common unimodules not being exported. Thanks [@saadq](https://github.com/saadq)! ([#24](https://github.com/unimodules/react-native-unimodules/pull/24)) | ||
- Fixed automatic installation script not finding unimodules when using CocoaPods' `--project-directory` flag. ([#31](https://github.com/unimodules/react-native-unimodules/pull/31)) | ||
|
||
## 0.3.0 | ||
|
||
### 🎉 New features | ||
|
||
- Automatically generated list of Android packages ([#28](https://github.com/unimodules/react-native-unimodules/pull/28)) | ||
As of this version, you no longer need to add new packages to your `MainApplication.java` file. Just use `new BasePackageList().getPackageList()` instead 🎉. `BasePackageList` is auto-generated with a list of installed unimodules found in your `node_modules` folder during Gradle's Sync operation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019-present 650 Industries, Inc. (aka Expo) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# react-native-unimodules | ||
|
||
This library contains the core unimodule infrastructure and a collection of unimodules and interfaces that are commonly depended on by other unimodules. You only need to install `react-native-unimodules` once and then you will be able to use [most of the packages from the Expo SDK](https://docs.expo.io/versions/latest/bare/unimodules-full-list/), like [expo-camera](https://docs.expo.io/versions/latest/sdk/camera/), [expo-media-library](https://docs.expo.io/versions/latest/sdk/media-library/) and many more, [in any React Native project](https://blog.expo.io/you-can-now-use-expo-apis-in-any-react-native-app-7c3a93041331). | ||
|
||
The easiest way to use the library is to initialize a project with it already installed: `npx create-react-native-app my-app`. | ||
|
||
> You can also use `expo-cli` to do this - run `npm i -g expo-cli` and then `expo init --template bare-minimum` or `expo init --template expo-template-bare-typescript` if you prefer TypeScript. | ||
If you have an existing project you'd like to install it into, please read the following instructions. | ||
|
||
## 📦 Installation | ||
|
||
**This project requires that you use CocoaPods on iOS**, to set it up see [this gist](https://gist.github.com/brentvatne/b0ea11a36dc423e441b7d36e36eb5a26), or relevant parts of the [this guide](https://facebook.github.io/react-native/docs/integration-with-existing-apps#3-install-cocoapods). React Native >= 0.60 ships with CocoaPods support by default, so this should be easy if you're already on that version. | ||
|
||
```bash | ||
npm install react-native-unimodules | ||
``` | ||
|
||
Now you need to configure the library for iOS and/or Android. | ||
|
||
## 🍎 Configure iOS | ||
|
||
- Open `ios/Podfile` in your editor and make it look [like this one on react-native <= 0.59](https://gist.github.com/sjchmiela/6c079f2173938a9a61a7c6f053c45000) or [like this one on react-native >= 0.60](https://gist.github.com/brentvatne/d093e440698404803bd9c29d962949b0/revisions#diff-4a25b996826623c4a3a4910f47f10c30). | ||
- Run `npx pod-install` again | ||
- Update your `AppDelegate.h` and `AppDelegate.m` according to [to look like these](https://gist.github.com/brentvatne/1ece8c32a3c5c9d0ac3a470460c65603). | ||
- If you use [`react-native-navigation`](https://github.com/wix/react-native-navigation), you will need to use its `bridgeManagerDelegate` option [like in this gist](https://gist.github.com/brentvatne/67909ec442121de22c9b81c629a99aa6). | ||
|
||
### Advanced configuration | ||
|
||
<details><summary>Need to customize node_modules path?</summary> | ||
<p> | ||
|
||
If you need to customize the path to node_modules, for example because you are using yarn workspaces, then you can pass in a param for this: `use_unimodules!(modules_paths: ['./path/to/node_modules'])` | ||
|
||
</p> | ||
</details> | ||
|
||
<details><summary>Need to exclude some unimodules that are being automatically linked?</summary> | ||
<p> | ||
|
||
If you need to exclude some of the unimodules that you are not using but they got installed by your other dependencies (like `expo`), then you can pass in `exclude` param for this. For example, if you want to exclude `expo-face-detector`, you may want to use this: `use_unimodules!(exclude: ['expo-face-detector'])` | ||
|
||
</p> | ||
</details> | ||
|
||
## 🤖 Configure Android | ||
|
||
**In `android/settings.gradle`** | ||
|
||
1. At the top add `apply from: '../node_modules/react-native-unimodules/gradle.groovy'` | ||
1. Then call `includeUnimodulesProjects()` on the next line. | ||
|
||
**In `android/app/build.gradle`** | ||
|
||
1. Add `apply from: '../../node_modules/react-native-unimodules/gradle.groovy'` anywhere before the `dependencies {}` block. | ||
1. Add `addUnimodulesDependencies()` inside `dependencies {}` block. | ||
1. We recommend you use Java 1.8, you can set this [like this](https://github.com/expo/expo/commit/e175f870418fc69e8c129168118264439d73d7cc). | ||
|
||
**In `android/build.gradle`** | ||
|
||
1. Update `minSdkVersion` to `21`. | ||
|
||
**In `MainApplication.java`** | ||
Make the changes outlined in the diff that correspondes to your react-native version. | ||
|
||
- [this diff for react-native <= 0.59](https://gist.github.com/mczernek/0670ec16ca6071796853a66d589b49a5/revisions#diff-a2e7ff8a82f1c4be06f8b8163f2afefa) | ||
- [this diff for react-native >= 0.60](https://gist.github.com/mczernek/9de9e184abc430e9e3508d26738c8a14/revisions#diff-a2e7ff8a82f1c4be06f8b8163f2afefa) | ||
|
||
### Advanced configuration | ||
|
||
<details><summary>Need to customize node_modules path?</summary> | ||
<p> | ||
|
||
If you need to customize the path to node_modules, for example because you are using yarn workspaces, then you can pass in a param `modulesPaths` for both of these functions: `includeUnimodulesProjects([modulesPaths: ['./path/to/node_modules']])`, `addUnimodulesDependencies([modulesPaths: ['./path/to/node_modules']])` | ||
|
||
</p> | ||
</details> | ||
|
||
<details><summary>Need to exclude some unimodules that are being automatically linked?</summary> | ||
<p> | ||
|
||
If you need to exclude some of the unimodules that you are not using but they got installed by your other dependencies (like `expo`), then you can pass in `exclude` param for this. For example, if you want to exclude `expo-face-detector`, you may want to use this: `addUnimodulesDependencies([exclude: ['expo-face-detector']])` | ||
|
||
</p> | ||
</details> | ||
|
||
<details><summary>Need to customize configuration of unimodule dependencies?</summary> | ||
<p> | ||
|
||
You can also customize the configuration of the unimodules dependencies (the default is `implementation`, if you're using Gradle older than 3.0, you will need to set `configuration: "compile"` in `addUnimodulesDependencies`, like: `addUnimodulesDependencies([configuration: "compile"])`) | ||
|
||
</p> | ||
</details> | ||
|
||
# API | ||
|
||
It's possible that you will not have to use any of the code provided by this package directly, it may be used only by other Unimodules that you install. | ||
|
||
But it's likely that you will want to use something like FileSystem or Permissions, and to do that you can import the following modules like so: | ||
|
||
```js | ||
import { Asset, Constants, FileSystem, Permissions } from 'react-native-unimodules'; | ||
``` | ||
|
||
You can import them directly from the specific Unimodule package if you like, but your linter may complain about importing a transitive dependency. | ||
|
||
```js | ||
import * as Permissions from 'expo-permissions'; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// @generated by expo-module-scripts | ||
module.exports = require('expo-module-scripts/babel.config.base'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.