{"size": 974, "ext": "js", "max_stars_repo_path": "src/components/Dica.js", "max_stars_repo_name": "ramirolima/manutSoft", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/Dica.js", "max_issues_repo_name": "ramirolima/manutSoft", "max_issues_repo_issues_event_min_datetime": "2019-11-03T22:57:17.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T00:09:09.000Z", "max_forks_repo_path": "src/components/Dica.js", "max_forks_repo_name": "vinisbranco/ManutencaoEVote", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 13, "max_forks_count": null, "avg_line_length": 26.3243243243, "max_line_length": 87, "alphanum_fraction": 0.6026694045}
import React from 'react';
import { TouchableWithoutFeedback, View } from 'react-native';
import { Tooltip, Text } from 'react-native-elements';
import PropTypes from 'prop-types';
 
class Dica extends React.Component {
  constructor(props) {
    super(props);
    this.state = { pressed: true };
  }
  render() {
    const { children, dica } = this.props;
    return (
      <TouchableWithoutFeedback
        onPress={() => this.setState(state => ({pressed: !state.pressed }))}
      >
        <View>
          <Tooltip
            backgroundColor='#7500CF'
            width={200}
            popover={<Text style={{ color: 'white', fontWeight:'300' }}>{dica}</Text>} 
            toggleOnPress={this.state.pressed}>
              {children}
          </Tooltip>
        </View>
      </TouchableWithoutFeedback>
    );
  }
};

export default Dica;

Dica.propTypes = {
  children: PropTypes.node.isRequired,
  dica: PropTypes.string.isRequired,
  onPress: PropTypes.bool
}