{"size": 1009, "ext": "js", "max_stars_repo_path": "src/mobile/src/ui/components/WithDropdownAlert.js", "max_stars_repo_name": "mfecenko/trinity-wallet", "max_stars_repo_stars_event_min_datetime": "2019-01-22T21:44:12.000Z", "max_stars_repo_stars_event_max_datetime": "2019-01-22T21:44:12.000Z", "max_issues_repo_path": "src/mobile/src/ui/components/WithDropdownAlert.js", "max_issues_repo_name": "mfecenko/trinity-wallet", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/mobile/src/ui/components/WithDropdownAlert.js", "max_forks_repo_name": "mfecenko/trinity-wallet", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.5757575758, "max_line_length": 76, "alphanum_fraction": 0.5847373637}
import React, { PureComponent } from 'react';
import { View } from 'react-native';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import StatefulDropdownAlert from 'ui/components/StatefulDropdownAlert';

export default function withDropdownAlert(WrappedComponent) {
    class EnhancedComponent extends PureComponent {
        static propTypes = {
            /** @ignore */
            theme: PropTypes.object.isRequired,
            /** @ignore */
            isModalActive: PropTypes.bool.isRequired,
        };

        render() {
            return (
                <View style={{ flex: 1 }}>
                    <WrappedComponent {...this.props} />
                    {!this.props.isModalActive && <StatefulDropdownAlert />}
                </View>
            );
        }
    }

    const mapStateToProps = (state) => ({
        theme: state.settings.theme,
        isModalActive: state.ui.isModalActive,
    });

    return connect(mapStateToProps)(EnhancedComponent);
}
