Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

205
Vistas
TypeError: Failed to construct 'Text' ReactNative

I've used the <Text> tag a million times and never received this error, but all of a sudden, I put a <Text> tag inside of a <Modal> tag and the world burns. There is really nothing remotely complicated about the component I am working in, but ANY <Text> inside the '' breaks everything. Here is what my code looks like...

import React, { useState, useEffect } from 'react';
import { View, Modal, Button, ScrollView, TextInput } from 'react-native'
import { settings } from "../../../Styles/SettingStyles";
import { editUserSettings } from '../../../Styles/SettingStyles';

const UpdateUserButton = (props) => {

    const [userInfoChanges, setUserInfoChanges] = useState({})

    const handleInput = (attr, input) => {
        const updateObject = {...userInfoChanges}
        updateObject[attr] = input
        setUserData(updateObject)
    }


    const [modalVisible, setModalVisible] = useState(false)
    return(
        <View style={editUserSettings.editModal}>
            <Modal animationType='slide' transparent={true} visible={modalVisible}>
                <ScrollView style={editUserSettings.container}>
                    <Text style={editUserSettings.editFields}>First Name: </Text>
                    <TextInput
                        name='firstname'
                        style={editUserSettings.input} 
                        onChangeText={(firstname) => {
                            handleInput('firstname', firstname)
                        }}
                    />
                </ScrollView>
            </Modal>
            <Button
                onPress={() => setModalVisible(!modalVisible)}
                title="Edit User Information"
                color="#516ca6"
                accessibilityLabel="Edit User Information"
            />
        </View>
    )
}

export default UpdateUserButton

The way this component is used, the only visible part of it will be

<Button
      onPress={() => setModalVisible(!modalVisible)}
      title="Edit User Information"
      color="#516ca6"
      accessibilityLabel="Edit User Information"
    />

and as soon as I press this button in the browser, the screen all turns to white giving me a BUNCH of errors, all involving <Text>, the first of which looks like this...

Uncaught TypeError: Failed to construct 'Text': Please use the 'new' operator, this DOM object constructor cannot be called as a function.

But this just makes absolutely no sense to me. Anyone have any ideas?

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

As @windowsill mentioned on the comment, Text is not imported from react-native (or from anywhere else) :)

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda