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

Blockquotes broken in 1.2.0 #22

Open zivester opened 5 years ago

zivester commented 5 years ago

I believe there was a regression introduced in #17 . I cannot render a simple blockquote now with react-native (expo and native build).

> This is a quote

On 1.1.9 it renders correctly. On 1.2.0 it immediately fails with: "Unexpected view type nested under text node."

As I'm also running react-native @ 0.55, I'm currently exploring if it's possible to revert the isTextOnly removal and get both images and quotes working at the same time. It's not possible to have both working in either build.

EDIT: I brought back Util.isTextOnly and the detecting block, and I now have images working (but still no blockQuotes)

        if (Utils.isTextOnly(nodes)) {
            if (isBlockQuote) {
                style.push(styles.blockQuote)
                return(
                    <View key={'blockQuote_' + key} style={[styles.block, styles.blockQuote]}>
                        <Text>{nodes}</Text>
                    </View>
                );
            } else {
                return(
                    <Text key={'block_' + key} style={styles.block}>
                        <Text style={styles.text}>
                            <Text style={styles.text}>
                                {nodes}
                            </Text>
                        </Text>
                    </Text>
                );
            }
        } else {
            return (
                <View key={'block_' + key} style={styles.block}>
                    {nodes}
                </View>
            );
        }