No text appearing on iOS simulator when typing

I recently started learning React-Native and decided to follow a tutorial to create a login screen. I encountered an issue where the code in the tutorial was outdated. I am working on a login screen that consists of multiple components. However, one specific TextInput component is not showing up in the simulator. Below is the parent component, "LoginForm," from the file LoginForm1.js:

export default class LoginForm extends Component {
  constructor(props) {
    super(props);
    this.state = {
      text: ''
    };
  }


  render() {
    return (
      <Card>
        <CardSection>
          <Input
          placeholder="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e095938592a0878d81898cce838f8f8d">[email protected]</a>"
          label="Email"
          value={this.state.email}
          onChangeText={text => this.setState({ text })}
          />
        </CardSection>

The "Input" child component is encapsulated by the "CardSection" and "Card" components, which pass their props with a View displaying {this.props.children}. Here is the "Input" component from the file Input.js:

export default class Input extends Component {
  render() {
    return (
      <View style={styles.containerStyle}>
        <Text style={styles.labelStyle}>{this.props.label}</Text>
        <TextInput
          placeholder={this.props.placeholder}
          autoCorrect={false}
          style={styles.inputStyle}
          value={this.props.value}
          onChangeText={this.props.onChangeText}
        />
      </View>
      );
  }
}

const styles = StyleSheet.create({
  inputStlye: {
    color: '#000',
    paddingRight: 5,
    paddingLeft: 5,
    fontSize: 18,
    Height: 50,
    Width: 50,
    flex: 2,
  },

While this code does not produce any errors, the TextInput component within the "Input" component does not appear. I have specified dimensions in the styling, so that is not the issue. When I replace the TextInput with normal Text, the contents of that Text tag are displayed in the simulator. Am I overlooking something related to prop passing? Any assistance would be greatly appreciated. Thank you!

Answer №1

The value that is being passed down is value={this.state.email}, however, your onChangeText function is updating this.state.text so make sure to change it to value={this.state.text}.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using jQuery to reload the page following a PHP form submission

Currently facing an issue as I am trying to load the same page submitted by PHP, specifically in a comment section. After users submit their message, I want to display the existing comments along with the new one. The problem arises because I'm not u ...

Conceal all video containers once a single one is chosen

Having recently delved into Javascript, I am encountering some difficulties in crafting the correct code for a specific function. The scenario involves multiple div elements, each containing 2 child div elements that switch places upon being clicked. Con ...

Using AngularJS's ng-repeat directive to convert expressions into JavaScript code

I am successfully retrieving data from my Database using AngularJS, however, I am struggling to find a way to extract the data from ng-repeat and store it in a JavaScript Object. Is the data treated as an expression after ng-repeat is applied? I have hear ...

The .SVC file's generated Javascript proxy URL fails to function properly when used with SSL

The ASP.Net web site I have deployed in IIS 7.5 includes a file named Cart.svc, which is used for accessing JavaScript from the browser. While the JavaScript functions fine without SSL, enabling SSL causes it to stop working. Interestingly, removing the / ...

Challenge with Angular *ngFor: Struggling to Access Previous Elements

In my angular and node application, I am using socket.io. When a user joins the room, they can see their username in the user list. If another user joins, the first user can see both usernames but the new user can only see their own. This pattern continues ...

What is the best method for placing an element above all other elements on a page, regardless of the layout or styles being used?

I want to create a sticky button that remains fixed on the page regardless of its content and styles. The button should always be displayed on top of other elements, without relying on specific z-index values or pre-existing structures. This solution must ...

using variables as identifiers in nested JSON objects

Within my code, there is a JSON object named arrayToSubmit. Below is the provided snippet: location = "Johannesburg, South Africa"; type = "bench"; qty = 1; assetNumber = 15; arrayToSubmit = { location : { type : { 'qty' ...

Function Errors, How to Fix Them?

I've recently developed a tool for character creation within a new video game. However, I'm currently facing an issue: When it comes to assigning points in Magic Power or Weapon Power for the Warrior and Wizard characters, there seems to be a p ...

Employing Ajax.Updater to retrieve a javascript file (prototype.js)

My ajax request is set up as follows: new Ajax.Updater({ success: 'footer' }, '/dyn/actions/checkSystemMessage', { insertion: 'after', evalScripts: true }); The content found at /dyn/actions/checkSystemMessag ...

Tips for removing residue from old watches

Our angularJS web components are integrated with a jqxGrid. Whenever a user makes edits in a cell, we implement a custom typeahead editor using Angular. However, I have noticed that after the editor is destroyed, my $watches array does not revert back to i ...

JavaScript - Uncaught ReferenceError: WebSocket is undefined

Looking at just the client side API (since each server side language has its own API), this code snippet demonstrates opening a connection, setting up event listeners for connect, disconnect, and message events, sending a message to the server, and closing ...

The code within $(document).ready() isn't fully prepared

Feeling frustrated after spending hours searching and attempting to refactor one of my old modules on a rendered Mustache template. It's like diving into code chaos. <section id="slideShow"> <script id="slideShow-template" type="text/tem ...

Creating specific CSS classes for individual slides in a basic slider framework

So, I have a rather simple slider that is created using only CSS. Each slide has unique labels for navigation buttons. The main question here is: how can I dynamically add or remove classes to specific items on the slide only when that particular slide is ...

The pdf generation feature of pdf-creator-node in Linux seems to be malfunctioning

An error occurred with code EPIPE at afterWriteDispatched (internal/stream_base_commons.js:154:25) at writeGeneric (internal/stream_base_commons.js:145:3) at Socket._writeGeneric (net.js:784:11) at Socket._write (net.js:796:8) ...

What is the most efficient way to retrieve the operating system's name and version using JavaScript?

I'm in the process of developing an object that will simplify accessing browser and system information by implementing a function. One particular function within this object is responsible for retrieving the operating system name and version, returnin ...

When using res.json(), the data is returned as res.data. However, trying to access the _id property within it will result

I'm facing a challenge in comprehending why when I make a res.json call in my application, it successfully sends data (an order object). However, when I attempt to access and assign a specific piece of that data (res.data._id) into a variable, it retu ...

Upon refreshing the page, an inline script was not executed due to its violation of the Content Security Policy directive: "script-src 'self'"

When I refresh the page on my production build for all routes except "/", I encounter an error in my Node/React app which results in a blank page being displayed. The error message states: "Refused to execute inline script because it violates the followi ...

The process of generating vue-cli-plugin-prerender-spa encountered an issue where the error was not found within the

I have successfully integrated this plugin into my laravel-vue application and configured it within the laravel mix's webpack.mix.js file. After running it via npm (using watch, dev, and prod modes), I encountered no errors. However, upon inspecting ...

Problem with KeyboardAvoidingView when using TextInput and Animated.API

My page design includes a Flatlist, pickers, slider, text input, and an Animated View. However, I am facing an issue with KeyboardAvoidingView. Upon initial rendering, the design looks like this:First Render When the user clicks on the "Add" icon, the pa ...

jquery accordion set to collapse by default when the page first loads

Currently, I have integrated JQuery UI accordion into my webpage and I am facing a minor issue. Upon page load, all tabs are initially open for a few seconds before collapsing. I suspect this might be a loading effect. Any suggestions on how to ensure that ...