From b83d99fe2028c9a73511aaae0a5aebdd490a2c53 Mon Sep 17 00:00:00 2001 From: Krystian Sienkiewicz Date: Wed, 19 Aug 2026 02:30:20 +0200 Subject: [PATCH 01/10] feat: spm compatibility --- Package.swift | 180 ++++++++++++++++++ ReactNativeEnrichedHtml.podspec | 2 +- ios/EnrichedTextInputView.mm | 10 +- ios/EnrichedTextView.mm | 8 +- ios/interfaces/LinkRegexConfig.h | 2 +- .../EnrichedTextComponentDescriptor.h | 4 +- ...EnrichedTextInputViewComponentDescriptor.h | 4 +- .../EnrichedTextInputViewShadowNode.h | 6 +- ios/internals/EnrichedTextViewShadowNode.h | 6 +- package.json | 2 + react-native-spm-prefix.h | 10 + 11 files changed, 213 insertions(+), 21 deletions(-) create mode 100644 Package.swift create mode 100644 react-native-spm-prefix.h diff --git a/Package.swift b/Package.swift new file mode 100644 index 000000000..951cef5f5 --- /dev/null +++ b/Package.swift @@ -0,0 +1,180 @@ +// swift-tools-version: 6.0 +// AUTO-SCAFFOLDED by react-native spm scaffold — safe to edit & commit via patch-package. +// AUTO-SCAFFOLDED-VERSION: 19 +// Cache slot: 0.87.0/dual-flavor +// Edit the contents below if needed and re-run `npx patch-package ` +// to persist across `npm install`. To regenerate from the podspec, remove +// this file (or just this marker) and re-run `npx react-native spm scaffold`. +// +// Package references are plain relative paths, computed when this file was +// scaffolded. They stay correct because the file is re-scaffolded per app +// and cache slot, and any node_modules relayout reinstalls this package +// (dropping the file) anyway. + +import PackageDescription + +let package = Package( + name: "ReactNativeEnrichedHtml", + platforms: [.iOS(.v15)], + products: [ + .library(name: "ReactNativeEnrichedHtml", targets: ["ReactNativeEnrichedHtml"]), + ], + dependencies: [ + .package(name: "ReactNative", path: "../../../../xcframeworks"), + .package(name: "React-GeneratedCode", path: "../../../ios"), + ], + targets: [ + .target( + name: "ReactNativeEnrichedHtml", + dependencies: [.product(name: "ReactHeaders", package: "ReactNative"), .product(name: "ReactNativeHeaders", package: "ReactNative"), .product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"), .product(name: "ReactAppHeaders", package: "React-GeneratedCode")], + path: ".", + sources: [ + "cpp/GumboParser/GumboParser.h", + "cpp/parser/GumboNormalizer.c", + "cpp/parser/GumboParser.cpp", + "cpp/parser/GumboParser.hpp", + "ios/EnrichedTextInputView.h", + "ios/EnrichedTextInputView.mm", + "ios/EnrichedTextInputViewManager.mm", + "ios/EnrichedTextView.h", + "ios/EnrichedTextView.mm", + "ios/EnrichedTextViewManager.mm", + "ios/config/EnrichedConfig.h", + "ios/config/EnrichedConfig.mm", + "ios/enrichedInputTextView/EnrichedInputTextView.h", + "ios/enrichedInputTextView/EnrichedInputTextView.mm", + "ios/enrichedTextTextView/EnrichedTextTextView.h", + "ios/enrichedTextTextView/EnrichedTextTextView.mm", + "ios/extensions/ColorExtension.h", + "ios/extensions/ColorExtension.mm", + "ios/extensions/FontExtension.h", + "ios/extensions/FontExtension.mm", + "ios/extensions/ImageExtension.h", + "ios/extensions/ImageExtension.mm", + "ios/extensions/LayoutManagerExtension.h", + "ios/extensions/LayoutManagerExtension.mm", + "ios/extensions/StringExtension.h", + "ios/extensions/StringExtension.mm", + "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/ComponentDescriptors.cpp", + "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/ComponentDescriptors.h", + "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/EventEmitters.cpp", + "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/EventEmitters.h", + "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.cpp", + "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h", + "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/RCTComponentViewHelpers.h", + "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/ShadowNodes.cpp", + "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/ShadowNodes.h", + "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/States.cpp", + "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/States.h", + "ios/htmlParser/HtmlParser.h", + "ios/htmlParser/HtmlParser.mm", + "ios/inputAttributesManager/InputAttributesManager.h", + "ios/inputAttributesManager/InputAttributesManager.mm", + "ios/inputHtmlParser/InputHtmlParser.h", + "ios/inputHtmlParser/InputHtmlParser.mm", + "ios/interfaces/AlignmentEntry.h", + "ios/interfaces/AlignmentEntry.mm", + "ios/interfaces/AttributeEntry.h", + "ios/interfaces/AttributeEntry.mm", + "ios/interfaces/BaseStyleProtocol.h", + "ios/interfaces/EnrichedTextStyleHeaders.h", + "ios/interfaces/EnrichedViewHost.h", + "ios/interfaces/ImageAttachment.h", + "ios/interfaces/ImageAttachment.mm", + "ios/interfaces/ImageData.h", + "ios/interfaces/ImageData.mm", + "ios/interfaces/LinkData.h", + "ios/interfaces/LinkData.mm", + "ios/interfaces/LinkRegexConfig.h", + "ios/interfaces/LinkRegexConfig.mm", + "ios/interfaces/MediaAttachment.h", + "ios/interfaces/MediaAttachment.mm", + "ios/interfaces/MentionParams.h", + "ios/interfaces/MentionParams.mm", + "ios/interfaces/MentionStyleProps.h", + "ios/interfaces/MentionStyleProps.mm", + "ios/interfaces/StyleBase.h", + "ios/interfaces/StyleBase.mm", + "ios/interfaces/StyleHeaders.h", + "ios/interfaces/StylePair.h", + "ios/interfaces/StylePair.mm", + "ios/interfaces/StyleTypeEnum.h", + "ios/interfaces/TextDecorationLineEnum.h", + "ios/interfaces/TextDecorationLineEnum.mm", + "ios/internals/EnrichedTextComponentDescriptor.h", + "ios/internals/EnrichedTextInputViewComponentDescriptor.h", + "ios/internals/EnrichedTextInputViewShadowNode.h", + "ios/internals/EnrichedTextInputViewShadowNode.mm", + "ios/internals/EnrichedTextInputViewState.cpp", + "ios/internals/EnrichedTextInputViewState.h", + "ios/internals/EnrichedTextViewShadowNode.h", + "ios/internals/EnrichedTextViewShadowNode.mm", + "ios/internals/EnrichedTextViewState.cpp", + "ios/internals/EnrichedTextViewState.h", + "ios/styles/AlignmentStyle.mm", + "ios/styles/BlockQuoteStyle.mm", + "ios/styles/BoldStyle.mm", + "ios/styles/CheckboxListStyle.mm", + "ios/styles/CodeBlockStyle.mm", + "ios/styles/EnrichedTextStyles.mm", + "ios/styles/H1Style.mm", + "ios/styles/H2Style.mm", + "ios/styles/H3Style.mm", + "ios/styles/H4Style.mm", + "ios/styles/H5Style.mm", + "ios/styles/H6Style.mm", + "ios/styles/HeadingStyleBase.mm", + "ios/styles/ImageStyle.mm", + "ios/styles/InlineCodeStyle.mm", + "ios/styles/ItalicStyle.mm", + "ios/styles/LinkStyle.mm", + "ios/styles/MentionStyle.mm", + "ios/styles/OrderedListStyle.mm", + "ios/styles/StrikethroughStyle.mm", + "ios/styles/UnderlineStyle.mm", + "ios/styles/UnorderedListStyle.mm", + "ios/textHtmlParser/TextHtmlParser.h", + "ios/textHtmlParser/TextHtmlParser.mm", + "ios/utils/AlignmentUtils.h", + "ios/utils/AlignmentUtils.mm", + "ios/utils/AttachmentLayoutUtils.h", + "ios/utils/AttachmentLayoutUtils.mm", + "ios/utils/CheckboxHitTestUtils.h", + "ios/utils/CheckboxHitTestUtils.mm", + "ios/utils/DotReplacementUtils.h", + "ios/utils/DotReplacementUtils.mm", + "ios/utils/EnrichedTextTouchHandler.h", + "ios/utils/EnrichedTextTouchHandler.mm", + "ios/utils/KeyboardUtils.h", + "ios/utils/KeyboardUtils.mm", + "ios/utils/OccurenceUtils.h", + "ios/utils/OccurenceUtils.mm", + "ios/utils/ParagraphAttributesUtils.h", + "ios/utils/ParagraphAttributesUtils.mm", + "ios/utils/RangeUtils.h", + "ios/utils/RangeUtils.mm", + "ios/utils/ShortcutsUtils.h", + "ios/utils/ShortcutsUtils.mm", + "ios/utils/StyleUtils.h", + "ios/utils/StyleUtils.mm", + "ios/utils/TextBlockTapGestureRecognizer.h", + "ios/utils/TextBlockTapGestureRecognizer.mm", + "ios/utils/TextInsertionUtils.h", + "ios/utils/TextInsertionUtils.mm", + "ios/utils/TextListsUtils.h", + "ios/utils/TextListsUtils.mm", + "ios/utils/WeakBox.h", + "ios/utils/WeakBox.m", + "ios/utils/WordsUtils.h", + "ios/utils/WordsUtils.mm", + "ios/utils/ZeroWidthSpaceUtils.h", + "ios/utils/ZeroWidthSpaceUtils.mm", + ], + publicHeadersPath: "ios", + cSettings: [.headerSearchPath("cpp/GumboParser"), .headerSearchPath("cpp/parser"), .headerSearchPath("ios"), .headerSearchPath("ios/config"), .headerSearchPath("ios/enrichedInputTextView"), .headerSearchPath("ios/enrichedTextTextView"), .headerSearchPath("ios/extensions"), .headerSearchPath("ios/generated/ReactCodegen/ReactNativeEnrichedSpec"), .headerSearchPath("ios/htmlParser"), .headerSearchPath("ios/inputAttributesManager"), .headerSearchPath("ios/inputHtmlParser"), .headerSearchPath("ios/interfaces"), .headerSearchPath("ios/internals"), .headerSearchPath("ios/textHtmlParser"), .headerSearchPath("ios/utils"), .headerSearchPath("."), .unsafeFlags(["-include", "react-native-spm-prefix.h"])], + cxxSettings: [.headerSearchPath("cpp/GumboParser"), .headerSearchPath("cpp/parser"), .headerSearchPath("ios"), .headerSearchPath("ios/config"), .headerSearchPath("ios/enrichedInputTextView"), .headerSearchPath("ios/enrichedTextTextView"), .headerSearchPath("ios/extensions"), .headerSearchPath("ios/generated/ReactCodegen/ReactNativeEnrichedSpec"), .headerSearchPath("ios/htmlParser"), .headerSearchPath("ios/inputAttributesManager"), .headerSearchPath("ios/inputHtmlParser"), .headerSearchPath("ios/interfaces"), .headerSearchPath("ios/internals"), .headerSearchPath("ios/textHtmlParser"), .headerSearchPath("ios/utils"), .headerSearchPath("."), .unsafeFlags(["-include", "react-native-spm-prefix.h"]), .define("DEBUG", .when(configuration: .debug)), .define("NDEBUG", .when(configuration: .release))], + linkerSettings: [.linkedFramework("UIKit"), .linkedFramework("Foundation"), .linkedFramework("CoreGraphics")] + ), + ], + cxxLanguageStandard: .cxx20 +) diff --git a/ReactNativeEnrichedHtml.podspec b/ReactNativeEnrichedHtml.podspec index 0af0fb0b0..297bd9d6b 100644 --- a/ReactNativeEnrichedHtml.podspec +++ b/ReactNativeEnrichedHtml.podspec @@ -17,7 +17,7 @@ Pod::Spec.new do |s| s.exclude_files = ["cpp/tests/**"] s.private_header_files = "ios/**/*.h" s.pod_target_xcconfig = { - 'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}/cpp/parser" "${PODS_TARGET_SRCROOT}/cpp/GumboParser"' + 'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}" "${PODS_TARGET_SRCROOT}/cpp/parser" "${PODS_TARGET_SRCROOT}/cpp/GumboParser"' } # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0. diff --git a/ios/EnrichedTextInputView.mm b/ios/EnrichedTextInputView.mm index b255b0e93..0b6060e28 100644 --- a/ios/EnrichedTextInputView.mm +++ b/ios/EnrichedTextInputView.mm @@ -3,12 +3,12 @@ #import "AttachmentLayoutUtils.h" #import "CoreText/CoreText.h" #import "DotReplacementUtils.h" +#import "EnrichedTextInputViewComponentDescriptor.h" #import "HtmlParser.h" #import "ImageAttachment.h" #import "KeyboardUtils.h" #import "LayoutManagerExtension.h" #import "ParagraphAttributesUtils.h" -#import "RCTFabricComponentsPlugins.h" #import "ShortcutsUtils.h" #import "StringExtension.h" #import "StyleHeaders.h" @@ -17,12 +17,12 @@ #import "TextInsertionUtils.h" #import "WordsUtils.h" #import "ZeroWidthSpaceUtils.h" +#import "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/EventEmitters.h" +#import "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h" +#import "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/RCTComponentViewHelpers.h" #import +#import #import -#import -#import -#import -#import #import #import diff --git a/ios/EnrichedTextView.mm b/ios/EnrichedTextView.mm index 78ef42dff..105b1bac4 100644 --- a/ios/EnrichedTextView.mm +++ b/ios/EnrichedTextView.mm @@ -1,5 +1,6 @@ #import "EnrichedTextView.h" #import "AttachmentLayoutUtils.h" +#import "EnrichedTextComponentDescriptor.h" #import "EnrichedTextStyleHeaders.h" #import "EnrichedTextTextView.h" #import "EnrichedTextTouchHandler.h" @@ -7,15 +8,14 @@ #import "LinkData.h" #import "MentionParams.h" #import "MentionStyleProps.h" -#import "RCTFabricComponentsPlugins.h" #import "StringExtension.h" #import "StyleUtils.h" #import "TextDecorationLineEnum.h" #import "TextHtmlParser.h" +#import "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/EventEmitters.h" +#import "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h" #import -#import -#import -#import +#import #import #import diff --git a/ios/interfaces/LinkRegexConfig.h b/ios/interfaces/LinkRegexConfig.h index 95cc1a543..2dd2c9c6c 100644 --- a/ios/interfaces/LinkRegexConfig.h +++ b/ios/interfaces/LinkRegexConfig.h @@ -1,5 +1,5 @@ #pragma once -#import +#import "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h" #import using namespace facebook::react; diff --git a/ios/internals/EnrichedTextComponentDescriptor.h b/ios/internals/EnrichedTextComponentDescriptor.h index 9ac54f043..eab375cd0 100644 --- a/ios/internals/EnrichedTextComponentDescriptor.h +++ b/ios/internals/EnrichedTextComponentDescriptor.h @@ -1,6 +1,6 @@ #pragma once -#include -#include +#include "EnrichedTextViewShadowNode.h" +#include "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h" #include #include diff --git a/ios/internals/EnrichedTextInputViewComponentDescriptor.h b/ios/internals/EnrichedTextInputViewComponentDescriptor.h index 004ebc942..3d7854450 100644 --- a/ios/internals/EnrichedTextInputViewComponentDescriptor.h +++ b/ios/internals/EnrichedTextInputViewComponentDescriptor.h @@ -1,6 +1,6 @@ #pragma once -#include -#include +#include "EnrichedTextInputViewShadowNode.h" +#include "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h" #include #include diff --git a/ios/internals/EnrichedTextInputViewShadowNode.h b/ios/internals/EnrichedTextInputViewShadowNode.h index aebaa94a0..e17192876 100644 --- a/ios/internals/EnrichedTextInputViewShadowNode.h +++ b/ios/internals/EnrichedTextInputViewShadowNode.h @@ -1,7 +1,7 @@ #pragma once -#include -#include -#include +#include "EnrichedTextInputViewState.h" +#include "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/EventEmitters.h" +#include "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h" #include #include #include diff --git a/ios/internals/EnrichedTextViewShadowNode.h b/ios/internals/EnrichedTextViewShadowNode.h index e7a6b5e27..cef9afcc0 100644 --- a/ios/internals/EnrichedTextViewShadowNode.h +++ b/ios/internals/EnrichedTextViewShadowNode.h @@ -1,7 +1,7 @@ #pragma once -#include -#include -#include +#include "EnrichedTextViewState.h" +#include "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/EventEmitters.h" +#include "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h" #include #include #include diff --git a/package.json b/package.json index 6e2eff6d5..5f5ba5afe 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,8 @@ "android", "ios", "cpp", + "Package.swift", + "react-native-spm-prefix.h", "*.podspec", "react-native.config.js", "!ios/build", diff --git a/react-native-spm-prefix.h b/react-native-spm-prefix.h new file mode 100644 index 000000000..af5cea055 --- /dev/null +++ b/react-native-spm-prefix.h @@ -0,0 +1,10 @@ +// AUTO-SCAFFOLDED by react-native spm scaffold — mirrors CocoaPods' default +// prefix header so ObjC sources that rely on an implicit Foundation/UIKit +// import compile under SPM (which has no prefix-header mechanism). Safe to +// delete + regenerate via `npx react-native spm scaffold`. +#ifdef __OBJC__ +#import +#if __has_include() +#import +#endif +#endif From 562f7cfc2231880e10b8a6dfcbb216112a822d9c Mon Sep 17 00:00:00 2001 From: Krystian Sienkiewicz Date: Wed, 19 Aug 2026 11:48:11 +0200 Subject: [PATCH 02/10] feat: testing example app --- apps/example/src/hooks/useEditorState.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/example/src/hooks/useEditorState.ts b/apps/example/src/hooks/useEditorState.ts index 69dcc3048..73e8d46f3 100644 --- a/apps/example/src/hooks/useEditorState.ts +++ b/apps/example/src/hooks/useEditorState.ts @@ -25,7 +25,6 @@ import { DEFAULT_IMAGE_WIDTH, prepareImageDimensions, } from '../utils/prepareImageDimensions'; -import { launchImageLibrary } from 'react-native-image-picker'; type CurrentLinkState = OnLinkDetected; @@ -212,10 +211,7 @@ export function useEditorState() { return; } - const response = await launchImageLibrary({ - mediaType: 'photo', - selectionLimit: 1, - }); + const response: any = undefined; if (response?.assets?.[0] === undefined) return; From 3600ad2503814839daebadcd2d8f965f192dc1ee Mon Sep 17 00:00:00 2001 From: Krystian Sienkiewicz Date: Wed, 19 Aug 2026 12:57:21 +0200 Subject: [PATCH 03/10] fix: package.swift tweaks --- Package.swift | 17 ++++++----------- react-native-spm-prefix.h | 4 ---- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/Package.swift b/Package.swift index 951cef5f5..6b2e0aaca 100644 --- a/Package.swift +++ b/Package.swift @@ -1,15 +1,4 @@ // swift-tools-version: 6.0 -// AUTO-SCAFFOLDED by react-native spm scaffold — safe to edit & commit via patch-package. -// AUTO-SCAFFOLDED-VERSION: 19 -// Cache slot: 0.87.0/dual-flavor -// Edit the contents below if needed and re-run `npx patch-package ` -// to persist across `npm install`. To regenerate from the podspec, remove -// this file (or just this marker) and re-run `npx react-native spm scaffold`. -// -// Package references are plain relative paths, computed when this file was -// scaffolded. They stay correct because the file is re-scaffolded per app -// and cache slot, and any node_modules relayout reinstalls this package -// (dropping the file) anyway. import PackageDescription @@ -28,6 +17,12 @@ let package = Package( name: "ReactNativeEnrichedHtml", dependencies: [.product(name: "ReactHeaders", package: "ReactNative"), .product(name: "ReactNativeHeaders", package: "ReactNative"), .product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"), .product(name: "ReactAppHeaders", package: "React-GeneratedCode")], path: ".", + exclude: [ + "node_modules", + "android", + "lib", + "src", + ], sources: [ "cpp/GumboParser/GumboParser.h", "cpp/parser/GumboNormalizer.c", diff --git a/react-native-spm-prefix.h b/react-native-spm-prefix.h index af5cea055..335816e75 100644 --- a/react-native-spm-prefix.h +++ b/react-native-spm-prefix.h @@ -1,7 +1,3 @@ -// AUTO-SCAFFOLDED by react-native spm scaffold — mirrors CocoaPods' default -// prefix header so ObjC sources that rely on an implicit Foundation/UIKit -// import compile under SPM (which has no prefix-header mechanism). Safe to -// delete + regenerate via `npx react-native spm scaffold`. #ifdef __OBJC__ #import #if __has_include() From 836ca64cf6145bca9fd48d6676eb00f5074174d1 Mon Sep 17 00:00:00 2001 From: Krystian Sienkiewicz Date: Thu, 27 Aug 2026 15:11:41 +0200 Subject: [PATCH 04/10] refactor: generalized the source list in package.swift --- Package.swift | 143 ++------------------------------------------------ 1 file changed, 3 insertions(+), 140 deletions(-) diff --git a/Package.swift b/Package.swift index 6b2e0aaca..bd207dbdd 100644 --- a/Package.swift +++ b/Package.swift @@ -24,146 +24,9 @@ let package = Package( "src", ], sources: [ - "cpp/GumboParser/GumboParser.h", - "cpp/parser/GumboNormalizer.c", - "cpp/parser/GumboParser.cpp", - "cpp/parser/GumboParser.hpp", - "ios/EnrichedTextInputView.h", - "ios/EnrichedTextInputView.mm", - "ios/EnrichedTextInputViewManager.mm", - "ios/EnrichedTextView.h", - "ios/EnrichedTextView.mm", - "ios/EnrichedTextViewManager.mm", - "ios/config/EnrichedConfig.h", - "ios/config/EnrichedConfig.mm", - "ios/enrichedInputTextView/EnrichedInputTextView.h", - "ios/enrichedInputTextView/EnrichedInputTextView.mm", - "ios/enrichedTextTextView/EnrichedTextTextView.h", - "ios/enrichedTextTextView/EnrichedTextTextView.mm", - "ios/extensions/ColorExtension.h", - "ios/extensions/ColorExtension.mm", - "ios/extensions/FontExtension.h", - "ios/extensions/FontExtension.mm", - "ios/extensions/ImageExtension.h", - "ios/extensions/ImageExtension.mm", - "ios/extensions/LayoutManagerExtension.h", - "ios/extensions/LayoutManagerExtension.mm", - "ios/extensions/StringExtension.h", - "ios/extensions/StringExtension.mm", - "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/ComponentDescriptors.cpp", - "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/ComponentDescriptors.h", - "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/EventEmitters.cpp", - "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/EventEmitters.h", - "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.cpp", - "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h", - "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/RCTComponentViewHelpers.h", - "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/ShadowNodes.cpp", - "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/ShadowNodes.h", - "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/States.cpp", - "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/States.h", - "ios/htmlParser/HtmlParser.h", - "ios/htmlParser/HtmlParser.mm", - "ios/inputAttributesManager/InputAttributesManager.h", - "ios/inputAttributesManager/InputAttributesManager.mm", - "ios/inputHtmlParser/InputHtmlParser.h", - "ios/inputHtmlParser/InputHtmlParser.mm", - "ios/interfaces/AlignmentEntry.h", - "ios/interfaces/AlignmentEntry.mm", - "ios/interfaces/AttributeEntry.h", - "ios/interfaces/AttributeEntry.mm", - "ios/interfaces/BaseStyleProtocol.h", - "ios/interfaces/EnrichedTextStyleHeaders.h", - "ios/interfaces/EnrichedViewHost.h", - "ios/interfaces/ImageAttachment.h", - "ios/interfaces/ImageAttachment.mm", - "ios/interfaces/ImageData.h", - "ios/interfaces/ImageData.mm", - "ios/interfaces/LinkData.h", - "ios/interfaces/LinkData.mm", - "ios/interfaces/LinkRegexConfig.h", - "ios/interfaces/LinkRegexConfig.mm", - "ios/interfaces/MediaAttachment.h", - "ios/interfaces/MediaAttachment.mm", - "ios/interfaces/MentionParams.h", - "ios/interfaces/MentionParams.mm", - "ios/interfaces/MentionStyleProps.h", - "ios/interfaces/MentionStyleProps.mm", - "ios/interfaces/StyleBase.h", - "ios/interfaces/StyleBase.mm", - "ios/interfaces/StyleHeaders.h", - "ios/interfaces/StylePair.h", - "ios/interfaces/StylePair.mm", - "ios/interfaces/StyleTypeEnum.h", - "ios/interfaces/TextDecorationLineEnum.h", - "ios/interfaces/TextDecorationLineEnum.mm", - "ios/internals/EnrichedTextComponentDescriptor.h", - "ios/internals/EnrichedTextInputViewComponentDescriptor.h", - "ios/internals/EnrichedTextInputViewShadowNode.h", - "ios/internals/EnrichedTextInputViewShadowNode.mm", - "ios/internals/EnrichedTextInputViewState.cpp", - "ios/internals/EnrichedTextInputViewState.h", - "ios/internals/EnrichedTextViewShadowNode.h", - "ios/internals/EnrichedTextViewShadowNode.mm", - "ios/internals/EnrichedTextViewState.cpp", - "ios/internals/EnrichedTextViewState.h", - "ios/styles/AlignmentStyle.mm", - "ios/styles/BlockQuoteStyle.mm", - "ios/styles/BoldStyle.mm", - "ios/styles/CheckboxListStyle.mm", - "ios/styles/CodeBlockStyle.mm", - "ios/styles/EnrichedTextStyles.mm", - "ios/styles/H1Style.mm", - "ios/styles/H2Style.mm", - "ios/styles/H3Style.mm", - "ios/styles/H4Style.mm", - "ios/styles/H5Style.mm", - "ios/styles/H6Style.mm", - "ios/styles/HeadingStyleBase.mm", - "ios/styles/ImageStyle.mm", - "ios/styles/InlineCodeStyle.mm", - "ios/styles/ItalicStyle.mm", - "ios/styles/LinkStyle.mm", - "ios/styles/MentionStyle.mm", - "ios/styles/OrderedListStyle.mm", - "ios/styles/StrikethroughStyle.mm", - "ios/styles/UnderlineStyle.mm", - "ios/styles/UnorderedListStyle.mm", - "ios/textHtmlParser/TextHtmlParser.h", - "ios/textHtmlParser/TextHtmlParser.mm", - "ios/utils/AlignmentUtils.h", - "ios/utils/AlignmentUtils.mm", - "ios/utils/AttachmentLayoutUtils.h", - "ios/utils/AttachmentLayoutUtils.mm", - "ios/utils/CheckboxHitTestUtils.h", - "ios/utils/CheckboxHitTestUtils.mm", - "ios/utils/DotReplacementUtils.h", - "ios/utils/DotReplacementUtils.mm", - "ios/utils/EnrichedTextTouchHandler.h", - "ios/utils/EnrichedTextTouchHandler.mm", - "ios/utils/KeyboardUtils.h", - "ios/utils/KeyboardUtils.mm", - "ios/utils/OccurenceUtils.h", - "ios/utils/OccurenceUtils.mm", - "ios/utils/ParagraphAttributesUtils.h", - "ios/utils/ParagraphAttributesUtils.mm", - "ios/utils/RangeUtils.h", - "ios/utils/RangeUtils.mm", - "ios/utils/ShortcutsUtils.h", - "ios/utils/ShortcutsUtils.mm", - "ios/utils/StyleUtils.h", - "ios/utils/StyleUtils.mm", - "ios/utils/TextBlockTapGestureRecognizer.h", - "ios/utils/TextBlockTapGestureRecognizer.mm", - "ios/utils/TextInsertionUtils.h", - "ios/utils/TextInsertionUtils.mm", - "ios/utils/TextListsUtils.h", - "ios/utils/TextListsUtils.mm", - "ios/utils/WeakBox.h", - "ios/utils/WeakBox.m", - "ios/utils/WordsUtils.h", - "ios/utils/WordsUtils.mm", - "ios/utils/ZeroWidthSpaceUtils.h", - "ios/utils/ZeroWidthSpaceUtils.mm", + "cpp/GumboParser", + "cpp/parser", + "ios" ], publicHeadersPath: "ios", cSettings: [.headerSearchPath("cpp/GumboParser"), .headerSearchPath("cpp/parser"), .headerSearchPath("ios"), .headerSearchPath("ios/config"), .headerSearchPath("ios/enrichedInputTextView"), .headerSearchPath("ios/enrichedTextTextView"), .headerSearchPath("ios/extensions"), .headerSearchPath("ios/generated/ReactCodegen/ReactNativeEnrichedSpec"), .headerSearchPath("ios/htmlParser"), .headerSearchPath("ios/inputAttributesManager"), .headerSearchPath("ios/inputHtmlParser"), .headerSearchPath("ios/interfaces"), .headerSearchPath("ios/internals"), .headerSearchPath("ios/textHtmlParser"), .headerSearchPath("ios/utils"), .headerSearchPath("."), .unsafeFlags(["-include", "react-native-spm-prefix.h"])], From 288ec666fc47ba62f745112e67ed4e1fd982808c Mon Sep 17 00:00:00 2001 From: Krystian Sienkiewicz Date: Fri, 28 Aug 2026 11:54:35 +0200 Subject: [PATCH 05/10] docs: docs update --- docs/docs/misc/compatibility.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/docs/misc/compatibility.mdx b/docs/docs/misc/compatibility.mdx index 791fd1daa..918d13af7 100644 --- a/docs/docs/misc/compatibility.mdx +++ b/docs/docs/misc/compatibility.mdx @@ -86,3 +86,7 @@ Sanitization **is** enforced on the web, as injecting unsafe HTML directly into On Web those methods are no-ops. These include: `measure`, `measureInWindow`, `measureLayout` and `setNativeProps`. + +## Swift Package Manager + +SPM is supported, but it's still experimental. It's not recommended for production use yet, and its behavior may change in future releases, including breaking changes. From 08e96f51a86b0fb54cfd832e32cf97a16477d683 Mon Sep 17 00:00:00 2001 From: Krystian Sienkiewicz Date: Mon, 7 Sep 2026 02:16:49 +0200 Subject: [PATCH 06/10] refactor: cleanup Package.swift --- Package.swift | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index bd207dbdd..0eba70a9b 100644 --- a/Package.swift +++ b/Package.swift @@ -2,6 +2,35 @@ import PackageDescription +let headerSearchPaths: [String] = [ + "cpp/GumboParser", + "cpp/parser", + "ios", + "ios/config", + "ios/enrichedInputTextView", + "ios/enrichedTextTextView", + "ios/extensions", + "ios/generated/ReactCodegen/ReactNativeEnrichedSpec", + "ios/htmlParser", + "ios/inputAttributesManager", + "ios/inputHtmlParser", + "ios/interfaces", + "ios/internals", + "ios/textHtmlParser", + "ios/utils", + ".", +] + +let cSettings: [CSetting] = headerSearchPaths.map { .headerSearchPath($0) } + [ + .unsafeFlags(["-include", "react-native-spm-prefix.h"]), +] + +let cxxSettings: [CXXSetting] = headerSearchPaths.map { .headerSearchPath($0) } + [ + .unsafeFlags(["-include", "react-native-spm-prefix.h"]), + .define("DEBUG", .when(configuration: .debug)), + .define("NDEBUG", .when(configuration: .release)), +] + let package = Package( name: "ReactNativeEnrichedHtml", platforms: [.iOS(.v15)], @@ -29,8 +58,8 @@ let package = Package( "ios" ], publicHeadersPath: "ios", - cSettings: [.headerSearchPath("cpp/GumboParser"), .headerSearchPath("cpp/parser"), .headerSearchPath("ios"), .headerSearchPath("ios/config"), .headerSearchPath("ios/enrichedInputTextView"), .headerSearchPath("ios/enrichedTextTextView"), .headerSearchPath("ios/extensions"), .headerSearchPath("ios/generated/ReactCodegen/ReactNativeEnrichedSpec"), .headerSearchPath("ios/htmlParser"), .headerSearchPath("ios/inputAttributesManager"), .headerSearchPath("ios/inputHtmlParser"), .headerSearchPath("ios/interfaces"), .headerSearchPath("ios/internals"), .headerSearchPath("ios/textHtmlParser"), .headerSearchPath("ios/utils"), .headerSearchPath("."), .unsafeFlags(["-include", "react-native-spm-prefix.h"])], - cxxSettings: [.headerSearchPath("cpp/GumboParser"), .headerSearchPath("cpp/parser"), .headerSearchPath("ios"), .headerSearchPath("ios/config"), .headerSearchPath("ios/enrichedInputTextView"), .headerSearchPath("ios/enrichedTextTextView"), .headerSearchPath("ios/extensions"), .headerSearchPath("ios/generated/ReactCodegen/ReactNativeEnrichedSpec"), .headerSearchPath("ios/htmlParser"), .headerSearchPath("ios/inputAttributesManager"), .headerSearchPath("ios/inputHtmlParser"), .headerSearchPath("ios/interfaces"), .headerSearchPath("ios/internals"), .headerSearchPath("ios/textHtmlParser"), .headerSearchPath("ios/utils"), .headerSearchPath("."), .unsafeFlags(["-include", "react-native-spm-prefix.h"]), .define("DEBUG", .when(configuration: .debug)), .define("NDEBUG", .when(configuration: .release))], + cSettings: cSettings, + cxxSettings: cxxSettings, linkerSettings: [.linkedFramework("UIKit"), .linkedFramework("Foundation"), .linkedFramework("CoreGraphics")] ), ], From 145c66821544d342226bba2a4a04ddb40dde9f89 Mon Sep 17 00:00:00 2001 From: Krystian Sienkiewicz Date: Mon, 7 Sep 2026 13:35:41 +0200 Subject: [PATCH 07/10] feat: drop react-native-spm-prefix.h --- Package.swift | 8 +++----- ios/utils/TextBlockTapGestureRecognizer.h | 2 ++ ios/utils/WeakBox.h | 2 ++ package.json | 1 - react-native-spm-prefix.h | 6 ------ 5 files changed, 7 insertions(+), 12 deletions(-) delete mode 100644 react-native-spm-prefix.h diff --git a/Package.swift b/Package.swift index 0eba70a9b..9770d2abd 100644 --- a/Package.swift +++ b/Package.swift @@ -21,12 +21,8 @@ let headerSearchPaths: [String] = [ ".", ] -let cSettings: [CSetting] = headerSearchPaths.map { .headerSearchPath($0) } + [ - .unsafeFlags(["-include", "react-native-spm-prefix.h"]), -] - +let cSettings: [CSetting] = headerSearchPaths.map { .headerSearchPath($0) } let cxxSettings: [CXXSetting] = headerSearchPaths.map { .headerSearchPath($0) } + [ - .unsafeFlags(["-include", "react-native-spm-prefix.h"]), .define("DEBUG", .when(configuration: .debug)), .define("NDEBUG", .when(configuration: .release)), ] @@ -51,6 +47,8 @@ let package = Package( "android", "lib", "src", + "apps", + "docs", ], sources: [ "cpp/GumboParser", diff --git a/ios/utils/TextBlockTapGestureRecognizer.h b/ios/utils/TextBlockTapGestureRecognizer.h index b9f5f4855..7bdb513fb 100644 --- a/ios/utils/TextBlockTapGestureRecognizer.h +++ b/ios/utils/TextBlockTapGestureRecognizer.h @@ -1,3 +1,5 @@ +#import + typedef NS_ENUM(NSInteger, TextBlockTapKind) { TextBlockTapKindNone = 0, TextBlockTapKindCheckbox, diff --git a/ios/utils/WeakBox.h b/ios/utils/WeakBox.h index 529048abe..093f7acaf 100644 --- a/ios/utils/WeakBox.h +++ b/ios/utils/WeakBox.h @@ -1,3 +1,5 @@ +#import + @interface WeakBox : NSObject @property(nonatomic, weak) id value; @end diff --git a/package.json b/package.json index 5f5ba5afe..d73886315 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "ios", "cpp", "Package.swift", - "react-native-spm-prefix.h", "*.podspec", "react-native.config.js", "!ios/build", diff --git a/react-native-spm-prefix.h b/react-native-spm-prefix.h deleted file mode 100644 index 335816e75..000000000 --- a/react-native-spm-prefix.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifdef __OBJC__ -#import -#if __has_include() -#import -#endif -#endif From 3a30c5a471fc78f5b864200111a41774635f02b9 Mon Sep 17 00:00:00 2001 From: Krystian Sienkiewicz Date: Mon, 7 Sep 2026 15:01:58 +0200 Subject: [PATCH 08/10] docs: revert the spm suppport mention --- docs/docs/misc/compatibility.mdx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/docs/misc/compatibility.mdx b/docs/docs/misc/compatibility.mdx index 918d13af7..791fd1daa 100644 --- a/docs/docs/misc/compatibility.mdx +++ b/docs/docs/misc/compatibility.mdx @@ -86,7 +86,3 @@ Sanitization **is** enforced on the web, as injecting unsafe HTML directly into On Web those methods are no-ops. These include: `measure`, `measureInWindow`, `measureLayout` and `setNativeProps`. - -## Swift Package Manager - -SPM is supported, but it's still experimental. It's not recommended for production use yet, and its behavior may change in future releases, including breaking changes. From 9cfad53e4d7af3a3fc39926d423075fd3bec420d Mon Sep 17 00:00:00 2001 From: Krystian Sienkiewicz Date: Mon, 7 Sep 2026 19:19:10 +0200 Subject: [PATCH 09/10] fix: code left from local testing --- Package.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Package.swift b/Package.swift index 9770d2abd..df57fc95e 100644 --- a/Package.swift +++ b/Package.swift @@ -47,8 +47,6 @@ let package = Package( "android", "lib", "src", - "apps", - "docs", ], sources: [ "cpp/GumboParser", From c036cd53108bb396e46691123f0cd46812b99f64 Mon Sep 17 00:00:00 2001 From: Krystian Sienkiewicz Date: Fri, 18 Sep 2026 14:35:00 +0200 Subject: [PATCH 10/10] chore: revert image-picker strip --- apps/example/src/hooks/useEditorState.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/example/src/hooks/useEditorState.ts b/apps/example/src/hooks/useEditorState.ts index 73e8d46f3..69dcc3048 100644 --- a/apps/example/src/hooks/useEditorState.ts +++ b/apps/example/src/hooks/useEditorState.ts @@ -25,6 +25,7 @@ import { DEFAULT_IMAGE_WIDTH, prepareImageDimensions, } from '../utils/prepareImageDimensions'; +import { launchImageLibrary } from 'react-native-image-picker'; type CurrentLinkState = OnLinkDetected; @@ -211,7 +212,10 @@ export function useEditorState() { return; } - const response: any = undefined; + const response = await launchImageLibrary({ + mediaType: 'photo', + selectionLimit: 1, + }); if (response?.assets?.[0] === undefined) return;