Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invariant Violation: ViewPagerAndroid has been removed from React Native.'react-native-viewpager' instead of 'react-native'

Tags:

react-native

when I implement Image-slider on my application using this example that time I have faced this error.

import React,{Component} from 'react'
    import {View,Text,TouchableOpacity, ViewPagerAndroid} from 'react-native'
    import Infoslider from 'react-native-infoslider'
     export default class example extends Component {
      constructor(props) {
        super(props);
        this.state = {
          data:[
              {
              title:"Hello World", 
              text:"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard",
              image: require('../Images/Group.png')}
             ]
        };
      }
      render() {
        return (
         <Infoslider 
            data={this.state.data} />
        );
      }
    }

Error Like this

like image 982
Manoj Kashyam Avatar asked Jan 10 '20 11:01

Manoj Kashyam


1 Answers

You should update the react-native-swiper module to nightly. Then, npm clear cache.
Please follow this:

  1. cd android
  2. ./gradlew clean
  3. cd ..
  4. yarn remove react-native-swiper
  5. yarn add react-native-swiper@nightly
  6. rm -rf node_modules
  7. npm cache clean --force
  8. npm install
  9. react-native run-android

it will work. but if no, please restart system.

like image 96
Itdevstar Avatar answered Oct 17 '22 08:10

Itdevstar