conorhastings / conorhastings/react-native-syntax-highlighter
Cursor disappear when using TextInput
- Dominant language
- JavaScript
- Stars
- 184
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
When using a TextInput element the cursor disappears when inside color Text.
The cursor only appears when it's at the end of the line.
this is my code:
```jsx
const Editor = ({ initValue, style, onChange = () => {} }: EditorProps) => {
const [value, setValue] = useState(initValue);
const changeHandler = (text: string) => {
setValue(text);
onChange(text);
};
const ast = parse(value);
const headers: HeaderNode[] = ast.filter(isHeaderNode);
console.log(JSON.stringify(ast, null, 4));
return (
{ast.map((node, index) => {
const style = styles[node.type];
if (node.type !== 'link') {
const { content } = node;
const key = `${index}-${content}`;
if (node.type === 'code') {
const { language } = node;
if (!language) {
return (
```{ content }{'\n'}```
);
} else {
return (
```{language}
{ content }
```
);
}
}
return (
{ content }
);
}
})}
);
};
```

Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the provided Editor example, focusing on the TextInput that renders nested Text and SyntaxHighlighter content. Trace how the rendered content affects cursor placement; done means the cursor remains visible when positioned inside the text, not only at the end.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- frontend, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100