header.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import React, { Component } from 'react';
  2. import {
  3. StyleSheet,
  4. Text,
  5. TextInput,
  6. TouchableOpacity,
  7. View
  8. } from 'react-native';
  9. const CHECKMARK = String.fromCharCode(10003);
  10. const styles = StyleSheet.create({
  11. header: {
  12. paddingHorizontal: 16,
  13. flexDirection: "row",
  14. justifyContent: "space-around",
  15. alignItems: "center"
  16. },
  17. input: {
  18. flex: 1,
  19. height: 50,
  20. marginLeft: 16
  21. },
  22. toggleIcon: {
  23. color: "#CCC",
  24. fontSize: 30
  25. }
  26. });
  27. class Header extends Component {
  28. render() {
  29. return (
  30. <View style={styles.header}>
  31. <TouchableOpacity
  32. onPress={this.props.onToggleAllComplete}
  33. >
  34. <Text style={styles.toggleIcon}>{CHECKMARK}</Text>
  35. </TouchableOpacity>
  36. <TextInput
  37. blurOnSubmit={false}
  38. onChangeText={this.props.onChange}
  39. onSubmitEditing={this.props.onAddItem}
  40. placeholder="What needs to be done?"
  41. returnKeyType="done"
  42. style={styles.input}
  43. value={this.props.value}
  44. />
  45. </View>
  46. );
  47. }
  48. }
  49. export default Header;