Skip to content

Commit

Permalink
Fix comment about adding packages in android template (#41856)
Browse files Browse the repository at this point in the history
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: facebook/react-native#41856

Test Plan: Tested that uncommenting that code works

Reviewed By: cipolleschi

Differential Revision: D51987483

Pulled By: cortinico

fbshipit-source-id: d0135b5b536960017ccc7b25f92c75b3bd863cd9

Original-Commit: facebook/react-native@ac9b87c
  • Loading branch information
janicduplessis authored and facebook-github-bot committed Dec 27, 2023
1 parent 397c068 commit 8b057ef
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class MainApplication : Application(), ReactApplication {

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

override fun getJSMainModuleName(): String = "index"

Expand Down

0 comments on commit 8b057ef

Please sign in to comment.