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

Implement template changes to enable native modules auto linking #24099

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions template/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import android.app.Application;

import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;

import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {
Expand All @@ -21,9 +21,10 @@ public boolean getUseDeveloperSupport() {

@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
List<ReactPackage> packages = new ArrayList<>((new PackageList(this)).getPackages());
// additional non auto-detected packages can be added here, e.g.:
// packages.add(new MyReactNativePackage());
return packages;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion template/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rootProject.name = 'HelloWorld'

apply from: file("../node_modules/@react-native-community/cli/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
3 changes: 3 additions & 0 deletions template/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli/native_modules'

target 'HelloWorld' do
# Pods for HelloWorld
Expand Down Expand Up @@ -32,6 +33,8 @@ target 'HelloWorld' do
inherit! :search_paths
# Pods for testing
end

use_native_modules!
end

target 'HelloWorld-tvOS' do
Expand Down