Skip to content

Instantly share code, notes, and snippets.

@edutrul
Last active April 22, 2017 15:56
Show Gist options
  • Save edutrul/af8a876f6f1b7fc3bddea03f3d541999 to your computer and use it in GitHub Desktop.
Save edutrul/af8a876f6f1b7fc3bddea03f3d541999 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import { AppRegistry, Text, TextInput, View } from 'react-native';
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})}
/>
<Text style={{padding: 10, fontSize: 42}}>
{this.state.text.split(' ').map((word) => word && '🍕').join(' ')}
</Text>
</View>
);
}
}
AppRegistry.registerComponent('PizzaTranslator', () => PizzaTranslator);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment