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

Type is missing the following properties from type in TypeScript of React-Native app

$
0
0

I have installed https://github.com/react-native-community/react-native-modal library and I need to make a wrapper Modal class. The first initialize Interface. It extends from a few interfaces from react-native and react-native-modal libraries. It means I can use all properties from both of them:

import { ModalProps } from 'react-native';import { ReactNativeModal, ModalProps as ModalRNProps } from 'react-native-modal';export interface IModalProps extends Omit<ModalProps, 'onShow'>, ModalRNProps {  showCloseButton?: boolean;  showDoneBar?: boolean;}export class ModalNew extends React.Component<IModalProps> {  public render() {    const {      style,      children,      showCloseButton,      showDoneBar,      animationType,      onRequestClose,      ...props    } = this.props;    return (<ReactNativeModal       isVisible={this.props.isVisible}       onModalWillHide={onRequestClose}       animationIn={'slideInUp'}       animationOut={'slideOutDown'}       animationOutTiming={600}       useNativeDriver={true}       backdropOpacity={0.6}       backdropColor={theme.black}       style={style}       {...props}>       {children}</ReactNativeModal>    );  }}

But after when I use it in other component:

import React, { Component } from 'react';import { ModalNew } from './ModalNew';export class FooterHiddenPanel extends Component {  const props = this.props;  render() {    return (<ModalNew isVisible={props.isActive} onRequestClose={props.onRequestClose}><Text>This is </Text></ModalNew>    );  }}

I get this error:

enter image description here

It means I have to use all properties from both PropsTypes that I has extended my interface. But I don't need all of them. If I extend my class from a few interfaces I must implement all properties? Can you tell me please how can I get rid from this error?


Viewing all articles
Browse latest Browse all 6212

Trending Articles



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