React Native Large List V3高性能列表组件-踩坑记录

项目场景:

要求在手机端实现类似于web端的表格UI功能,
想到可以使用该组件。
原生桥接实现的一组高性能弹性大列表组件,支持超大数据源,高度重用,极大地优化了性能,滑动更跟手,完全可以媲美原生列表。CPU和内存占用比官方的SectionList明显少很多。

当前使用版本:
“react”: “17.0.1”,
“react-native”: “0.64.0”,
“react-native-largelist-v3”: “^3.0.15”,
“react-native-spring-scrollview”: “^2.0.23”,


问题描述:

1、当前组件版本为v3,基于react-native@0.50.0开发。所以页也必然会有适配问题发生。

版本问题
2、Error: Unable to resolve module ‘react-native/lib/TextInputState’ from ‘node-modules/react-native-spring-scrollview/SpringScrollView.js’ : react-native/lib/TextInputState could not be found within the project
表示无法解析该模块,也是就是说无法找到该目录,在这个node-modules/react-native-spring-scrollview/SpringScrollView.js里面。
BUG
3、Error: currentlyFocusedField is deprecated and will be removed in a future release. Use currentlyFocusedinput
本意是:目前focusedfield()已弃用,将在未来的版本中移除。使用currentlyFocusedinput()
BUG


原因分析:

由于当前react-native-largelist-v3需要配套react-native-spring-scrollview滚动组件,并且组件一直在v3版本,适配的react-native版本也是0.50。而react-native在0.59之后开始大改,某些文件路径也随着更改,特定的一些功能页也跟着移除。


解决方案:

一、Error: Unable to resolve module 'react-native/lib/TextInputState' from 'node-modules/react-native-spring-scrollview/SpringScrollView.js' : react-native/lib/TextInputState could not be found within the project

答:
1.1、在node_modules中找到react-native-spring-scrollview文件并在其中找到SpringScrollView.js

文件路径
1.2、在当前文件搜索
import * as TextInputState from “react-native/libTextInputState”;
替换成:
import * as TextInputState from “react-native/Libraries/Components/TextInput/TextInputState”;
文件路径
二、Error: currentlyFocusedField is deprecated and will be removed in a future release. Use currentlyFocusedinput
答:
也还是在这个文件’SpringScrollView.js’中搜索
currentlyFocusedField() 替换成 currentlyFocusedInput()
在这里插入图片描述


好了,已经解决,可以完美运行。

官网链接.
其中就有demo源码,复制去run吧!!!!谢谢

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值