Skip to content

Commit

Permalink
Merge branch 'main' into @tomekzaw/NSTextStorageDelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekzaw committed Dec 12, 2024
2 parents a3e9169 + 4976b59 commit 1fb4a00
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ npm install @expensify/react-native-live-markdown react-native-reanimated expens
npx expo install @expensify/react-native-live-markdown react-native-reanimated expensify-common
```

React Native Live Markdown requires [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated) 3.16.3 or newer and [expensify-common](https://github.com/Expensify/expensify-common) 2.0.108 or newer.
React Native Live Markdown requires [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated) 3.16.4 or newer and [expensify-common](https://github.com/Expensify/expensify-common) 2.0.108 or newer.

Then, install the iOS dependencies with CocoaPods:

Expand Down
24 changes: 12 additions & 12 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ PODS:
- React-logger (= 0.75.3)
- React-perflogger (= 0.75.3)
- React-utils (= 0.75.3)
- RNLiveMarkdown (0.1.205):
- RNLiveMarkdown (0.1.208):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1517,10 +1517,10 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNLiveMarkdown/newarch (= 0.1.205)
- RNLiveMarkdown/newarch (= 0.1.208)
- RNReanimated/worklets
- Yoga
- RNLiveMarkdown/newarch (0.1.205):
- RNLiveMarkdown/newarch (0.1.208):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1542,7 +1542,7 @@ PODS:
- ReactCommon/turbomodule/core
- RNReanimated/worklets
- Yoga
- RNReanimated (3.16.3):
- RNReanimated (3.16.4):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1562,10 +1562,10 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNReanimated/reanimated (= 3.16.3)
- RNReanimated/worklets (= 3.16.3)
- RNReanimated/reanimated (= 3.16.4)
- RNReanimated/worklets (= 3.16.4)
- Yoga
- RNReanimated/reanimated (3.16.3):
- RNReanimated/reanimated (3.16.4):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1585,9 +1585,9 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNReanimated/reanimated/apple (= 3.16.3)
- RNReanimated/reanimated/apple (= 3.16.4)
- Yoga
- RNReanimated/reanimated/apple (3.16.3):
- RNReanimated/reanimated/apple (3.16.4):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1608,7 +1608,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNReanimated/worklets (3.16.3):
- RNReanimated/worklets (3.16.4):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1897,8 +1897,8 @@ SPEC CHECKSUMS:
React-utils: f2afa6acd905ca2ce7bb8ffb4a22f7f8a12534e8
ReactCodegen: e35c23cdd36922f6d2990c6c1f1b022ade7ad74d
ReactCommon: 289214026502e6a93484f4a46bcc0efa4f3f2864
RNLiveMarkdown: bf0f16b1e8c3320d600a5931d270e19afef9fa92
RNReanimated: ab6c33a61e90c4cbe5dbcbe65bd6c7cb3be167e6
RNLiveMarkdown: e8b7f5cf8a0e8027850a781ffc86119e21fb406a
RNReanimated: 75df06d3a81fc147b83056ae469512f573365b1d
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: 1354c027ab07c7736f99a3bef16172d6f1b12b47

Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"expensify-common": "2.0.108",
"react": "18.3.1",
"react-native": "0.75.3",
"react-native-reanimated": "3.16.3"
"react-native-reanimated": "3.16.4"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down
14 changes: 14 additions & 0 deletions mock/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {MarkdownTextInput} from '../src';
import type {parseExpensiMark} from '../src';

global.jsi_setMarkdownRuntime = jest.fn();
global.jsi_registerMarkdownWorklet = jest.fn();
global.jsi_unregisterMarkdownWorklet = jest.fn();

const parseExpensiMarkMock: typeof parseExpensiMark = () => {
'worklet';

return [];
};

export {MarkdownTextInput, parseExpensiMarkMock as parseExpensiMark};
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@expensify/react-native-live-markdown",
"version": "0.1.205",
"version": "0.1.208",
"description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand All @@ -10,6 +10,7 @@
"files": [
"src",
"lib",
"mock",
"android",
"apple",
"cpp",
Expand Down Expand Up @@ -93,7 +94,7 @@
"react": "18.3.1",
"react-native": "0.75.3",
"react-native-builder-bob": "^0.20.0",
"react-native-reanimated": "3.16.3",
"react-native-reanimated": "3.16.4",
"react-native-web": "^0.19.10",
"release-it": "^15.0.0",
"turbo": "^1.10.7",
Expand All @@ -103,7 +104,7 @@
"expensify-common": ">=2.0.108",
"react": "*",
"react-native": "*",
"react-native-reanimated": ">=3.16.3"
"react-native-reanimated": ">=3.16.4"
},
"workspaces": [
"./example",
Expand Down
5 changes: 2 additions & 3 deletions src/MarkdownTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ function initializeLiveMarkdownIfNeeded() {
if (initialized) {
return;
}
if (!NativeLiveMarkdownModule) {
throw new Error('[react-native-live-markdown] NativeLiveMarkdownModule is not available');
if (NativeLiveMarkdownModule) {
NativeLiveMarkdownModule.install();
}
NativeLiveMarkdownModule.install();
if (!global.jsi_setMarkdownRuntime) {
throw new Error('[react-native-live-markdown] global.jsi_setMarkdownRuntime is not available');
}
Expand Down
2 changes: 1 addition & 1 deletion src/parseExpensiMark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function parseTreeToTextAndRanges(tree: StackItem): [string, MarkdownRange[]] {
text += '\n';
} else if (node.tag.startsWith('<pre')) {
appendSyntax('```');
const content = node.children.join('').replaceAll('&#32;', ' ');
const content = node.children.join('');
addChildrenWithStyle(content, 'pre');
appendSyntax('```');
} else if (node.tag.startsWith('<a href="')) {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"verbatimModuleSyntax": true,
"typeRoots": ["node_modules/@types"]
},
"include": ["src/**/*"],
"include": ["src/**/*", "mock/**/*"],
"exclude": ["**/node_modules/**/*", "**/lib/**/*", "example/src/**/*", "WebExample/**/*"]
}

0 comments on commit 1fb4a00

Please sign in to comment.