zbtang/React-Native-ViewPager

OnPageSelected No overload matches this call.

Opened this issue · 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): 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 & Readonly & Readonly<...>'.
Property 'onPageSelected' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly & 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 & Readonly & Readonly<...>'.
Property 'onPageSelected' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<...>'.ts(2769)

Do anyone has any fix fo this?