-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Fix comment about adding packages in android template #41856
Conversation
@dmytrorykun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
packages/react-native/template/android/app/src/main/java/com/helloworld/MainApplication.kt
Outdated
Show resolved
Hide resolved
Base commit: 1727ffa |
…elloworld/MainApplication.kt Co-authored-by: Nicola Corti <corti.nico@gmail.com>
@cortinico Good idea, I tested that the code works |
@janicduplessis can we make it a bit nicer as: override fun getPackages(): List<ReactPackage> =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
} |
@cortinico There you go! |
packages/react-native/template/android/app/src/main/java/com/helloworld/MainApplication.kt
Outdated
Show resolved
Hide resolved
…elloworld/MainApplication.kt Co-authored-by: Nicola Corti <corti.nico@gmail.com>
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@cortinico merged this pull request in ac9b87c. |
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
I believe the getPackages Kotlin example is not valid Kotlin (it may have been ported from the react-native example comment - which now has a ticket to update the application of adding packages facebook/react-native#41856)
@@ -15,11 +15,11 @@ class MainApplication : Application(), ReactApplication { | |||
|
|||
override val reactNativeHost: ReactNativeHost = | |||
object : DefaultReactNativeHost(this) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mix usages of 4 space tab and 2 space tab bothering me a lot 😞
Can I make PR? ( asking cause this doesn't resolve or implement anything )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is autoformatted by ktfmt, so even if you send a PR that attempts to fix this, it will be reformatted back to how it is now
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#41856 Test Plan: Tested that uncommenting that code works Reviewed By: cipolleschi Differential Revision: D51987483 Pulled By: cortinico fbshipit-source-id: d0135b5b536960017ccc7b25f92c75b3bd863cd9
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: facebook/react-native@ac9b87c
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
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
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:
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
Test Plan:
Tested that uncommenting that code works