Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// swift-tools-version: 6.0

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: ".",
exclude: [
"node_modules",
"android",
"lib",
"src",
],
Comment thread
hejsztynx marked this conversation as resolved.
sources: [
Comment thread
szydlovsky marked this conversation as resolved.
"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"])],
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))],
Comment thread
hejsztynx marked this conversation as resolved.
linkerSettings: [.linkedFramework("UIKit"), .linkedFramework("Foundation"), .linkedFramework("CoreGraphics")]
),
],
cxxLanguageStandard: .cxx20
)
2 changes: 1 addition & 1 deletion ReactNativeEnrichedHtml.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions apps/example/src/hooks/useEditorState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
DEFAULT_IMAGE_WIDTH,
prepareImageDimensions,
} from '../utils/prepareImageDimensions';
import { launchImageLibrary } from 'react-native-image-picker';

type CurrentLinkState = OnLinkDetected;

Expand Down Expand Up @@ -212,10 +211,7 @@ export function useEditorState() {
return;
}

const response = await launchImageLibrary({
mediaType: 'photo',
selectionLimit: 1,
});
const response: any = undefined;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stripped react-native-image-picker functionalities for testing purposes only. This will be removed before merging


if (response?.assets?.[0] === undefined) return;
Comment thread
hejsztynx marked this conversation as resolved.

Expand Down
4 changes: 4 additions & 0 deletions docs/docs/misc/compatibility.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Comment thread
hejsztynx marked this conversation as resolved.
10 changes: 5 additions & 5 deletions ios/EnrichedTextInputView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 <React/RCTConversions.h>
#import <React/RCTFabricComponentsPlugins.h>
#import <React/UIView+React.h>
#import <ReactNativeEnrichedHtml/EnrichedTextInputViewComponentDescriptor.h>
#import <ReactNativeEnrichedHtml/EventEmitters.h>
#import <ReactNativeEnrichedHtml/Props.h>
#import <ReactNativeEnrichedHtml/RCTComponentViewHelpers.h>
#import <folly/dynamic.h>
#import <react/utils/ManagedObjectWrapper.h>

Expand Down
8 changes: 4 additions & 4 deletions ios/EnrichedTextView.mm
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#import "EnrichedTextView.h"
#import "AttachmentLayoutUtils.h"
#import "EnrichedTextComponentDescriptor.h"
#import "EnrichedTextStyleHeaders.h"
#import "EnrichedTextTextView.h"
#import "EnrichedTextTouchHandler.h"
#import "LayoutManagerExtension.h"
#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 <React/RCTConversions.h>
#import <ReactNativeEnrichedHtml/EnrichedTextComponentDescriptor.h>
#import <ReactNativeEnrichedHtml/EventEmitters.h>
#import <ReactNativeEnrichedHtml/Props.h>
#import <React/RCTFabricComponentsPlugins.h>
#import <folly/dynamic.h>
#import <react/utils/ManagedObjectWrapper.h>

Expand Down
2 changes: 1 addition & 1 deletion ios/interfaces/LinkRegexConfig.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#import <ReactNativeEnrichedHtml/Props.h>
#import "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h"
#import <UIKit/UIKit.h>

using namespace facebook::react;
Expand Down
4 changes: 2 additions & 2 deletions ios/internals/EnrichedTextComponentDescriptor.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include <ReactNativeEnrichedHtml/EnrichedTextViewShadowNode.h>
#include <ReactNativeEnrichedHtml/Props.h>
#include "EnrichedTextViewShadowNode.h"
#include "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h"
#include <react/debug/react_native_assert.h>
#include <react/renderer/core/ConcreteComponentDescriptor.h>

Expand Down
4 changes: 2 additions & 2 deletions ios/internals/EnrichedTextInputViewComponentDescriptor.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include <ReactNativeEnrichedHtml/EnrichedTextInputViewShadowNode.h>
#include <ReactNativeEnrichedHtml/Props.h>
#include "EnrichedTextInputViewShadowNode.h"
#include "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h"
#include <react/debug/react_native_assert.h>
#include <react/renderer/core/ConcreteComponentDescriptor.h>

Expand Down
6 changes: 3 additions & 3 deletions ios/internals/EnrichedTextInputViewShadowNode.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include <ReactNativeEnrichedHtml/EnrichedTextInputViewState.h>
#include <ReactNativeEnrichedHtml/EventEmitters.h>
#include <ReactNativeEnrichedHtml/Props.h>
#include "EnrichedTextInputViewState.h"
#include "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/EventEmitters.h"
#include "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h"
#include <jsi/jsi.h>
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
#include <react/renderer/core/LayoutConstraints.h>
Expand Down
6 changes: 3 additions & 3 deletions ios/internals/EnrichedTextViewShadowNode.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include <ReactNativeEnrichedHtml/EnrichedTextViewState.h>
#include <ReactNativeEnrichedHtml/EventEmitters.h>
#include <ReactNativeEnrichedHtml/Props.h>
#include "EnrichedTextViewState.h"
#include "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/EventEmitters.h"
#include "ios/generated/ReactCodegen/ReactNativeEnrichedSpec/Props.h"
#include <jsi/jsi.h>
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
#include <react/renderer/core/LayoutConstraints.h>
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"android",
"ios",
"cpp",
"Package.swift",
"react-native-spm-prefix.h",
"*.podspec",
"react-native.config.js",
"!ios/build",
Expand Down
6 changes: 6 additions & 0 deletions react-native-spm-prefix.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#if __has_include(<UIKit/UIKit.h>)
#import <UIKit/UIKit.h>
#endif
#endif
Loading