facebookarchive / nuclide

An open IDE for web and native mobile development, built on top of Atom
https://nuclide.io
Other
7.79k stars 682 forks source link

[OutlineView] better React HOC support #1628

Open maggialejandro opened 5 years ago

maggialejandro commented 5 years ago

Hi guys! It would be really nice if Outline view had better support for React Higher Order Components

For example:

/* @flow */
import React from 'react';
import { Modal } from 'react-native';

import styles from './styles';

type PropsType = {
  isVisible: boolean,
  onClose: () => void,
};

const ModalHOC = (): Function => (
  WrappedComponent: React.Element<*>,
): React.Element<*> =>
  class CustomModal extends React.PureComponent<PropsType> {
    handleClose = (): any => this.props.onClose();

    render(): React.Element<*> {
      return (
        <Modal
          style={styles.modal}
          hardwareAccelerated
          visible={this.props.isVisible}
          transparent
          onRequestClose={this.handleClose}
          supportedOrientations={['portrait', 'landscape']}
        >
          <WrappedComponent {...this.props} />
        </Modal>
      );
    }
  };

export default ModalHOC;

Expected Behavior (VS Code)

captura de pantalla 2018-10-08 a la s 14 55 25

Actual Behavior

captura de pantalla 2018-10-08 a la s 14 55 46

Versions