React-Native-ViewPager icon indicating copy to clipboard operation
React-Native-ViewPager copied to clipboard

OnPageSelected No overload matches this call.

Open dinesh547 opened this issue 5 years ago • 0 comments

I am trying to use the rn-viewpager. But getting a warning on using OnPageSelected Inside <IndicatorViewPager

Code is something like this

<IndicatorViewPager style={{ height: height - (Platform.OS === 'android' ? 50 : 80) }} indicator={this.renderDotIndicator()} onPageSelected={this.getSelectedPage} ref={viewPager => { this.viewPager = viewPager; }}>

//Something here

Warning appears something like this.

(JSX attribute) onPageSelected: (e: any) => void No overload matches this call. Overload 1 of 2, '(props: Readonly<IndicatorViewPagerProps>): IndicatorViewPager', gave the following error. Type '{ children: Element[]; style: { height: number; }; indicator: Element; onPageSelected: (e: any) => void; ref: (viewPager: IndicatorViewPager | null) => void; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<IndicatorViewPager> & Readonly<IndicatorViewPagerProps> & Readonly<...>'. Property 'onPageSelected' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<IndicatorViewPager> & Readonly<IndicatorViewPagerProps> & Readonly<...>'. Overload 2 of 2, '(props: IndicatorViewPagerProps, context?: any): IndicatorViewPager', gave the following error. Type '{ children: Element[]; style: { height: number; }; indicator: Element; onPageSelected: (e: any) => void; ref: (viewPager: IndicatorViewPager | null) => void; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<IndicatorViewPager> & Readonly<IndicatorViewPagerProps> & Readonly<...>'. Property 'onPageSelected' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<IndicatorViewPager> & Readonly<IndicatorViewPagerProps> & Readonly<...>'.ts(2769)

Do anyone has any fix fo this?

dinesh547 avatar Mar 02 '20 07:03 dinesh547