Skip to content

Commit 00f5edd

Browse files
authored
Merge pull request #55509 from software-mansion-labs/@Skalakid/bump-react-native-live-markdown-0.1.221
Bump react-native-live-markdown version to 0.1.221
2 parents 28cb413 + ac5a13f commit 00f5edd

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

package-lock.json

+4-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
},
7777
"dependencies": {
7878
"@dotlottie/react-player": "^1.6.3",
79-
"@expensify/react-native-live-markdown": "0.1.210",
79+
"@expensify/react-native-live-markdown": "0.1.221",
8080
"@expensify/react-native-background-task": "file:./modules/background-task",
8181
"@expo/metro-runtime": "^4.0.0",
8282
"@firebase/app": "^0.10.10",

src/components/RNMarkdownTextInput.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ type AnimatedMarkdownTextInputRef = typeof AnimatedMarkdownTextInput & MarkdownT
1313

1414
type RNMarkdownTextInputProps = Omit<MarkdownTextInputProps, 'parser'>;
1515

16+
function handleFormatSelection(selectedText: string, formatCommand: string) {
17+
switch (formatCommand) {
18+
case 'formatBold':
19+
return `*${selectedText}*`;
20+
case 'formatItalic':
21+
return `_${selectedText}_`;
22+
default:
23+
return selectedText;
24+
}
25+
}
26+
1627
function RNMarkdownTextInputWithRef({maxLength, ...props}: RNMarkdownTextInputProps, ref: ForwardedRef<AnimatedMarkdownTextInputRef>) {
1728
const theme = useTheme();
1829

@@ -28,6 +39,7 @@ function RNMarkdownTextInputWithRef({maxLength, ...props}: RNMarkdownTextInputPr
2839
}
2940
ref(refHandle as AnimatedMarkdownTextInputRef);
3041
}}
42+
formatSelection={handleFormatSelection}
3143
// eslint-disable-next-line
3244
{...props}
3345
/**

0 commit comments

Comments
 (0)