-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: IOU - one character descriptions are not saved #343
Changes from 1 commit
423e963
2d35243
712bc33
802ed5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -62,6 +62,7 @@ interface MarkdownTextInputProps extends TextInputProps { | |||||
|
||||||
interface MarkdownNativeEvent extends Event { | ||||||
inputType: string; | ||||||
data: string; | ||||||
} | ||||||
|
||||||
type Selection = { | ||||||
|
@@ -337,14 +338,14 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>( | |||||
} | ||||||
const changedText = e.target.innerText; | ||||||
|
||||||
if (compositionRef.current) { | ||||||
updateTextColor(divRef.current, changedText); | ||||||
const nativeEvent = e.nativeEvent as MarkdownNativeEvent; | ||||||
if (compositionRef.current && (nativeEvent.inputType !== 'insertCompositionText' || nativeEvent.data !== '*')) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we return early if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have reviewed my proposal again, and I apologize for modifying the wrong code while handling conflicting situations. The condition here is that it only early returns if the composite and type are insertCompositionText, and it is not ** to bold. |
||||||
updateTextColor(divRef.current, e.target.innerText); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have removed the change introduced by this PR.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sobitneupane i copy the builded into App/node_modules/@expensify/react-native-live-markdown/lib/commonjs/MarkdownTextInput.web.jsMarkdownTextInput.web.js. and the test step
|
||||||
compositionRef.current = false; | ||||||
return; | ||||||
} | ||||||
|
||||||
let text = ''; | ||||||
const nativeEvent = e.nativeEvent as MarkdownNativeEvent; | ||||||
switch (nativeEvent.inputType) { | ||||||
case 'historyUndo': | ||||||
text = undo(divRef.current); | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt it will function properly if the single character entered is
*
hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when it's just a single character '*', the previous condition
composition.current
is false.