juiceo / react-native-easy-markdown

Simple & customizable React Native component to render Github-flavoured markdown using minimal native components.
https://www.npmjs.com/package/react-native-easy-markdown
65 stars 62 forks source link

does not work with 'create-react-native-app' v0.0.6 / expo #1

Closed dkarter closed 7 years ago

dkarter commented 7 years ago

Hi!

Thanks for the package! I've been trying to use it with no success. I used the example from the readme in a brand new React Native project created from create-react-native-app CLI.

Any thoughts?

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import Markdown from 'react-native-easy-markdown';

export default class App extends React.Component {
  render() {
    return (
      <Markdown>
        # Why is markdown cool?

        * because it lets us do simple formatting **easily**
        * _without_ the need for complex CMS data structures
        * and you can outsource ~~your~~ work to the content creators!

        ![We can add images!](http://placehold.it/300x300)
        [Or link to places](http://foobar.com)
      </Markdown>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Yields Views nested within a <Text> must have a width and height:

image

Thanks! DK

juiceo commented 7 years ago

Sorry to hear this! This issue should have already been resolved in one of the earlier patches I made - just to make sure, are you using the newest version of the library? I will have a look and see if I can reproduce it.

juiceo commented 7 years ago

@dkarter the problem seems to be the raw html-style text input that I had initially posted in the readme, which is not actually supported. It will work normally if you supply the markdown as a variable e.g.

`

{myMarkdown}

`

or as a string with line breaks included, as shown in the now updated readme. Hope this solves your problem - I will close this issue for now but please re-open if it still does not work :)

jaycee425 commented 6 years ago

the example still breaks, tried with another string it works but if I put a line break it stops working