This library RenderHtml in react native require source variable to be like that
{
html: `
<p style='text-align:center;'>
Hello World!
</p>`
};
In another screen I managed to send the correct object like so
html: { html: route.params.index.content.rendered },
but here I am inside a for loop so cannot use setState
const posts = this.state.data.map((item, index) => (
<TouchableWithoutFeedback key={index}>
<RenderHtml source={item.excerpt.rendered} contentWidth={width} />
</TouchableWithoutFeedback>
))
I tried all of these below, doesnt work
source={html: item.excerpt.rendered}
source={'html:' + item.excerpt.rendered}
source=`{html: item.excerpt.rendered}`
source={`html: + $item.excerpt.rendered`}
Found the answer:
source={{html: item.excerpt.rendered}}