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

新手-请求集成react-native-swiper需要同时集成ViewPagerAndroid插件吗 #1101

Closed
GTooo opened this issue Nov 5, 2019 · 2 comments

Comments

@GTooo
Copy link

GTooo commented Nov 5, 2019

首先我使用得版本是:
Android
"react-native": "0.61.3",
"react-native-swiper": "^1.5.14",

新建得项目,然后实现swiper得调用代码后,run-android,后提示错误,没有其它实现引用ViewPagerAndroid的地方,在swiper的index.js确实找到ViewPagerAndroid,

错误提示如下:
Invariant Violation: ViewPagerAndroid has been removed from React Native. It can now be installed and imported from 'react-native-viewpager' instead of 'react-native'.See https://github.com/react-native-community/react-native-viewpager

看提示,我是否安装react-native-viewpager即可,但是ViewPagerAndroid应该是react native 自身就有的吧,又提示已经remove。。。。。

根据提示,添加插件以及引入如下:

import Swiper from 'react-native-swiper';
import ViewPager from '@react-native-community/viewpager';
import ViewPagerAndroid from 'react-native-viewpager';

再次运行,提示新的错误:

Error:Requiring module 'node_modules\react-native-viewpager\ViewPager.js',which threw an exceptioin:TyeError:undefined is not an object(evaluating 'React.PropTypes.func')

根据提示有看到viewpager里面有个js引用了React.PropTypes.func,百度了下,PropTypes好像已经从React中移除了,目前卡在这里了,有没有小伙遇到过这样的问题的,我不是第一个吧,,,我是需要去修改viewpager的PropTypes的引用吗。upupupu

@lisasu-g
Copy link

try yarn add react-native-swiper@nightly

@GTooo
Copy link
Author

GTooo commented Nov 11, 2019

@MarginCall2019 Thank you, this problem has been solved.

@GTooo GTooo closed this as completed Nov 11, 2019
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

2 participants