Closed scousino closed 3 years ago
same for me
Same
same here
Adding PropTypes.array to line 32 solves the problem: style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),
@joseclaudiojr Please submit a PR
Adding PropTypes.array to line 32 solves the problem: style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),
This in no way fixes the problem mentioned in this issue. Your fix isn't even a typescript change.
Adding PropTypes.array to line 32 solves the problem: style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),
This in no way fixes the problem mentioned in this issue. Your fix isn't even a typescript change.
This repo uses prop-types to document the intended types of properties passed to components. (https://www.npmjs.com/package/prop-types)
Adding PropTypes.array to line 32 solves the problem: style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),
This in no way fixes the problem mentioned in this issue. Your fix isn't even a typescript change.
This repo uses prop-types to document the intended types of properties passed to components. (https://www.npmjs.com/package/prop-types)
This has nothing to do with prop types and the style prop type has nothing to do with renderItem.
I am describing a TypeScript error. I suggest learning the difference between the two before submitting a PR for packages
Adding PropTypes.array to line 32 solves the problem: style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),
This in no way fixes the problem mentioned in this issue. Your fix isn't even a typescript change.
This repo uses prop-types to document the intended types of properties passed to components. (https://www.npmjs.com/package/prop-types)
This has nothing to do with prop types and the style prop type has nothing to do with renderItem.
I am describing a TypeScript error. I suggest learning the difference between the two before submitting a PR for packages
Well, it looks like you didn't really check the solution. Anyway, i was having a typescript issue and that worked for me. Good luck in finding your answer, looks like you gonna need it....
Again PropTypes are not for TypeScript, literally look it up. PropTypes provide typing for JAVASCRIPT. Type Script is only affected by changes to type definition files. In this case index.d.ts. Again your change is still not even related to the issue you commented on. Please try and follow standard issue guidelines. Open a separate issue if you're having problems with the PropTypes
Thanks for your interest in this issue, @scousino and @joseclaudiojr :-) I think I found a fix: https://github.com/peacechen/react-native-modal-selector/commit/539673ac7ebfd1360fc3abaf0c0fda9be5fb6c5e
Could you test default branch and confirm if this works for you or not?
You could test default branch (master) by installing like this: npm install peacechen/react-native-modal-selector
.
please also add methods
-export default class ModalSelector<TOption = IOption> extends React.Component<IModalSelectorProps<TOption> & FlatListProps<any>, any> {}
+export default class ModalSelector<TOption = IOption> extends React.Component<IModalSelectorProps<TOption> & Omit<FlatListProps<any>, any>, 'renderItem'> {
+ open(): void;
+ close(): void;
+ getSelectedItem(): string | undefined;
+}
They are added in another PR: https://github.com/peacechen/react-native-modal-selector/pull/161 (or at least open
and getSelectedItem
), I will merge that when this issue is resolved.
Somewhere between versions 2.0.2 and 2.0.7 the typings for the props on ModalSelector were changed to include FlatListProps. Since that change, TypeScript now throws an error unless you provide the renderItem property that is required for a FlatList. However, I know that is wrong, because this package already takes care of providing a renderItem implementation in its code.
I believe the solution is to utilize Pick, Omit, Exclude from TypeScript in some way, but I'm not familiar with exactly how