Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

viewpager android has been removed from react native #180

Open
abbasmoosavi opened this issue Sep 29, 2019 · 21 comments
Open

viewpager android has been removed from react native #180

abbasmoosavi opened this issue Sep 29, 2019 · 21 comments

Comments

@abbasmoosavi
Copy link

No description provided.

@abbasmoosavi
Copy link
Author

I fixed it by

import { PanResponder, Platform, ScrollView, StyleSheet, View } from 'react-native'
import ViewPagerAndroid from "@react-native-community/viewpager";
import React, { Component } from 'react'

@tusharmutreja
Copy link

Kindly update this library, I also face this issue

@harshit-prog
Copy link

I fixed it by

import { PanResponder, Platform, ScrollView, StyleSheet, View } from 'react-native'
import ViewPagerAndroid from "@react-native-community/viewpager";
import React, { Component } from 'react'

Please tell me. How can I update it in my code?

@abbasmoosavi
Copy link
Author

@harshit-prog use this module react-native-best-viewpager
I fixed in this module

@harshit-prog
Copy link

@harshit-prog use this module react-native-best-viewpager
I fixed in this module

Thanks @abbasmoosavi

@abbasmoosavi
Copy link
Author

@harshit-prog You 're wellcome

@morwalz
Copy link

morwalz commented Jan 6, 2020

I have fixed this issue. Use this package https://www.npmjs.com/package/@shankarmorwal/rn-viewpager

npm i @shankarmorwal/rn-viewpager

@Gricardov
Copy link

Gricardov commented Feb 17, 2020

I have the solution.
1- Install this: @react-native-community/viewpager
2- Search for all the files named TabViewPagerAndroid whitin your node_modules folder
3- Open it and change this line
import { View, ViewPagerAndroid, StyleSheet, I18nManager } from 'react-native';

for this:

import { View, /* ViewPagerAndroid, */ StyleSheet, I18nManager } from 'react-native';
import ViewPagerAndroid from "@react-native-community/viewpager";

You are welcome :)

@rpeg
Copy link

rpeg commented Mar 22, 2020

@Gricardov Not a good practice -- that hard-fix isn't going to be recorded in VCS history. Better to change the module altogether.

@akash89bis
Copy link

Hi @abbasmoosavi After changing --
import {PagerTabIndicator, IndicatorViewPager, PagerTitleIndicator, PagerDotIndicator} from 'rn-viewpager'
to
import {PagerTabIndicator, IndicatorViewPager, PagerTitleIndicator, PagerDotIndicator} from 'react-native-best-viewpager';

I get below error -
Invariant Violation: requireNativeComponent: "RNCViewPager" was not found in the UIManager.

What is the mistake I am doing?

@morwalz
Copy link

morwalz commented Mar 31, 2020

@akash89bis I fixed this issue and made a copy of this package. Use npm i @shankarmorwal/rn-viewpager

There are some deprecated code is used, i plan to update that as well. For now this will work with warnings.

@handipriyono
Copy link

I fixed it by
import { PanResponder, Platform, ScrollView, StyleSheet, View } from 'react-native'
import ViewPagerAndroid from "@react-native-community/viewpager";
import React, { Component } from 'react'

Please tell me. How can I update it in my code?

Hi, you can download the fixed version of rn-viewpager using this package,
https://www.npmjs.com/package/rn-viewpager-handy
which use the latest viewpager from react-native community

it also fixed: Invariant Violation: requireNativeComponent: "RNCViewPager" was not found in the UIManager. make sure you guys read installation instruction in that repository.

@ngocht143
Copy link

@handipriyono I'm facing this issue with version ^1.5.0
Simulator Screen Shot - iPhone 7 - 2020-06-09 at 13 46 37

@handipriyono
Copy link

@handipriyono I'm facing this issue with version ^1.5.0
Simulator Screen Shot - iPhone 7 - 2020-06-09 at 13 46 37

If you installed rn-viewpager from zbtang before, make sure you uninstall previous React native viewpager from zbtang ( step 1 and 2 ) , if not, goto step 3.

  1. react-native unlink rn-viewpager
  2. npm uninstall rn-viewpager --save
  3. Delete node_modules, by running ----> rm -rf node_modules
  4. npm i rn-viewpager-handy
  5. npm install
  6. react-native link @react-native-community/viewpager

@ngocht143
Copy link

@handipriyono I'm using yarn remove rn-viewpager then yarn add rn-viewpager-handy.
Now i'm facing this issue: https://prnt.sc/swd04g

@handipriyono
Copy link

@handipriyono I'm using yarn remove rn-viewpager then yarn add rn-viewpager-handy.
Now i'm facing this issue: https://prnt.sc/swd04g

the problem is in your code, Component. not in that viewpager package.
it's better that you share your whole current page code, instead of just share screenshot,,

@morwalz
Copy link

morwalz commented Jun 9, 2020

you can also try npm i @shankarmorwal/rn-viewpager
it will work.

@ngocht143
Copy link

@handipriyono yes, thanks for your reply, this is my code:

`import React from 'react'
import { View, Text, } from 'react-native'
import Touchable from '../Touchable';
import { IndicatorViewPager, PagerDotIndicator } from 'rn-viewpager-handy'
import { SCREEN_WIDTH } from '../../common/Configs';

export default class NewsletterItemGrid extends React.PureComponent {
constructor(props) {
super(props)
this.state = {
listImgs: [
'https://img.cintamobil.com/2020/04/24/20200424125457-d0e0.jpg',
'https://img.cintamobil.com/2020/04/24/20200424125519-f1e0.jpg',
'https://img.cintamobil.com/2020/04/24/20200424125537-3365.jpg',
'https://img.cintamobil.com/2020/04/24/20200424125556-c11c.jpg',
'https://img.cintamobil.com/2020/04/24/20200424125641-b32e.jpg'
],
}
}

renderIndicator = () => {
    return (
        <PagerDotIndicator pageCount={3} />
    )
}

render() {
    return (
        <View style={{ borderRadius: 8 }}>
            <IndicatorViewPager
                style={{ width: SCREEN_WIDTH, height: SCREEN_WIDTH / 1.78 }}
                indicator={this.renderIndicator}>
                <View style={{ backgroundColor: "cadetblue" }}>
                    <Text>page one</Text>
                </View>
                <View style={{ backgroundColor: "cornflowerblue" }}>
                    <Text>page two</Text>
                </View>
                <View style={{ backgroundColor: "#1AA094" }}>
                    <Text>page three</Text>
                </View>
            </IndicatorViewPager>
        </View>
    )
}

}`

@handipriyono
Copy link

@ngocht143 , in your code,
indicator={this.renderIndicator}>

that should be invoked,
--->. indicator={this.renderIndicator() }>

@ngocht143
Copy link

thank @handipriyono, it's ok for me now :D

@amitntrivedi
Copy link

Install the new package with below npm command

npm install --save @shankarmorwal/rn-viewpager

and replace the line from
import {PagerTabIndicator, IndicatorViewPager, PagerTitleIndicator, PagerDotIndicator} from 'rn-viewpager';
to
import {PagerTabIndicator, IndicatorViewPager, PagerTitleIndicator, PagerDotIndicator} from '@shankarmorwal/rn-viewpager';

It should work.

More details
https://www.npmjs.com/package/@shankarmorwal/rn-viewpager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants