Repository navigation
Move Str methods that other Str methods call to module-level functions - #952
Merged
mountiny merged 1 commit intoOct 6, 2026
Conversation
…tions and call them directly
|
All contributors have signed the CLA ✍️ ✅ |
war-in
approved these changes
Oct 6, 2026
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
mountiny
approved these changes
Oct 6, 2026
mountiny
left a comment
Contributor
There was a problem hiding this comment.
LGTM, I will move this ahead as we need this to be merged before continuing with prs required for expo and react native upgrades
Merged
43 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
react-native-worklets 0.13 removed Worklet Context Objects (software-mansion/react-native-reanimated#10411). In App without Bundle Mode (our default Re.Pack builds),
thisinsideStrmethods no longer points toStron the LiveMarkdownRuntime. As a result, typing a link in the composer crashes inStr.sanitizeURL→this.cutBefore.This PR moves the
Strmethods that otherStrmethods call to module-level functions inlib/str.tsand calls them directly instead of throughthis:compare,caseInsensitiveCompare,contains,cutAfter,cutBefore,extractEmailDomain,getExtension,getRawByteSize,htmlDecode,htmlEncode,isTypeOf,isNumber,isString,isUndefined,isValidE164Phone,isValidEmail,maskFirstNCharacters,removeSMSDomain,removeTrailingComma,startsWithEvery one of them is still exposed on
Strunder the same name with the same JSDoc, so the publicStrAPI and behavior are unchanged. There are nothis.references left inlib/str.ts.This is the upstream version of the
expensify-commonpatch added in Expensify/App#102266 (the reanimated 4.7.0 / worklets 0.13.0 upgrade). Once this is released and App bumpsexpensify-common, that patch can be removed.Fixed Issues
$ Expensify/App#101440
Tests
__tests__/Str-test.jscovers theStrmethods, and theExpensiMarktests exerciseStrindirectly.npx tsc --noEmit,npx eslint lib/str.ts,npm run buildandnpx jest: no type or lint errors, and all 569 tests pass.QA
*bold* _italic_ ~strike~ `code` @here https://expensify.com. Verify the formatting is applied live and that typing the link does not crash. Repeat on web.