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

Using TouchableOpacity with primary transparent gives typescript error

$
0
0

Below is the Code what i am trying to execute using typescript and react-native and it gives me typescript error in VSCODE IDE

import { TouchableOpacity } from "react-native";

<TouchableOpacity
    primary
    transparent
    onPress={this.send}
>
    <Text style={styles.btnText}>Send</Text>
</TouchableOpacity>

gives following typescript error in VSCode:

(alias) class TouchableOpacity
import TouchableOpacity
No overload matches this call.

Overload 1 of 2, '(props: Readonly<TouchableOpacityProps>): TouchableOpacity', gave the following error.

Type '{ children: Element; primary: true; transparent: true; onPress: () => void; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<TouchableOpacity> & Readonly<TouchableOpacityProps> & Readonly<{ children?: ReactNode; }>'.

Property 'primary' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<TouchableOpacity> & Readonly<TouchableOpacityProps> & Readonly<{ children?: ReactNode; }>'.

Overload 2 of 2, '(props: TouchableOpacityProps, context?: any): TouchableOpacity', gave the following error.

Type '{ children: Element; primary: true; transparent: true; onPress: () => void; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<TouchableOpacity> & Readonly<TouchableOpacityProps> & Readonly<{ children?: ReactNode; }>'.

Property 'primary' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<TouchableOpacity> & Readonly<TouchableOpacityProps> & Readonly<{ children?: ReactNode; }>'.ts(2769)

Viewing all articles
Browse latest Browse all 6208

Trending Articles



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