Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Creating an interface for react-native dynamic component (wrapper element)

$
0
0
export interface IWEProps {  accessibilityLabel: string;  onPress?: ((status: string | undefined) => void) | undefined;  localePrefix: string;  children: JSX.Element[];  style: IWEStyle;  type?: string;}class WrappingElement extends  React.PureComponent<IWEProps> {  render() {    const {      onPress, children, type, accessibilityLabel, style,    } = this.props;    return onPress ? (<TouchableOpacity        accessibilityLabel={accessibilityLabel}        style={style}        type={type}        onPress={() => onPress(type)}>        { children }</TouchableOpacity>    ) : (<View        accessibilityLabel={accessibilityLabel}        style={style}        type={type}>        { children }</View>    );  }}

This is what I am doing, and this is an error I'm getting on type prop in View and TouchableOpacity:

Property 'type' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly'.


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>