-
-
Notifications
You must be signed in to change notification settings - Fork 576
feat: add codegen ios.componentProvider
to package.json
#2567
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
Conversation
Why don't we just use I'm thinking right now - it is possible that these fields in |
I'm not sure if #ifdef RCT_NEW_ARCH_ENABLED
Class<RCTComponentViewProtocol> RNSModalScreenCls(void)
{
return RNSModalScreen.class;
}
#endif |
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.
Okay, this looks solid then. I've glanced at the docs & see that there should be no backward compat issue.
## Description #2567 introduced `ios.componentProvider` field to package definition - and that's fine, but we're pointing to wrong names there. ## Changes Updated the names to existing symbol names. ## Test code and steps to reproduce This caused runtime errors when running the app on 0.77. I need this commit for the #2581 (0.77 support) ## Checklist - [ ] Included code example that can be used to test this change - [ ] Updated TS types - [ ] Updated documentation: <!-- For adding new props to native-stack --> - [ ] https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx - [ ] Ensured that CI passes
## Description Add a newly introduced field `ios.componentProvider` to the `codegen` configuration to create an association map between JS components and their native implementations. See more information here: software-mansion/react-native-svg#2572 ## Changes - added `codegenConfig.ios.componentProvider` field to package.json ### Before ```objc Class<RCTComponentViewProtocol> RCTThirdPartyFabricComponentsProvider(const char *name) { static std::unordered_map<std::string, Class (*)(void)> sFabricComponentsClassMap = { // ... {"RNSFullWindowOverlay", RNSFullWindowOverlayCls}, // 3 {"RNSModalScreen", RNSModalScreenCls}, // 3 {"RNSScreenContainer", RNSScreenContainerCls}, // 3 {"RNSScreenContentWrapper", RNSScreenContentWrapperCls}, // 3 {"RNSScreenFooter", RNSScreenFooterCls}, // 3 {"RNSScreen", RNSScreenCls}, // 3 {"RNSScreenNavigationContainer", RNSScreenNavigationContainerCls}, // 3 {"RNSScreenStackHeaderConfig", RNSScreenStackHeaderConfigCls}, // 3 {"RNSScreenStackHeaderSubview", RNSScreenStackHeaderSubviewCls}, // 3 {"RNSScreenStack", RNSScreenStackCls}, // 3 {"RNSSearchBar", RNSSearchBarCls}, // 3 // ... ``` ### After ```objc @implementation RCTThirdPartyComponentsProvider + (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents { return @{ @"RNSFullWindowOverlay": NSClassFromString(@"RNSFullWindowOverlay"), // react-native-screens @"RNSModalScreen": NSClassFromString(@"RNSModalScreen"), // react-native-screens @"RNSScreenContainer": NSClassFromString(@"RNSScreenContainer"), // react-native-screens @"RNSScreenContentWrapper": NSClassFromString(@"RNSScreenContentWrapper"), // react-native-screens @"RNSScreenFooter": NSClassFromString(@"RNSScreenFooter"), // react-native-screens @"RNSScreen": NSClassFromString(@"RNSScreen"), // react-native-screens @"RNSScreenNavigationContainer": NSClassFromString(@"RNSScreenNavigationContainer"), // react-native-screens @"RNSScreenStackHeaderConfig": NSClassFromString(@"RNSScreenStackHeaderConfig"), // react-native-screens @"RNSScreenStackHeaderSubview": NSClassFromString(@"RNSScreenStackHeaderSubview"), // react-native-screens @"RNSScreenStack": NSClassFromString(@"RNSScreenStack"), // react-native-screens @"RNSSearchBar": NSClassFromString(@"RNSSearchBar"), // react-native-screens }; } ``` ## Test code and steps to reproduce Run `pod install` in React Native 0.77 app and see `RCTThirdPartyFabricComponentsProvider` to check the content
## Description #2567 introduced `ios.componentProvider` field to package definition - and that's fine, but we're pointing to wrong names there. ## Changes Updated the names to existing symbol names. ## Test code and steps to reproduce This caused runtime errors when running the app on 0.77. I need this commit for the #2581 (0.77 support) ## Checklist - [ ] Included code example that can be used to test this change - [ ] Updated TS types - [ ] Updated documentation: <!-- For adding new props to native-stack --> - [ ] https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx - [ ] Ensured that CI passes
## Description Adding support for `[email protected]`. **RN version of the library still left at `0.72.4`.** ## Changes - adjusted example apps on both architectures with changes from upgrade helper, - added codegen `ios.componentProvider` - #2567 - #2583 - removed providers that are not present in this version (RNSScreenFooter, RNSScreenContentWrapper) (ef2c7a4) - bumped dependencies: - `react-native-gesture-handler` to `2.22.0` - `react-native-reanimated` to `3.16.7` - `react-native-safe-area-context` to `5.1.0` - removed patches that were no longer needed - updated view manager interfaces (f968e05) - in order for this to work, **commented out codegen script** from Example/android/app/build.gradle (bf30abf), as it was overwriting correct fix -> **needs to be investigated** - fixed build issues on iOS (0f53ad1) - #2497 - adjusted to 3.x (removed unnecessary files, imports) - changed Metro config for FabricExample (ef2c7a4) ## Test code and steps to reproduce CI ## Checklist - [ ] Ensured that CI passes --------- Co-authored-by: Jakub Grzywacz <[email protected]> Co-authored-by: Kacper Kafara <[email protected]>
Description
Add a newly introduced field
ios.componentProvider
to thecodegen
configuration to create an association map between JS components and their native implementations.See more information here: software-mansion/react-native-svg#2572
Changes
codegenConfig.ios.componentProvider
field to package.jsonBefore
After
Test code and steps to reproduce
Run
pod install
in React Native 0.77 app and seeRCTThirdPartyFabricComponentsProvider
to check the content