-
Notifications
You must be signed in to change notification settings - Fork 24.7k
refactor: migrated file LazyReactPackage to Kotlin #51085
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
base: main
Are you sure you want to change the base?
refactor: migrated file LazyReactPackage to Kotlin #51085
Conversation
Hi @Xintre! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
7c90936
to
e22458b
Compare
@mateoguzmana the PR is ready for review! |
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.
Thanks for migrating this! some small remarks.
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.kt
Show resolved
Hide resolved
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.kt
Outdated
Show resolved
Hide resolved
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.kt
Outdated
Show resolved
Hide resolved
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.kt
Outdated
Show resolved
Hide resolved
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.kt
Outdated
Show resolved
Hide resolved
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.kt
Outdated
Show resolved
Hide resolved
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.kt
Outdated
Show resolved
Hide resolved
fce91a0
to
468ecbb
Compare
468ecbb
to
84488e9
Compare
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.
Code looks generally good. Leaving some comments to make it better
val moduleSpec = nativeModules[position++] | ||
val name = moduleSpec.name | ||
|
||
return reactModuleInfoMap[name].let moduleHolder@{ reactModuleInfo -> |
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 moduleHolder@{
in the middle of the line is really weird to read.
Can you extract reactModuleInfoMap[name]
to a separate variable to simplify this?
override fun hasNext(): Boolean { | ||
return position < nativeModules.size | ||
} |
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.
override fun hasNext(): Boolean { | |
return position < nativeModules.size | |
} | |
override fun hasNext(): Boolean = position < nativeModules.size |
return emptyList() | ||
} | ||
|
||
val viewManagers: MutableList<ViewManager<*, *>> = ArrayList() |
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.
val viewManagers: MutableList<ViewManager<*, *>> = ArrayList() | |
val viewManagers: MutableList<ViewManager<*, *>> = mutableListOf() |
} | ||
|
||
val viewManagers: MutableList<ViewManager<*, *>> = ArrayList() | ||
for (moduleSpec in viewManagerModuleSpecs) { |
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.
We could use buildList
here instead
public fun getViewManagers(reactContext: ReactApplicationContext): List<ModuleSpec> { | ||
return emptyList() | ||
} |
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.
public fun getViewManagers(reactContext: ReactApplicationContext): List<ModuleSpec> { | |
return emptyList() | |
} | |
public fun getViewManagers(reactContext: ReactApplicationContext): List<ModuleSpec> = emptyList() |
Summary:
This PR migrates LazyReactPackage to Kotlin as requested in #50513.
Changelog:
[ANDROID] [CHANGED] - Migrate com.facebook.react.LazyReactPackage to Kotlin.
Test Plan:
BaseReactPackage
withLazyReactPackage
inRNTesterApplication.kt