header.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. fontSize: 24,
  20. height: 50,
  21. marginLeft: 16
  22. },
  23. toggleIcon: {
  24. color: "#CCC",
  25. fontSize: 30
  26. }
  27. });
  28. class Header extends Component {
  29. render() {
  30. return (
  31. <View style={styles.header}>
  32. <TouchableOpacity
  33. onPress={this.props.onToggleAllComplete}
  34. >
  35. <Text style={styles.toggleIcon}>{CHECKMARK}</Text>
  36. </TouchableOpacity>
  37. <TextInput
  38. blurOnSubmit={false}
  39. onChangeText={this.props.onChange}
  40. onSubmitEditing={this.props.onAddItem}
  41. placeholder="What needs to be done?"
  42. returnKeyType="done"
  43. style={styles.input}
  44. value={this.props.value}
  45. />
  46. </View>
  47. );
  48. }
  49. }
  50. export default Header;