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

viewpager android has been removed from react native

Open abbasmoosavi opened this issue 5 years ago • 21 comments

abbasmoosavi avatar Sep 29 '19 05:09 abbasmoosavi

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'

abbasmoosavi avatar Sep 29 '19 05:09 abbasmoosavi

Kindly update this library, I also face this issue

tusharmutreja avatar Oct 04 '19 10:10 tusharmutreja

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?

harshit-prog avatar Oct 07 '19 10:10 harshit-prog

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

abbasmoosavi avatar Oct 13 '19 12:10 abbasmoosavi

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

Thanks @abbasmoosavi

harshit-prog avatar Oct 14 '19 05:10 harshit-prog

@harshit-prog You 're wellcome

abbasmoosavi avatar Oct 15 '19 12:10 abbasmoosavi

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

npm i @shankarmorwal/rn-viewpager

morwalz avatar Jan 06 '20 18:01 morwalz

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 :)

Gricardov avatar Feb 17 '20 23:02 Gricardov

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

rpeg avatar Mar 22 '20 20:03 rpeg

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?

akash89bis avatar Mar 30 '20 08:03 akash89bis

@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.

morwalz avatar Mar 31 '20 11:03 morwalz

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.

handipriyono avatar Apr 09 '20 03:04 handipriyono

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

ngocht143 avatar Jun 09 '20 06:06 ngocht143

@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

handipriyono avatar Jun 09 '20 07:06 handipriyono

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

ngocht143 avatar Jun 09 '20 07:06 ngocht143

@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,,

handipriyono avatar Jun 09 '20 07:06 handipriyono

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

morwalz avatar Jun 09 '20 07:06 morwalz

@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>
    )
}

}`

ngocht143 avatar Jun 09 '20 07:06 ngocht143

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

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

handipriyono avatar Jun 09 '20 07:06 handipriyono

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

ngocht143 avatar Jun 09 '20 07:06 ngocht143

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

amitntrivedi avatar Jul 27 '20 10:07 amitntrivedi