采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
老师,我导入ScrollableTabView后,刚开始报错:ViewPropTypes没有定义。
然后我把ScrollableTabView里面报错的文件的propTypes里面的ViewPropTypes改成View.propsTypes,
重启运行后报错:Listener is not supported for native driven events。
这个问题应该怎么解决?
应该是版本问题,目前安装react-native-scrollable-tab-view的最新版本是0.9.0,我也碰到这个问题,琢磨了半天也没解决。老师的代码是0.7.0版本的,所以就降级安装了0.7.0版本,能够正常运行了。版本问题也是很头疼的事情,希望老师能尽早解决0.9.0版本的兼容问题
安装0.7.0版本:
npm install react-native-scrollable-tab-view@0.7.0 --save
导入ScrollableTabView应该不会报ViewPropTypes没有定义的错误,看一下你导入和使用它的方式是否正确呢:
可参考:
导入:
import ScrollableTabView, {ScrollableTabBar} from
'react-native-scrollable-tab-view'
使用:
<ScrollableTabView
tabBarUnderlineStyle={{backgroundColor:
'#e7e7e7'
, height: 2}}
tabBarInactiveTextColor=
'mintcream'
tabBarActiveTextColor=
'white'
ref=
"scrollableTabView"
tabBarBackgroundColor={
this
.state.theme.themeColor}
initialPage={0}
renderTabBar={() => <ScrollableTabBar style={{height: 40, borderWidth: 0, elevation: 2}}
tabStyle={{height: 39}}/>}
>
{
.state.languages.map((reuslt, i, arr)=> {
let language = arr[i];
return
language.checked ? <PopularTab key={i} tabLabel={language.name} {...
.props}/> : null;
})}
</ScrollableTabView>
另外:
按照提示的路径文件进行一些修改
<br>
我也遇到相同的问题,请问到底有什么方式去解决吗
升级react-native-scrollable-tab-view到最新版试一下
从昨天就遇到和题主一样的问题,也是改View.propsTypes,然后报Listener is not supported for native driven events的错误。 我使用npm install react-native-scrollable-tab-view --save应该就是使用最新版的了吧,"^0.8.0"。希望老师能解答一下
登录后可查看更多问答,登录/注册
一个真实的上线项目,一次完整的开发过程,全面掌握React Native技术
4.7k 12
1.2k 9
1.3k 9
1.6k 8
1.4k 7
购课补贴联系客服咨询优惠详情
慕课网APP您的移动学习伙伴
扫描二维码关注慕课网微信公众号