Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import { TextInput } from 'react-native';
  3.  
  4. import selectable from './selectable';
  5.  
  6. const Selectable = selectable(TextInput); // The most important line in this implementation!
  7.  
  8. export default class SelectableInput extends Component {
  9. _input: any
  10.  
  11. _handleInputPress = () => {
  12. this._input.focus();
  13. }
  14.  
  15. handleSubmit = () => {
  16. this._input.blur();
  17. }
  18.  
  19. render() {
  20. return (
  21. <Selectable
  22. onPress={this._handleInputPress}
  23. onSubmitEditing={this.handleSubmit}
  24. ref={i => (this._input = i ? i._wrappedComponent : null)}
  25. {...this.props}
  26. />
  27. );
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement