Skip to content

Commit

Permalink
Fix flickering and missing formatting when toggling multiline prop
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekzaw committed Nov 20, 2024
1 parent 7b475de commit 1c432fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {PlatformInfo} from './PlatformInfo';

export default function App() {
const [value, setValue] = React.useState(TEST_CONST.EXAMPLE_CONTENT);
const [multiline, setMultiline] = React.useState(true);
const [textColorState, setTextColorState] = React.useState(false);
const [linkColorState, setLinkColorState] = React.useState(false);
const [textFontSizeState, setTextFontSizeState] = React.useState(false);
Expand Down Expand Up @@ -36,7 +37,7 @@ export default function App() {
<View style={styles.container}>
<PlatformInfo />
<MarkdownTextInput
multiline
multiline={multiline}
autoCapitalize="none"
value={value}
onChangeText={setValue}
Expand Down Expand Up @@ -89,6 +90,10 @@ export default function App() {
setValue('');
}}
/>
<Button
title="Toggle multiline"
onPress={() => setMultiline(prev => !prev)}
/>
<Button
title="Toggle text color"
onPress={() => setTextColorState(prev => !prev)}
Expand Down
1 change: 1 addition & 0 deletions src/MarkdownTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
<MarkdownTextInputDecoratorViewNativeComponent
style={IS_FABRIC ? styles.farAway : styles.displayNone}
markdownStyle={markdownStyle}
key={String(props.multiline)} // force remount on multiline change
/>
</>
);
Expand Down

0 comments on commit 1c432fe

Please sign in to comment.