react-native-markdown-renderer
react-native-markdown-renderer copied to clipboard
applyStyle doesn't check null or undefined cases
I spotted that if you have a render rule that potentially returns null or undefined and you use applyStyle in other rule it could produce an exception.
Here is my case:
I don't want to render anything when I have softbreak in the markdown but for textgroup items, depending on the children I have to render a View or a Text. Besides when I have to render a View in a textgroup item I need to use applyStyle for styling possible texts inside.
In this case when applyStyle is called it tries to get type of the null child and crashes.
https://github.com/mientjan/react-native-markdown-renderer/blob/260fad084a11006201cc657fdc64f54d4625fd38/src/lib/util/applyStyle.js#L16-L18
Hey, i removed applyStyles here https://github.com/iamacup/react-native-markdown-display/pull/32 in the react-native-markdown-display fork.
This was possible because of the change here: https://github.com/iamacup/react-native-markdown-display/commit/e0b726c2fe5fbe7005246ffe03131c3debbab9a6
Thanks @iamacup, I’ll take a look to your fork (nice work btw).