react-native-simple-markdown
react-native-simple-markdown copied to clipboard
Simple Markdown fails with `Unexpected view type nested under text node`
Hello, I've tried all markdown libraries and all of them seem to have an error parsing basic markdown due to how react native Android renders components. The error seems to occur when you try nesting components in your markdown, for example something like this (view it raw since github parses it)
-
[Leetcode Problem] (https://google.com)
A general classification of the topics, and a summary of the problem-solving ideas for each type of question.
or
- [I. Basic Concepts] (#1 - Basic Concept)
I get the following error
Unexpected view type nested under text node: class com.facebook.react.uimanager.LayoutShadowNode
a simple list with a nested list of links fails... Would anyone have a simple and elegant solution to this problem?
I guess the best solution would be to convert the text tag into a view and wrap the text in a text tag?
I've been hunting for a decent mobile markdown editor for days now. No luck they are all broken.
Hey guys, any update / solution for this one?
Mine fails when using lists, like:
- bla bla bla
- bla bla bla ....
I gave up, just use a WebView with https://quilljs.com/ << Best one.
@voidstarfire I'll take a look, thanks for the tip!
here is a quickfix, you'll need to add a patch:
patch-package
--- a/node_modules/react-native-simple-markdown/rules.js
+++ b/node_modules/react-native-simple-markdown/rules.js
@@ -141,7 +141,7 @@ export default (styles) => ({
},
paragraph: {
react: (node, output, state) => {
- return createElement(View, {
+ return createElement(Text, {
key: state.key,
style: styles.paragraph
}, output(node.content, state))
I ended up using Quill. It's excellent and has lots of nice UI/Formatting automations.