diff --git a/Package.swift b/Package.swift new file mode 100644 index 000000000..df57fc95e --- /dev/null +++ b/Package.swift @@ -0,0 +1,63 @@ +// swift-tools-version: 6.0 + +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) } +let cxxSettings: [CXXSetting] = headerSearchPaths.map { .headerSearchPath($0) } + [ + .define("DEBUG", .when(configuration: .debug)), + .define("NDEBUG", .when(configuration: .release)), +] + +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: ".", + exclude: [ + "node_modules", + "android", + "lib", + "src", + ], + sources: [ + "cpp/GumboParser", + "cpp/parser", + "ios" + ], + publicHeadersPath: "ios", + cSettings: cSettings, + cxxSettings: cxxSettings, + 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/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; diff --git a/ios/EnrichedTextInputView.mm b/ios/EnrichedTextInputView.mm index 740971bbc..ae1605fed 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 2396367cc..cf6fa628f 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/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 6e2eff6d5..d73886315 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "android", "ios", "cpp", + "Package.swift", "*.podspec", "react-native.config.js", "!ios/build",