Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PropTypes defined on a variable aren't processed #70

Open
knownasilya opened this issue Mar 20, 2023 · 1 comment
Open

PropTypes defined on a variable aren't processed #70

knownasilya opened this issue Mar 20, 2023 · 1 comment

Comments

@knownasilya
Copy link

Example code:

import PropTypes, {InferProps} from 'prop-types';
import Task from './task';
import Row from '../row';

const TaskRow = (props: InferProps<typeof propTypes>) => (
  <Row
    contentStyle={{
      paddingLeft: props.level * 10,
    }}
    onPress={props.onPress}
  >
    <Task {...props} />
  </Row>
);

const propTypes = {
  level: PropTypes.number.isRequired,
  onPress: PropTypes.func.isRequired,
};

TaskRow.propTypes = propTypes;
TaskRow.defaultProps = {
  level: 1,
};

export default TaskRow;
@mskelton
Copy link
Owner

I don't have much bandwith to work on this project at the moment, but you are more than welcome to contribute as this would be a worthy improvement. Let me know if you need any guidance of how this might work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants