ReactNative常见的报错,踩坑

ReactNative常见的报错,踩坑

持续更新中。。。。

常见错误

点击事件,点击了几次就发生这样的错误

Attempted to transition from state RESPONDER_INACTIVE_PRESS_IN to RESPONDER_ACTIVE_LONG_PRESS_IN, which is not supported. This is most likely due to Touchable.longPressDelayTimeout not being cancelled.

解决方法: 用TouchableOpacity把元素包起来,并且把事件注册到这个元素中

使用字体图标时,执行程序发现了这样的报错

> Task :react-native-vector-icons:generateDebugBuildConfig FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings
68 actionable tasks: 30 executed, 38 up-to-date
ע: E:\Exercise\reactNative\todos\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerButtonViewManager.javaʹ�û򸲸����ѹ�ʱ�� API�
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣
ע: ijЩ�����ļ�ʹ����δ�����򲻰�ȫ�IJ�����
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:unchecked ���±��롣
ע: E:\Exercise\reactNative\todos\node_modules\react-native-reanimated\android\src\main\java\com\swmansion\reanimated\NodesManager.javaʹ�û򸲸����ѹ�ʱ�� API��
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣
ע: E:\Exercise\reactNative\todos\node_modules\react-native-reanimated\android\src\main\java\com\swmansion\reanimated\NodesManager.javaʹ����δ�����򲻰�ȫ�IJ�����
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:unchecked ���±��롣
ע: ijЩ�����ļ�ʹ�û򸲸����ѹ�ʱ�� API��
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣
ע: ijЩ�����ļ�ʹ����δ�����򲻰�ȫ�IJ�����
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:unchecked ���±��롣

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-vector-icons:generateDebugBuildConfig'.
> java.io.IOException: Unable to delete directory E:\Exercise\reactNative\todos\node_modules\react-native-vector-icons\android\build\generated\source\buildConfig\debug\com\oblador.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 11s

解决方法:重新按照官网配置一下react-native-vector-icons即可

使用FlatList添加justifyContent出现这样的报错

Invariant Violation: ScrollView child layout (["justifyContent"]) must be applied through the contentContainerStyle prop.

解决方法:把样式写在/指定在contentContainerStyle

程序不刷新

执行的程序会弹出一个nodeJS窗口可以让当控制台来使用,或者来刷新程序,但是按R时程序只显示Reloading app...没有按个绿条重新加载

解决方法:打开debug网页,打开控制台,在浏览器刷新按钮那右键,选择清空缓存和硬性重新加载

常见警告

Debug页面没在焦点状态

Remote debugger is in a background tab which may cause apps to perform slowly. Fix this by foregrounding the tab (or opening it in a separate window).
解决方法:这是你开启了Debug功能后,如果当前网页不是这个debug页面则会报这个警告

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值