Dong Lam Trien

Dong Lam Trien

  • 783
  • 983
  • 137.3k

Render error: Text strings must be rendered within a <Text> component

Jun 11 2024 8:46 AM

I demoed React Native as an example of a login application, including two files App.js and Login.js. Please help me pick them up. When running, I get an error: Render error: Text strings must be rendered within a <Text> component

file App.js

import React from 'react';
import { StyleSheet, View } from 'react-native';
import Login from './Login'; // Import component Login

const App = () => {
  return (
    <View style={styles.container}>
      <Login /> {/* Use component Login */}
    </View>
  );
};

export default App;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#e7feff',
  },
});

 

file Login.js

import { StyleSheet, View, TextInput, Text, Image, Alert, TouchableOpacity } from 'react-native';

const Login = () => {


    return (
        <View style={styles.container}>

        </View >
    );
};

export default Login;

const styles = StyleSheet.create({

});

 


Answers (2)