Repository navigation
feat(ios): make CoreSVG decoder opt-in - #606
Open
oleksandrzavarzin-callstack wants to merge 4 commits into
Open
oleksandrzavarzin-callstack wants to merge 4 commits into
oleksandrzavarzin-callstack wants to merge 4 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #565. It is a continuation of @thiagobrez's work from #566.
Summary
The private-CoreSVG decoder is now opt-in on Apple platforms. By default, no SVG source is compiled or linked, and the decoder is never registered with React Native's app-wide image loader.
With the flag set, the tab view decodes SVG icons itself:
How to opt in:
$RNBottomTabsEnableSVG = truein thePodfile, before React Native configures pods, thenpod install["react-native-bottom-tabs", { "enableSVG": true }]RN_BOTTOM_TABS_ENABLE_SVG=1in the environment when SwiftPM resolves packagesChanges on top of #566:
main.Package.swift.SvgDecoder.his removed fromios/include/module.modulemap.artifacts/issue-565/) are removed from the repository.TabViewProvider.swiftis split for SwiftLint. The SVG helpers moved toios/SVGIconLoader.swift.Results
Tested with Xcode 27.0 on an iPhone simulator with iOS 26.5.
main): every iOS app links the CoreSVG code.CoreSVGWrapperand the base64 symbol names are in the binary.CoreSVGWrapper,SvgDecoder,CGSVGDocument,RNBottomTabsDecodeSVGData, or the base64 literals are in the app binary.RCTTabViewComponentViewis present as a control. The Pods project has 0ios/SVGfiles, andimageDataDecoderClassNamesis empty. On the simulator, SF Symbol and PNG icons render, and SVG tabs show their titles with no icon._RNBottomTabsDecodeSVGData,CoreSVGWrapper, and the base64 literals are present. CocoaPods adds exactlyCoreSVG.{h,mm}andSvgDecoder.{h,mm}. Local and remote SVG tab icons render on the simulator.expo prebuild --platform iosruns: without the option there is no flag. WithenableSVG: true, there is one generated block right afterplatform :ios. Removing the option removes the block.swift package dump-packagewithout the variable has noBottomTabsSVGtarget. WithRN_BOTTOM_TABS_ENABLE_SVG=1, it adds the target and the Swift define.yarn lint: 0 errors.yarn test: passes. It includes the newsvg_configuration_test.rbwith 3 runs and 7 assertions.yarn typecheck: passes.main.Before Merging
This is a breaking default, so it ships as a major changeset. After a release, apps that update depend on the new default.
Blast Radius: iOS SVG users
<Image>with an SVG source lose that as well. The decoder was app-wide before. It now serves only tab icons, even with the flag.RN_BOTTOM_TABS_ENABLE_SVGonly from its own environment. If Xcode was started from the Dock, a variable set in a shell does not reach it.