Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Research and implement Branch as an optional module on Android #5132

Closed
tsapeta opened this issue Jul 31, 2019 · 1 comment · Fixed by #5165
Closed

Research and implement Branch as an optional module on Android #5132

tsapeta opened this issue Jul 31, 2019 · 1 comment · Fixed by #5165
Assignees
Labels
Projects
Milestone

Comments

@tsapeta
Copy link
Member

tsapeta commented Jul 31, 2019

Recently we've removed Branch from Android (more details in the blog post) but we'd like to provide a way to include this module if someone wants to do a build with it, maybe as a --include-branch flag to expo build:android command.
Pull request removing Branch code for reference: #4058

@tsapeta tsapeta added the Branch label Jul 31, 2019
@tsapeta tsapeta added this to the SDK 35 milestone Jul 31, 2019
@tsapeta tsapeta added this to To do in SDK 35 via automation Jul 31, 2019
@expo expo locked and limited conversation to collaborators Jul 31, 2019
@sjchmiela sjchmiela self-assigned this Aug 1, 2019
@wkozyra95
Copy link
Contributor

added turtle support here expo/turtle@7a80d92

Unimodule expo-branch will be added if there is a dependency in package.json with the same name

@sjchmiela sjchmiela moved this from To do to In progress in SDK 35 Aug 2, 2019
@sjchmiela sjchmiela moved this from In progress to Review in progress in SDK 35 Aug 5, 2019
SDK 35 automation moved this from Review in progress to Done Aug 6, 2019
sjchmiela added a commit that referenced this issue Aug 6, 2019
# Why

We would like to provide a way to users to optionally include `react-native-branch` in their standalone apps. Fixes #5132.

# How

I added support for React Native-specific unimodules to React Native adapter. Right now it works like this:

- unimodule `expo-branch` depends on `react-native`, so it can use its API. It's no longer a uni-platform module, more an optinmodule (I guess the name won't stick)
- we copy `react-native-branch` vendored module directly to the unimodule. It will compile, since we added necessary dependencies to the unimodule
- `BranchPackage < org.unimodules.Package` implements `ReactPackage` interface too, forwarding all the calls to the vendored `RNBranchPackage`.
- when the module registry provider creates a module registry from a list of `Packages`, it can filter out `ReactPackages` — and so it does, putting them into a local internal module (`ReactPackagesProvider`) which only purpose is to carry those to `ModuleRegistryAdapter` which is responsible for creating a list of React Native modules out of a module registry. The adapter grabs the `ReactPackagesProvider` and adds React Native modules to the list.

# Test Plan

I have confirmed that adding `BranchPackage` to a list of installed unimodules' packages creates `RNBranchModule` and exports to JS.
sjchmiela added a commit that referenced this issue Aug 6, 2019
We would like to provide a way to users to optionally include `react-native-branch` in their standalone apps. Fixes #5132.

I added support for React Native-specific unimodules to React Native adapter. Right now it works like this:

- unimodule `expo-branch` depends on `react-native`, so it can use its API. It's no longer a uni-platform module, more an optinmodule (I guess the name won't stick)
- we copy `react-native-branch` vendored module directly to the unimodule. It will compile, since we added necessary dependencies to the unimodule
- `BranchPackage < org.unimodules.Package` implements `ReactPackage` interface too, forwarding all the calls to the vendored `RNBranchPackage`.
- when the module registry provider creates a module registry from a list of `Packages`, it can filter out `ReactPackages` — and so it does, putting them into a local internal module (`ReactPackagesProvider`) which only purpose is to carry those to `ModuleRegistryAdapter` which is responsible for creating a list of React Native modules out of a module registry. The adapter grabs the `ReactPackagesProvider` and adds React Native modules to the list.

I have confirmed that adding `BranchPackage` to a list of installed unimodules' packages creates `RNBranchModule` and exports to JS.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
No open projects
SDK 35
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants