'React Native: error "Input data should be a String" when using "react-native-markdown-display""

I get this error after using React-native-markdown-display package and I don't understand why... I have only strings in my content database, so it seem's to be something else.

This is the full error: folow the link to see the error

And my code bellow :

    //Libraries
import { SafeAreaView, ScrollView, StyleSheet, Text, View } from 'react-native';
import React, { useState } from 'react';
import Colors from '../constants/Colors';
import GoBackButton from '../components/GoBackButton';
import { useEffect } from 'react';
import Markdown from 'react-native-markdown-display';

const PostsDetails = ({ navigation, route }) => {
    const [post, setPost] = useState({});
    const [services, setServices] = useState([]);
    useEffect(() => {
        let { selectedPost } = route.params;
        setPost(selectedPost);
        setServices(selectedPost.services);
    }, []);

    console.log(services);

    return (
        <View style={styles.container}>
            <SafeAreaView style={{ flex: 1 }}>
                <ScrollView showsVerticalScrollIndicator={false}>
                    <GoBackButton onPress={() => navigation.goBack()} />
                    <Text>{post.title}</Text>
                    <Text>{post.region}</Text>
                    <Text>{post.category}</Text>
                    <Text>{post.id}</Text>
                    <Markdown>{post.content}</Markdown>
                    <Text>{post.itinerary}</Text>
                    <Text>{post.lat}</Text>
                    <Text>{post.lon}</Text>
                    <Text>{post.price}</Text>
                    <Text>{post.link}</Text>
                    {services.map((service, index) => {
                        return <Text key={index}>{service.attributes.name}</Text>;
                    })}
                </ScrollView>
            </SafeAreaView>
        </View>
    );
};

export default PostsDetails;

I didn't find any similar error in stackOverflow.

Thanks



Solution 1:[1]

I was using Docusaurus when I encountered this error using markdown-it. The issue was that Docusaurus has built-in MDX support and the module was picking up my markdown files, processed them to JDX before they were loaded into my code and that is when the type error occured. I resolved this by simply storing my markdown in .txt files, so the module ignores them and they can be loaded as simple strings.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TomKosci