conorhastings / conorhastings/react-native-syntax-highlighter

Can not add child that doesn't have YogaNode to a parent

Open
#21 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
184
Forks
26
PR merge metrics
No merged PRs in 30d

Description

Hello Conor,

I got an error while I am using `react-native-syntax-highlighter` inside `react-native-render-html`.

**I got this error:**

![Screenshot_1573818279](https://user-images.githubusercontent.com/16835407/68941443-e7fb8f00-07cb-11ea-8941-e8f5b82db826.png)

**Here is my code**

```
import React from 'react';
import { View } from 'react-native';
import Html from 'react-native-render-html';
import SyntaxHighlighter from 'react-native-syntax-highlighter';

const contentTest = `


  • Hello


                               <html>

    <head>
    </head>

    <body>
    </body>

    </html>


  • `

    export default class SyntaxHighlighterTest extends React.Component{

    render(){
    return (

    {
    return {contentTest}
    }
    }}
    />

    );
    }
    }
    ```

    ### I found that the content I am passing has an issue
    If I am using this content without `

    ` tag then it is working fine:

    **Working**

    ```
    const contentTest = `


  •                            <html>

    <head>
    </head>

    <body>
    </body>

    </html>


  • `
    ```

    ![Screenshot_1573819513](https://user-images.githubusercontent.com/16835407/68942657-25155080-07cf-11ea-8385-bf574dd3b0d4.png)

    **Not Working**

    ```
    const contentTest = `


  • Hello


                               <html>

    <head>
    </head>

    <body>
    </body>

    </html>


  • `
    ```

    ### So `SyntaxHighlighter ` takes content that has only one child in parent tag.

    **Note:** It is working when I am using this outside of `react-native-render-html`, but I want to use within html renderer.

    What will be the best practice to resolve this issue ?

    Thank you

    Contributor guide

    No contributing guide indexed for this repository

    Assessment

    This issue has not been assessed yet.

    Get new issues in your inbox

    A short digest of beginner-friendly GitHub issues.