I'm trying to create a Typescript definition for the React Native component "react-native-tabs" and I'm getting the following error on the Text element:
Property 'name' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes
Does anyone know how to modify my ts definition so I can tell the compiler that 'name' is a string property of Text when a child of Tabs?
My JSX looks like:
<Tabs selected={this.state.page} style={{backgroundColor:'white'}}
selectedStyle={{color:'red'}} onSelect={el=>this.setState({page:el.props.name})}>
<Text name="first">First</Text>
<Text name="second" selectedIconStyle={{borderTopWidth:2,borderTopColor:'red'}}>Second</Text>
<Text name="third">Third</Text>
<Text name="fourth" selectedStyle={{color:'green'}}>Fourth</Text>
<Text name="fifth">Fifth</Text>
</Tabs>
My Typescript definition looks like:
declare module "react-native-tabs" {
import React, { Component } from "react";
interface TabProps {
style?: React.ViewStyle;
selectedStyle?: {};
onSelect?: (el:any) => void;
selected?: string
}
export default class Tabs extends Component<TabProps, any> {
constructor(props: TabProps);
}
}
Thanks :-)
react-native?