feat(ios): make CoreSVG decoder opt-in - #566
Draft
thiagobrez wants to merge 1 commit into
Draft
Conversation
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.
Summary
Apple-platform SVG tab icons are now disabled by default. The podspec excludes
ios/SVG/**/*, and the SVG decoder is no longer registered app-wide as anRCTImageDataDecoderor generated as a TurboModule. Apps that only use SF Symbols, PNGs, JPEGs, or other ordinary image icons therefore do not compile or link the private-CoreSVG implementation.Apps that need SVG tab icons can explicitly opt in before React Native configures pods:
Expo prebuild apps can use:
The opt-in decoder is scoped to bottom-tab icons. Local, remote, and extensionless SVG sources are supported without registering the decoder with React Native's global image pipeline. Android SVG support remains enabled and unchanged.
Design
A Podfile flag is used instead of a subspec because React Native autolinking does not select an optional subspec, CocoaPods includes subspecs by default unless a different default is declared, and—most importantly—a subspec cannot conditionally alter the static
package.jsoncodegen registration. Removing that registration and invoking the optional decoder only insideTabViewProvidergives both configurations a coherent result:RN_BOTTOM_TABS_ENABLE_SVGObjective-C++/Swift conditions, with local and remote SVG tab icons working;imageDataDecoderClassNamesarray, so the decoder never becomes app-wide.This is a breaking default for existing Apple SVG users, so the PR includes a major changeset. Existing users can preserve behavior by adding the Podfile flag (or Expo plugin option), running
pod install, and rebuilding. Documentation and the package README call this out explicitly.Compatibility and package inspection
CoreSVG.{h,mm}andSvgDecoder.{h,mm}. All podspec lints had zero errors (older helpers retain one unrelated existing-Wnowarning).npm pack --dry-runconfirms the configuration helper and optional SVG implementation are present in the published package, whileNativeSVGDecoderis absent.RCTTabViewComponentViewpresent as a positive control;CoreSVGWrapper,SvgDecoder,CGSVGDocument,_imageWithCGSVGDocument, and all CoreSVG base64 symbol literals absent from the app, app dylib, and pod static library.RNBottomTabsDecodeSVGData,CoreSVGWrapper,CGSVGDocument, and the encoded CoreSVG symbol strings present as expected.imageDataDecoderClassNames; noSvgDecoderorCoreSVGWrapperreferences.Validation
ruby packages/react-native-bottom-tabs/ios/__tests__/svg_configuration_test.rb— 3 tests, 7 assertionsyarn lint— passes with three pre-existing warningsyarn typecheckyarn buildyarn build:iosyarn build:android— complete Android native bundle buildpod installxcodebuildsimulator buildsyarn teststill stops in the unchanged@bottom-tabs/react-navigationworkspace because it has ajestscript but no tests; this is also true onmain. The new focused Ruby tests pass independently.Device verification
Verified with
agent-device0.20.10 on an iPhone 17 Pro simulator running iOS 26.5, following open → snapshot → interaction → explicit accessibility-state verification → close.Default configuration:
Opt-in configuration:
The complete evidence notes are in
artifacts/issue-565/README.md.CI
All Draft PR checks pass: lint/typecheck, SwiftLint, package build, Android build, iOS build, CodeQL, and GitHub code scanning for Actions, C/C++, and JavaScript/TypeScript.