Skip to content

Instantly share code, notes, and snippets.

@aakashns
Last active October 27, 2015 20:52
Show Gist options
  • Select an option

  • Save aakashns/69aa29406417ed432ce4 to your computer and use it in GitHub Desktop.

Select an option

Save aakashns/69aa29406417ed432ce4 to your computer and use it in GitHub Desktop.
Native View for Name cross-platform component.
import React from 'react-native';
var {
View,
Text,
TextInput,
StyleSheet
} = React;
var NameViewNative = React.createClass({
render: function() {
var { value, errors, sync, onValueChange } = this.props;
var errorNodes = errors.map((e, i) =>
<Text key={i} style={styles.error}>{e}</Text>);
var syncNode = value &&
<Text style={styles.sync}>{sync}</Text>;
return (
<View style={styles.container}>
<Text style={styles.label}>Name</Text>
<TextInput value={value}
style={styles.input}
onChangeText={onValueChange} />
</View>
);
}
});
var styles = StyleSheet.create({ /* Styles go here */ });
export default NameViewNative;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment