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

Getting "Types of property 'accessibilityRole' are incompatible" error

$
0
0

Am getting typescript error when i extend th TextProps from react-native and pass it to the Text component created by styled-component

  Overload 1 of 2, '(props: Omit<Omit<ActivityIndicatorProps & RefAttributes<ActivityIndicator> & { styles?: string | undefined; }, never> & Partial<...>, "theme"> & { ...; } & { ...; } & { ...; }): ReactElement<...>', gave the following error.Type '{ styles?: string | undefined; animating?: boolean | undefined; color: ColorValue; hidesWhenStopped?: boolean | undefined; size?: number | "small" | "large" | undefined; ... 52 more ...; accessibilityIgnoresInvertColors?: boolean | undefined; }' is not assignable to type 'Omit<Omit<ActivityIndicatorProps & RefAttributes<ActivityIndicator> & { styles?: string | undefined; }, never> & Partial<...>, "theme">'.  Types of property 'accessibilityRole' are incompatible.

rn-snippet

import styled from 'styled-components/native';import { TextProps as RNTextProps } from 'react-native';interface TextProps extends RNTextProps {}const TextStyled = styled.Text``;const Text = (props:TextProps) => {    const { children, ...rest } = props;    return (<TextStyled {...rest}>            {children}</TextStyled>    );};export default Text;

and packages.json

"react-native": "0.67.1","@types/react-native": "^0.66.15","styled-components": "^5.3.3","@types/styled-components-react-native": "^5.1.3",

Thanks in Advance


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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