react-native-svg-charts
react-native-svg-charts copied to clipboard
Tooltip and Decorator throws Typescript error
What is the problem?
Rendering <Tooltip />
inside <StackedBarChart />
throws
Type '{}' is missing the following properties from type '{ width: any; height: any; }': width, heightts(2739)
and similarly with <Decorator />
'Decorator' cannot be used as a JSX component.
Its return type 'unknown[]' is not a valid JSX element.
Type 'unknown[]' is missing the following properties from type 'Element': type, props, keyts(2786)
When does it happen?
with the definitions
const Tooltip = ({ width, height }) => {
// ...
const Decorator = ({ x, y, data }) => {
What platform?
- [X] iOS
- [ ] Android
react-native version: 0.61.4
react-native-svg-charts version: ^5.3.0
react-native-svg version: 11.0.1
Code to reproduce
// put code here
Hi @garrett-gottlieb ! I was facing the same issue, you just need to provide 'any' type to your components props. I think TS isn't already supported by childrens, but I may be wrong. Anyway, providing 'any' type to props seems to solve this issue.
@ajacquierbret can you leave a code comment - I've tried but not sure what you mean exactly to clear up this typescript error
Hi @garrett-gottlieb ! I was facing the same issue, you just need to provide 'any' type to your components props. I think TS isn't already supported by childrens, but I may be wrong. Anyway, providing 'any' type to props seems to solve this issue.
Negative, not working.
What is the problem?
Rendering
<Tooltip />
inside<StackedBarChart />
throwsType '{}' is missing the following properties from type '{ width: any; height: any; }': width, heightts(2739)
and similarly with
<Decorator />
'Decorator' cannot be used as a JSX component. Its return type 'unknown[]' is not a valid JSX element. Type 'unknown[]' is missing the following properties from type 'Element': type, props, keyts(2786)
When does it happen?
with the definitions
const Tooltip = ({ width, height }) => { // ... const Decorator = ({ x, y, data }) => {
What platform?
- [x] iOS
- [ ] Android
react-native version:
0.61.4
react-native-svg-charts version:^5.3.0
react-native-svg version:11.0.1
Code to reproduce
// put code here
Did you fix this?