From 2b2cf48c1e04975d2716ee237c56d61fe29d68c4 Mon Sep 17 00:00:00 2001 From: Piotr Karamon Date: Wed, 18 Mar 2026 14:36:47 +0100 Subject: [PATCH 01/12] refactor: consolidate shared types into src/types.ts --- src/EnrichedTextInput.tsx | 132 ++--------------------- src/index.tsx | 13 ++- src/types.ts | 217 +++++++++++++++++++++++++++++++++++++- 3 files changed, 237 insertions(+), 125 deletions(-) diff --git a/src/EnrichedTextInput.tsx b/src/EnrichedTextInput.tsx index ed6063ea..d804ff1a 100644 --- a/src/EnrichedTextInput.tsx +++ b/src/EnrichedTextInput.tsx @@ -1,6 +1,5 @@ import { type Component, - type RefObject, useEffect, useImperativeHandle, useMemo, @@ -10,141 +9,28 @@ import { useCallback } from 'react'; import EnrichedTextInputNativeComponent, { Commands, type NativeProps, - type OnChangeHtmlEvent, - type OnChangeSelectionEvent, - type OnChangeStateEvent, - type OnChangeTextEvent, type OnContextMenuItemPressEvent, - type OnLinkDetected, type OnMentionEvent, - type OnMentionDetected, type OnMentionDetectedInternal, type OnRequestHtmlResultEvent, - type OnKeyPressEvent, - type OnPasteImagesEvent, } from './spec/EnrichedTextInputNativeComponent'; import type { - ColorValue, HostInstance, MeasureInWindowOnSuccessCallback, MeasureLayoutOnSuccessCallback, MeasureOnSuccessCallback, NativeMethods, NativeSyntheticEvent, - TargetedEvent, - TextStyle, - ViewProps, - ViewStyle, } from 'react-native'; import { normalizeHtmlStyle } from './utils/normalizeHtmlStyle'; import { toNativeRegexConfig } from './utils/regexParser'; import { nullthrows } from './utils/nullthrows'; -import type { HtmlStyle } from './types'; - -export type FocusEvent = NativeSyntheticEvent; -export type BlurEvent = NativeSyntheticEvent; - -export interface EnrichedTextInputInstance extends NativeMethods { - // General commands - focus: () => void; - blur: () => void; - setValue: (value: string) => void; - setSelection: (start: number, end: number) => void; - getHTML: () => Promise; - - // Text formatting commands - toggleBold: () => void; - toggleItalic: () => void; - toggleUnderline: () => void; - toggleStrikeThrough: () => void; - toggleInlineCode: () => void; - toggleH1: () => void; - toggleH2: () => void; - toggleH3: () => void; - toggleH4: () => void; - toggleH5: () => void; - toggleH6: () => void; - toggleCodeBlock: () => void; - toggleBlockQuote: () => void; - toggleOrderedList: () => void; - toggleUnorderedList: () => void; - toggleCheckboxList: (checked: boolean) => void; - setLink: (start: number, end: number, text: string, url: string) => void; - removeLink: (start: number, end: number) => void; - setImage: (src: string, width: number, height: number) => void; - startMention: (indicator: string) => void; - setMention: ( - indicator: string, - text: string, - attributes?: Record - ) => void; -} - -export interface ContextMenuItem { - text: string; - onPress: ({ - text, - selection, - styleState, - }: { - text: string; - selection: { start: number; end: number }; - styleState: OnChangeStateEvent; - }) => void; - visible?: boolean; -} - -export interface OnChangeMentionEvent { - indicator: string; - text: string; -} - -export interface EnrichedTextInputProps extends Omit { - ref?: RefObject; - autoFocus?: boolean; - editable?: boolean; - mentionIndicators?: string[]; - defaultValue?: string; - placeholder?: string; - placeholderTextColor?: ColorValue; - cursorColor?: ColorValue; - selectionColor?: ColorValue; - autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters'; - htmlStyle?: HtmlStyle; - style?: ViewStyle | TextStyle; - scrollEnabled?: boolean; - linkRegex?: RegExp | null; - onFocus?: (e: FocusEvent) => void; - onBlur?: (e: BlurEvent) => void; - onChangeText?: (e: NativeSyntheticEvent) => void; - onChangeHtml?: (e: NativeSyntheticEvent) => void; - onChangeState?: (e: NativeSyntheticEvent) => void; - onLinkDetected?: (e: OnLinkDetected) => void; - onMentionDetected?: (e: OnMentionDetected) => void; - onStartMention?: (indicator: string) => void; - onChangeMention?: (e: OnChangeMentionEvent) => void; - onEndMention?: (indicator: string) => void; - onChangeSelection?: (e: NativeSyntheticEvent) => void; - onKeyPress?: (e: NativeSyntheticEvent) => void; - onPasteImages?: (e: NativeSyntheticEvent) => void; - contextMenuItems?: ContextMenuItem[]; - /** - * If true, Android will use experimental synchronous events. - * This will prevent from input flickering when updating component size. - * However, this is an experimental feature, which has not been thoroughly tested. - * We may decide to enable it by default in a future release. - * Disabled by default. - */ - androidExperimentalSynchronousEvents?: boolean; - /** - * If true, external HTML (e.g. from Google Docs, Word, web pages) will be - * normalized through the HTML normalizer before being applied. - * This converts arbitrary HTML into the canonical tag subset that the enriched - * parser understands. - * Disabled by default. - */ - useHtmlNormalizer?: boolean; -} +import type { + ContextMenuItem, + EnrichedTextInputProps, + OnLinkDetected, + OnMentionDetected, +} from './types'; const warnMentionIndicators = (indicator: string) => { console.warn( @@ -406,7 +292,11 @@ export const EnrichedTextInput = ({ ) => { const { text, indicator, payload } = e.nativeEvent; const attributes = JSON.parse(payload) as Record; - onMentionDetected?.({ text, indicator, attributes }); + onMentionDetected?.({ + text, + indicator, + attributes, + } satisfies OnMentionDetected); }; const handleRequestHtmlResult = ( diff --git a/src/index.tsx b/src/index.tsx index 375534f5..bf7e156a 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,4 +1,4 @@ -export * from './EnrichedTextInput'; +export { EnrichedTextInput } from './EnrichedTextInput'; export type { OnChangeTextEvent, OnChangeHtmlEvent, @@ -8,5 +8,12 @@ export type { OnChangeSelectionEvent, OnKeyPressEvent, OnPasteImagesEvent, -} from './spec/EnrichedTextInputNativeComponent'; -export type { HtmlStyle, MentionStyleProperties } from './types'; + HtmlStyle, + MentionStyleProperties, + FocusEvent, + BlurEvent, + EnrichedTextInputInstance, + ContextMenuItem, + OnChangeMentionEvent, + EnrichedTextInputProps, +} from './types'; diff --git a/src/types.ts b/src/types.ts index b7f9591b..f9d4bb89 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,13 @@ -import type { ColorValue, TextStyle } from 'react-native'; +import type { RefObject } from 'react'; +import type { + ColorValue, + NativeMethods, + NativeSyntheticEvent, + TargetedEvent, + TextStyle, + ViewProps, + ViewStyle, +} from 'react-native'; interface HeadingStyle { fontSize?: number; @@ -57,3 +66,209 @@ export interface HtmlStyle { boxColor?: ColorValue; }; } + +// Event types + +export interface OnChangeTextEvent { + value: string; +} + +export interface OnChangeHtmlEvent { + value: string; +} + +export interface OnChangeStateEvent { + bold: { isActive: boolean; isConflicting: boolean; isBlocking: boolean }; + italic: { isActive: boolean; isConflicting: boolean; isBlocking: boolean }; + underline: { isActive: boolean; isConflicting: boolean; isBlocking: boolean }; + strikeThrough: { + isActive: boolean; + isConflicting: boolean; + isBlocking: boolean; + }; + inlineCode: { + isActive: boolean; + isConflicting: boolean; + isBlocking: boolean; + }; + h1: { isActive: boolean; isConflicting: boolean; isBlocking: boolean }; + h2: { isActive: boolean; isConflicting: boolean; isBlocking: boolean }; + h3: { isActive: boolean; isConflicting: boolean; isBlocking: boolean }; + h4: { isActive: boolean; isConflicting: boolean; isBlocking: boolean }; + h5: { isActive: boolean; isConflicting: boolean; isBlocking: boolean }; + h6: { isActive: boolean; isConflicting: boolean; isBlocking: boolean }; + codeBlock: { isActive: boolean; isConflicting: boolean; isBlocking: boolean }; + blockQuote: { + isActive: boolean; + isConflicting: boolean; + isBlocking: boolean; + }; + orderedList: { + isActive: boolean; + isConflicting: boolean; + isBlocking: boolean; + }; + unorderedList: { + isActive: boolean; + isConflicting: boolean; + isBlocking: boolean; + }; + link: { isActive: boolean; isConflicting: boolean; isBlocking: boolean }; + image: { isActive: boolean; isConflicting: boolean; isBlocking: boolean }; + mention: { isActive: boolean; isConflicting: boolean; isBlocking: boolean }; + checkboxList: { + isActive: boolean; + isConflicting: boolean; + isBlocking: boolean; + }; +} + +export interface OnLinkDetected { + text: string; + url: string; + start: number; + end: number; +} + +export interface OnMentionDetected { + text: string; + indicator: string; + attributes: Record; +} + +export interface OnChangeSelectionEvent { + start: number; + end: number; + text: string; +} + +export interface OnKeyPressEvent { + key: string; +} + +export interface OnPasteImagesEvent { + images: { + uri: string; + type: string; + width: number; + height: number; + }[]; +} + +// Component types + +export type FocusEvent = NativeSyntheticEvent; +export type BlurEvent = NativeSyntheticEvent; + +export interface EnrichedTextInputInstance extends NativeMethods { + // General commands + focus: () => void; + blur: () => void; + setValue: (value: string) => void; + setSelection: (start: number, end: number) => void; + getHTML: () => Promise; + + // Text formatting commands + toggleBold: () => void; + toggleItalic: () => void; + toggleUnderline: () => void; + toggleStrikeThrough: () => void; + toggleInlineCode: () => void; + toggleH1: () => void; + toggleH2: () => void; + toggleH3: () => void; + toggleH4: () => void; + toggleH5: () => void; + toggleH6: () => void; + toggleCodeBlock: () => void; + toggleBlockQuote: () => void; + toggleOrderedList: () => void; + toggleUnorderedList: () => void; + toggleCheckboxList: (checked: boolean) => void; + setLink: (start: number, end: number, text: string, url: string) => void; + removeLink: (start: number, end: number) => void; + setImage: (src: string, width: number, height: number) => void; + startMention: (indicator: string) => void; + setMention: ( + indicator: string, + text: string, + attributes?: Record + ) => void; +} + +export interface ContextMenuItem { + text: string; + onPress: ({ + text, + selection, + styleState, + }: { + text: string; + selection: { start: number; end: number }; + styleState: OnChangeStateEvent; + }) => void; + visible?: boolean; +} + +export interface OnChangeMentionEvent { + indicator: string; + text: string; +} + +// Base props shared between native and web — not part of the public API, +// only used to derive platform-specific EnrichedTextInputProps subtypes. +export interface BaseEnrichedTextInputProps { + ref?: RefObject; + autoFocus?: boolean; + editable?: boolean; + mentionIndicators?: string[]; + defaultValue?: string; + placeholder?: string; + placeholderTextColor?: ColorValue; + cursorColor?: ColorValue; + selectionColor?: ColorValue; + autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters'; + htmlStyle?: HtmlStyle; + scrollEnabled?: boolean; + linkRegex?: RegExp | null; + onFocus?: (e: FocusEvent) => void; + onBlur?: (e: BlurEvent) => void; + onChangeText?: (e: NativeSyntheticEvent) => void; + onChangeHtml?: (e: NativeSyntheticEvent) => void; + onChangeState?: (e: NativeSyntheticEvent) => void; + onLinkDetected?: (e: OnLinkDetected) => void; + onMentionDetected?: (e: OnMentionDetected) => void; + onStartMention?: (indicator: string) => void; + onChangeMention?: (e: OnChangeMentionEvent) => void; + onEndMention?: (indicator: string) => void; + onChangeSelection?: (e: NativeSyntheticEvent) => void; + onKeyPress?: (e: NativeSyntheticEvent) => void; + onPasteImages?: (e: NativeSyntheticEvent) => void; + contextMenuItems?: ContextMenuItem[]; + /** + * If true, Android will use experimental synchronous events. + * This will prevent from input flickering when updating component size. + * However, this is an experimental feature, which has not been thoroughly tested. + * We may decide to enable it by default in a future release. + * Disabled by default. + */ + androidExperimentalSynchronousEvents?: boolean; + /** + * If true, external HTML (e.g. from Google Docs, Word, web pages) will be + * normalized through the HTML normalizer before being applied. + * This converts arbitrary HTML into the canonical tag subset that the enriched + * parser understands. + * Disabled by default. + */ + useHtmlNormalizer?: boolean; +} + +// Native-specific props — extends base with ViewProps and native style type. +// onFocus and onBlur are omitted from ViewProps because ViewProps types them via +// DirectEventHandler (which includes null) — we re-declare them via BaseEnrichedTextInputProps +// with the narrower handler signature instead. +export interface EnrichedTextInputProps + extends Omit, + BaseEnrichedTextInputProps { + style?: ViewStyle | TextStyle; +} From e63ea539f981f22e27f6d955b173ccbc3eafc255 Mon Sep 17 00:00:00 2001 From: Piotr Karamon Date: Wed, 18 Mar 2026 14:38:28 +0100 Subject: [PATCH 02/12] feat(web): add web entry point and web stub component --- src/index.web.tsx | 19 +++++++++++++ src/web/EnrichedTextInput.tsx | 52 +++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 src/index.web.tsx create mode 100644 src/web/EnrichedTextInput.tsx diff --git a/src/index.web.tsx b/src/index.web.tsx new file mode 100644 index 00000000..e5d6ad23 --- /dev/null +++ b/src/index.web.tsx @@ -0,0 +1,19 @@ +export { EnrichedTextInput } from './web/EnrichedTextInput'; +export type { + OnChangeTextEvent, + OnChangeHtmlEvent, + OnChangeStateEvent, + OnLinkDetected, + OnMentionDetected, + OnChangeSelectionEvent, + OnKeyPressEvent, + OnPasteImagesEvent, + HtmlStyle, + MentionStyleProperties, + FocusEvent, + BlurEvent, + EnrichedTextInputInstance, + ContextMenuItem, + OnChangeMentionEvent, + EnrichedTextInputProps, +} from './types'; diff --git a/src/web/EnrichedTextInput.tsx b/src/web/EnrichedTextInput.tsx new file mode 100644 index 00000000..dad51436 --- /dev/null +++ b/src/web/EnrichedTextInput.tsx @@ -0,0 +1,52 @@ +import { useImperativeHandle } from 'react'; +import type { ViewStyle, TextStyle } from 'react-native'; +import type { + BaseEnrichedTextInputProps, + EnrichedTextInputInstance, +} from '../types'; + +// Web-specific props — extends the shared base. style will diverge from the +// native variant in the future (e.g. CSSProperties vs ViewStyle/TextStyle). +export interface EnrichedTextInputProps extends BaseEnrichedTextInputProps { + style?: ViewStyle | TextStyle; +} + +export const EnrichedTextInput = ({ ref }: EnrichedTextInputProps) => { + useImperativeHandle( + ref, + (): EnrichedTextInputInstance => ({ + focus: () => {}, + blur: () => {}, + setValue: () => {}, + setSelection: () => {}, + getHTML: () => Promise.resolve(''), + toggleBold: () => {}, + toggleItalic: () => {}, + toggleUnderline: () => {}, + toggleStrikeThrough: () => {}, + toggleInlineCode: () => {}, + toggleH1: () => {}, + toggleH2: () => {}, + toggleH3: () => {}, + toggleH4: () => {}, + toggleH5: () => {}, + toggleH6: () => {}, + toggleCodeBlock: () => {}, + toggleBlockQuote: () => {}, + toggleOrderedList: () => {}, + toggleUnorderedList: () => {}, + toggleCheckboxList: () => {}, + setLink: () => {}, + removeLink: () => {}, + setImage: () => {}, + startMention: () => {}, + setMention: () => {}, + measure: () => {}, + measureInWindow: () => {}, + measureLayout: () => {}, + setNativeProps: () => {}, + }) + ); + + return
; +}; From a464b2a3826a4d490b7b807aef6197aa1bf5491d Mon Sep 17 00:00:00 2001 From: Piotr Karamon Date: Wed, 18 Mar 2026 14:40:28 +0100 Subject: [PATCH 03/12] chore: exclude web files from npm package, configure example-web --- apps/example-web/tsconfig.app.json | 4 ++++ apps/example-web/vite.config.ts | 9 +++++++++ package.json | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/apps/example-web/tsconfig.app.json b/apps/example-web/tsconfig.app.json index 69011488..46985725 100644 --- a/apps/example-web/tsconfig.app.json +++ b/apps/example-web/tsconfig.app.json @@ -3,6 +3,10 @@ "compilerOptions": { "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "types": ["vite/client"], + "baseUrl": ".", + "paths": { + "react-native-enriched": ["../../src/index.web.tsx"] + } }, "include": ["src"] } diff --git a/apps/example-web/vite.config.ts b/apps/example-web/vite.config.ts index 4a5def4c..9dc8e4da 100644 --- a/apps/example-web/vite.config.ts +++ b/apps/example-web/vite.config.ts @@ -1,7 +1,16 @@ +import path from 'node:path'; import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; // https://vite.dev/config/ export default defineConfig({ plugins: [react()], + resolve: { + alias: { + 'react-native-enriched': path.resolve( + __dirname, + '../../src/index.web.tsx' + ), + }, + }, }); diff --git a/package.json b/package.json index 25bd3844..346a1961 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,14 @@ "cpp", "*.podspec", "react-native.config.js", + "!src/web", + "!src/index.web.tsx", + "!lib/module/web", + "!lib/module/index.web.js", + "!lib/module/index.web.js.map", + "!lib/typescript/src/web", + "!lib/typescript/src/index.web.d.ts", + "!lib/typescript/src/index.web.d.ts.map", "!ios/build", "!android/build", "!android/gradle", From ab9c9d0c56fc0276a4026e170362fe5f7544d7ff Mon Sep 17 00:00:00 2001 From: Piotr Karamon Date: Wed, 18 Mar 2026 14:50:48 +0100 Subject: [PATCH 04/12] refactor: move native component to src/native, split EnrichedTextInputProps per platform --- src/index.tsx | 4 ++-- src/index.web.tsx | 2 +- src/{ => native}/EnrichedTextInput.tsx | 14 ++++++++------ src/types.ts | 14 ++------------ src/web/EnrichedTextInput.tsx | 7 +------ 5 files changed, 14 insertions(+), 27 deletions(-) rename src/{ => native}/EnrichedTextInput.tsx (96%) diff --git a/src/index.tsx b/src/index.tsx index bf7e156a..3e6f2a6f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,4 +1,5 @@ -export { EnrichedTextInput } from './EnrichedTextInput'; +export { EnrichedTextInput } from './native/EnrichedTextInput'; +export type { EnrichedTextInputProps } from './native/EnrichedTextInput'; export type { OnChangeTextEvent, OnChangeHtmlEvent, @@ -15,5 +16,4 @@ export type { EnrichedTextInputInstance, ContextMenuItem, OnChangeMentionEvent, - EnrichedTextInputProps, } from './types'; diff --git a/src/index.web.tsx b/src/index.web.tsx index e5d6ad23..680a0328 100644 --- a/src/index.web.tsx +++ b/src/index.web.tsx @@ -1,4 +1,5 @@ export { EnrichedTextInput } from './web/EnrichedTextInput'; +export type { EnrichedTextInputProps } from './web/EnrichedTextInput'; export type { OnChangeTextEvent, OnChangeHtmlEvent, @@ -15,5 +16,4 @@ export type { EnrichedTextInputInstance, ContextMenuItem, OnChangeMentionEvent, - EnrichedTextInputProps, } from './types'; diff --git a/src/EnrichedTextInput.tsx b/src/native/EnrichedTextInput.tsx similarity index 96% rename from src/EnrichedTextInput.tsx rename to src/native/EnrichedTextInput.tsx index d804ff1a..5992e352 100644 --- a/src/EnrichedTextInput.tsx +++ b/src/native/EnrichedTextInput.tsx @@ -13,7 +13,7 @@ import EnrichedTextInputNativeComponent, { type OnMentionEvent, type OnMentionDetectedInternal, type OnRequestHtmlResultEvent, -} from './spec/EnrichedTextInputNativeComponent'; +} from '../spec/EnrichedTextInputNativeComponent'; import type { HostInstance, MeasureInWindowOnSuccessCallback, @@ -22,15 +22,17 @@ import type { NativeMethods, NativeSyntheticEvent, } from 'react-native'; -import { normalizeHtmlStyle } from './utils/normalizeHtmlStyle'; -import { toNativeRegexConfig } from './utils/regexParser'; -import { nullthrows } from './utils/nullthrows'; +import { normalizeHtmlStyle } from '../utils/normalizeHtmlStyle'; +import { toNativeRegexConfig } from '../utils/regexParser'; +import { nullthrows } from '../utils/nullthrows'; import type { + BaseEnrichedTextInputProps, ContextMenuItem, - EnrichedTextInputProps, OnLinkDetected, OnMentionDetected, -} from './types'; +} from '../types'; + +export interface EnrichedTextInputProps extends BaseEnrichedTextInputProps {} const warnMentionIndicators = (indicator: string) => { console.warn( diff --git a/src/types.ts b/src/types.ts index f9d4bb89..2c4bdfa2 100644 --- a/src/types.ts +++ b/src/types.ts @@ -215,9 +215,8 @@ export interface OnChangeMentionEvent { text: string; } -// Base props shared between native and web — not part of the public API, -// only used to derive platform-specific EnrichedTextInputProps subtypes. -export interface BaseEnrichedTextInputProps { +export interface BaseEnrichedTextInputProps + extends Omit { ref?: RefObject; autoFocus?: boolean; editable?: boolean; @@ -261,14 +260,5 @@ export interface BaseEnrichedTextInputProps { * Disabled by default. */ useHtmlNormalizer?: boolean; -} - -// Native-specific props — extends base with ViewProps and native style type. -// onFocus and onBlur are omitted from ViewProps because ViewProps types them via -// DirectEventHandler (which includes null) — we re-declare them via BaseEnrichedTextInputProps -// with the narrower handler signature instead. -export interface EnrichedTextInputProps - extends Omit, - BaseEnrichedTextInputProps { style?: ViewStyle | TextStyle; } diff --git a/src/web/EnrichedTextInput.tsx b/src/web/EnrichedTextInput.tsx index dad51436..a98be6ff 100644 --- a/src/web/EnrichedTextInput.tsx +++ b/src/web/EnrichedTextInput.tsx @@ -1,15 +1,10 @@ import { useImperativeHandle } from 'react'; -import type { ViewStyle, TextStyle } from 'react-native'; import type { BaseEnrichedTextInputProps, EnrichedTextInputInstance, } from '../types'; -// Web-specific props — extends the shared base. style will diverge from the -// native variant in the future (e.g. CSSProperties vs ViewStyle/TextStyle). -export interface EnrichedTextInputProps extends BaseEnrichedTextInputProps { - style?: ViewStyle | TextStyle; -} +export interface EnrichedTextInputProps extends BaseEnrichedTextInputProps {} export const EnrichedTextInput = ({ ref }: EnrichedTextInputProps) => { useImperativeHandle( From c9d4f52343cdf8d7d4eeab3e9f52720924d57878 Mon Sep 17 00:00:00 2001 From: Piotr Karamon Date: Wed, 18 Mar 2026 15:01:29 +0100 Subject: [PATCH 05/12] chore: use EnrichedTextInput in example-web app --- apps/example-web/src/App.tsx | 4 ++-- src/web/EnrichedTextInput.tsx | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/example-web/src/App.tsx b/apps/example-web/src/App.tsx index b6fa757c..005cd180 100644 --- a/apps/example-web/src/App.tsx +++ b/apps/example-web/src/App.tsx @@ -1,10 +1,10 @@ import './App.css'; +import { EnrichedTextInput } from 'react-native-enriched'; function App() { return (
-
Text input
- +
); } diff --git a/src/web/EnrichedTextInput.tsx b/src/web/EnrichedTextInput.tsx index a98be6ff..1811627a 100644 --- a/src/web/EnrichedTextInput.tsx +++ b/src/web/EnrichedTextInput.tsx @@ -6,7 +6,10 @@ import type { export interface EnrichedTextInputProps extends BaseEnrichedTextInputProps {} -export const EnrichedTextInput = ({ ref }: EnrichedTextInputProps) => { +export const EnrichedTextInput = ({ + ref, + defaultValue, +}: EnrichedTextInputProps) => { useImperativeHandle( ref, (): EnrichedTextInputInstance => ({ @@ -43,5 +46,5 @@ export const EnrichedTextInput = ({ ref }: EnrichedTextInputProps) => { }) ); - return
; + return