Skip to content

Commit ac9b87c

Browse files
janicduplessisfacebook-github-bot
authored andcommitted
Fix comment about adding packages in android template (#41856)
Summary: I noticed this comment is still in Java in the Kotlin template. It also doesn't really work anymore since there is no packages variable. To fix it I completed the comment with all code needed for it to work in kotlin. I think an older version of the template used to be more like: ```kotlin val packages = PackageList(this).packages // packages.add(MyReactNativePackage()) return packages ``` But then it requires adding a lint suppress annotation since packages variable can be simplified. I think this is simpler even if it makes the comment a few more lines. ## Changelog: [GENERAL] [FIXED] - Fix comment about adding packages in android template Pull Request resolved: #41856 Test Plan: Tested that uncommenting that code works Reviewed By: cipolleschi Differential Revision: D51987483 Pulled By: cortinico fbshipit-source-id: d0135b5b536960017ccc7b25f92c75b3bd863cd9
1 parent ffe219c commit ac9b87c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/react-native/template/android/app/src/main/java/com/helloworld/MainApplication.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ class MainApplication : Application(), ReactApplication {
1515

1616
override val reactNativeHost: ReactNativeHost =
1717
object : DefaultReactNativeHost(this) {
18-
override fun getPackages(): List<ReactPackage> {
19-
// Packages that cannot be autolinked yet can be added manually here, for example:
20-
// packages.add(new MyReactNativePackage());
21-
return PackageList(this).packages
22-
}
18+
override fun getPackages(): List<ReactPackage> =
19+
PackageList(this).packages.apply {
20+
// Packages that cannot be autolinked yet can be added manually here, for example:
21+
// add(MyReactNativePackage())
22+
}
2323

2424
override fun getJSMainModuleName(): String = "index"
2525

0 commit comments

Comments
 (0)