项目场景:
要求在手机端实现类似于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里面。
3、Error: currentlyFocusedField is deprecated and will be removed in a future release. Use currentlyFocusedinput
本意是:目前focusedfield()已弃用,将在未来的版本中移除。使用currentlyFocusedinput()
原因分析:
由于当前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吧!!!!谢谢