Answers for "handling text input react native class component"

0

handling text input react native class component

import React, { Component } from 'react';
import { Text, TextInput, View } from 'react-native';

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

  render() {
    return (
      <View style={{padding: 10}}>
        <TextInput
          style={{height: 40}}
          placeholder="Type here to translate!"
          onChangeText={(text) => this.setState({text})}
          value={this.state.text}
        />
        <Text style={{padding: 10, fontSize: 42}}>
          {this.state.text.split(' ').map((word) => word && 'asa').join(' ')}
        </Text>
      </View>
    );
  }
}
Posted by: Guest on September-08-2021

Code answers related to "handling text input react native class component"

Code answers related to "Javascript"

Browse Popular Code Answers by Language