Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
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 answers
Answer question

0

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

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!