Guest User

Untitled

a guest
Jun 13th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. export const ButtonWithComponent = (Comp) => props =>
  2. <TouchableOpacity
  3. onPress={props.onPress}
  4. style={{
  5. paddingHorizontal: 10,
  6. flexDirection: 'row',
  7. justifyContent: 'flex-end',
  8. alignItems: 'center'
  9. }}
  10. hitSlop={{ left: 5, right: 5, top: 5, bottom: 5 }}
  11. >
  12. <Comp />
  13. </TouchableOpacity>;
  14.  
  15. const PencilButton = ButtonWithComponent(
  16. <Icon name="pencil" color={APP_MAIN_COLOR} size={30} type="entypo" />
  17. );
  18.  
  19. class myClass extends Component {
  20.  
  21. ...
  22.  
  23. render() {
  24. return (
  25. <PencilButton />
  26. );
  27. }
  28.  
  29. }
Add Comment
Please, Sign In to add comment