Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

208
Visualizações
TypeError: no se pudo construir 'Texto' ReactNative

He usado la etiqueta <Text> un millón de veces y nunca recibí este error, pero de repente, puse una etiqueta <Text> dentro de una etiqueta <Modal> y el mundo arde. Realmente no hay nada remotamente complicado en el componente en el que estoy trabajando, pero CUALQUIER <Text> dentro de '' lo rompe todo. Así es como se ve mi código...

 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

De la forma en que se utiliza este componente, la única parte visible del mismo será

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

y tan pronto como presiono este botón en el navegador, la pantalla se vuelve blanca y me da un MONTÓN de errores, todos relacionados con <Text> , el primero de los cuales se ve así...

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

Pero esto simplemente no tiene absolutamente ningún sentido para mí. ¿Alguien tiene alguna idea?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Como mencionó @windowsill en el comentario, el texto no se importa de react-native (ni de ningún otro lugar) :)

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda