Skip to content
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

Simple Markdown fails with Unexpected view type nested under text node #100

Open
Alanz2223 opened this issue Aug 24, 2018 · 7 comments
Open

Comments

@Alanz2223
Copy link

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 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?

@ollyde
Copy link

ollyde commented Dec 6, 2018

I've been hunting for a decent mobile markdown editor for days now. No luck they are all broken.

@marudy
Copy link

marudy commented Jan 8, 2019

Hey guys, any update / solution for this one?

@lucasromanojf
Copy link

Mine fails when using lists, like:

  • bla bla bla
  • bla bla bla
    ....

@ollyde
Copy link

ollyde commented Jan 22, 2019

I gave up, just use a WebView with https://quilljs.com/ << Best one.

@lucasromanojf
Copy link

@voidstarfire I'll take a look, thanks for the tip!

@atamano
Copy link

atamano commented Apr 2, 2019

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))

@ollyde
Copy link

ollyde commented Apr 2, 2019

I ended up using Quill.
It's excellent and has lots of nice UI/Formatting automations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants