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
3 changes: 2 additions & 1 deletion apps/example-web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import './App.css';
import { EnrichedTextInput } from 'react-native-enriched';

function App() {
return (
<div className="container">
<div>Text input</div>
<input type="text" placeholder="Type something..." />
<EnrichedTextInput />
</div>
);
}
Expand Down
5 changes: 4 additions & 1 deletion apps/example-web/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"types": ["vite/client"],
"paths": {
"react-native-enriched": ["../../src/index"]
}
},
"include": ["src"]
}
5 changes: 4 additions & 1 deletion apps/example-web/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"lib": ["ES2023"],
"types": ["node"],
"paths": {
"react-native-enriched": ["../../src/index"]
}
},
"include": ["vite.config.ts"]
}
6 changes: 6 additions & 0 deletions apps/example-web/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';

// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'react-native-enriched': path.resolve(__dirname, '../../src/index.tsx'),
},
},
});
8 changes: 8 additions & 0 deletions apps/example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"paths": {
"react-native-enriched": ["../../src/index.native"]
}
}
}
2 changes: 1 addition & 1 deletion lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pre-commit:

types:
glob: "*.{js,ts, jsx, tsx}"
run: npx tsc
run: yarn typecheck:all

lint-android:
glob: "**/*.{kt,kts,java,gradle}"
Expand Down
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
"name": "react-native-enriched",
"version": "0.3.0",
"description": "Rich Text Editor component for React Native",
"source": "./src/index.tsx",
"main": "./lib/module/index.js",
"module": "./lib/module/index.js",
"types": "./lib/typescript/src/index.d.ts",
"react-native": "./lib/module/index.native.js",
"sideEffects": false,
"exports": {
".": {
"react-native": {
"types": "./lib/typescript/src/index.native.d.ts",
"default": "./lib/module/index.native.js"
},
"types": "./lib/typescript/src/index.d.ts",
"default": "./lib/module/index.js"
},
Expand Down Expand Up @@ -35,7 +41,10 @@
"example": "yarn workspace react-native-enriched-example",
"example-web": "yarn workspace react-native-enriched-web-example",
"test": "jest --passWithNoTests",
"typecheck": "tsc",
"typecheck": "tsc -p tsconfig.build.json",
"typecheck:example": "tsc -p apps/example/tsconfig.json",
"typecheck:example-web": "tsc -p apps/example-web/tsconfig.json",
"typecheck:all": "yarn typecheck && yarn typecheck:example && yarn typecheck:example-web",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"lint:android": "cd apps/example/android && ./gradlew lintVerify",
"lint:android:fix": "cd apps/example/android && ./gradlew lintFormat",
Expand Down
11 changes: 11 additions & 0 deletions src/index.native.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export * from './native/EnrichedTextInput';
export type {
OnChangeTextEvent,
OnChangeHtmlEvent,
OnChangeStateEvent,
OnChangeStateDeprecatedEvent,
OnLinkDetected,
OnMentionDetected,
OnChangeSelectionEvent,
OnKeyPressEvent,
} from './spec/EnrichedTextInputNativeComponent';
12 changes: 1 addition & 11 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
export * from './EnrichedTextInput';
export type {
OnChangeTextEvent,
OnChangeHtmlEvent,
OnChangeStateEvent,
OnChangeStateDeprecatedEvent,
OnLinkDetected,
OnMentionDetected,
OnChangeSelectionEvent,
OnKeyPressEvent,
} from './spec/EnrichedTextInputNativeComponent';
export * from './web/EnrichedTextInput';
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import EnrichedTextInputNativeComponent, {
type MentionStyleProperties,
type OnChangeStateDeprecatedEvent,
type OnKeyPressEvent,
} from './spec/EnrichedTextInputNativeComponent';
} from '../spec/EnrichedTextInputNativeComponent';
import type {
ColorValue,
HostInstance,
Expand All @@ -34,8 +34,8 @@ import type {
ViewProps,
ViewStyle,
} from 'react-native';
import { normalizeHtmlStyle } from './utils/normalizeHtmlStyle';
import { toNativeRegexConfig } from './utils/regexParser';
import { normalizeHtmlStyle } from '../utils/normalizeHtmlStyle';
import { toNativeRegexConfig } from '../utils/regexParser';

export interface EnrichedTextInputInstance extends NativeMethods {
// General commands
Expand Down
2 changes: 1 addition & 1 deletion src/utils/normalizeHtmlStyle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { HtmlStyle } from '../EnrichedTextInput';
import type { HtmlStyle } from '../native/EnrichedTextInput';
import { type ColorValue, processColor } from 'react-native';
import type {
MentionStyleProperties,
Expand Down
3 changes: 3 additions & 0 deletions src/web/EnrichedTextInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const EnrichedTextInput = () => {
return <input type="text" placeholder="Type something..." />;
};
24 changes: 21 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,26 @@
"extends": "./tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"paths": {
"react-native-enriched": ["./src/index"]
}
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react-jsx",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "bundler",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noImplicitUseStrict": false,
"noStrictGenericChecks": false,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ESNext",
"verbatimModuleSyntax": true
}
}
Loading