gpt4 book ai didi

react-native - 不变违规 : ViewPagerAndroid has been removed from React Native .'react-native-viewpager' instead of 'react-native'

转载 作者:行者123 更新时间:2023-12-03 16:43:56 29 4
gpt4 key购买 nike

当我使用这个例子在我的应用程序上实现 Image-slider 时,我遇到了这个错误。

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

最佳答案

您应该将 react-native-swiper 模块更新为 nightly。然后,npm 清除缓存。
请遵循:

  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


它会起作用的。但如果没有,请重新启动系统。

关于react-native - 不变违规 : ViewPagerAndroid has been removed from React Native .'react-native-viewpager' instead of 'react-native' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59680596/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com