Skip to content

Commit

Permalink
Throw error when html-entities is not workletized
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekzaw committed Dec 10, 2024
1 parent c35696d commit 484f578
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 4 additions & 4 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.199):
- RNLiveMarkdown (0.1.203):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1517,10 +1517,10 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNLiveMarkdown/newarch (= 0.1.199)
- RNLiveMarkdown/newarch (= 0.1.203)
- RNReanimated/worklets
- Yoga
- RNLiveMarkdown/newarch (0.1.199):
- RNLiveMarkdown/newarch (0.1.203):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1897,7 +1897,7 @@ SPEC CHECKSUMS:
React-utils: f2afa6acd905ca2ce7bb8ffb4a22f7f8a12534e8
ReactCodegen: e35c23cdd36922f6d2990c6c1f1b022ade7ad74d
ReactCommon: 289214026502e6a93484f4a46bcc0efa4f3f2864
RNLiveMarkdown: 18dd4ceada29d66a6b7c29b1b0df589e2fc82183
RNLiveMarkdown: ed779eaf35a346f5254079b825a13f0a032ba64a
RNReanimated: ab6c33a61e90c4cbe5dbcbe65bd6c7cb3be167e6
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: 1354c027ab07c7736f99a3bef16172d6f1b12b47
Expand Down
9 changes: 9 additions & 0 deletions src/parseExpensiMark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

import {ExpensiMark} from 'expensify-common';
import {unescapeText} from 'expensify-common/dist/utils';
import {decode} from 'html-entities';
import type {WorkletFunction} from 'react-native-reanimated/lib/typescript/commonTypes';
import type {MarkdownType, MarkdownRange} from './commonTypes';

// eslint-disable-next-line no-underscore-dangle
if (__DEV__ && (decode as WorkletFunction).__workletHash === undefined) {
throw new Error(
"[react-native-live-markdown] `parseExpensiMark` requires `html-entities` package to be workletized. Please add `'worklet';` directive at the top of `node_modules/html-entities/lib/index.js` using patch-package.",
);
}

const MAX_PARSABLE_LENGTH = 4000;

type Token = ['TEXT' | 'HTML', string];
Expand Down

0 comments on commit 484f578

Please sign in to comment.