Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Text strings must be rendered within a <Text> component. in App (created by withDevTools(App))

I have a native react app. And I have this simple objects:

export const AnimalGroupScreen = () => (
    <SafeAreaView style={styles.container}>
        <View style={styles.search}>
            <Searchbar />
        </View>
        <View style={styles.list}>
            <AnimalGroupInfo />
        </View>
    </SafeAreaView>
);

import React from "react";
import { Text } from "react-native";

export const AnimalGroupInfo = () => <Text> Hello there</Text>;

and app:

import { AnimalGroupScreen } from "./src/features/animalGroup/screens/animal-group-screen";
/* eslint-disable prettier/prettier */
import ExpoStatusBar from "expo-status-bar/build/ExpoStatusBar";
import React from "react";

export default function App() {
    return (
        <>
            <AnimalGroupScreen />;
            <ExpoStatusBar style="auto" />
        </>
    );
}

But I still get this error:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Error: Text strings must be rendered within a <Text> component.

This error is located at:
    in App (created by withDevTools(App))
    in withDevTools(App)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)

And of course I searched for this error. But I only have a Text tag in the Info component.

And that seems correct. So how to tackle this error?

>Solution :

You have a semicolon here:

<AnimalGroupScreen />;

Remove it and it should work.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading