问题:

Ios dev版本,使用第三方插件react-navigation做页面导航时,点返回按钮时报如下错:

Unsupported top level event type "onGestureHandlerStateChange" dispatched

开发环境如如下:

"react-native": "0.55.4",

"react-navigation": "^3.11.0",

"react-native-gesture-handler": "^1.0.16",

解决方案:

如果你的react-native 版本是0.52-0.55之间,则在app启动页index.js最上方加上如下代码:

import UIManager from "UIManager";for (let k in UIManager) {if (UIManager.hasOwnProperty(k) && UIManager[k] && UIManager[k].directEventTypes) {UIManager[k].directEventTypes.onGestureHandlerEvent = {registrationName: "onGestureHandlerEvent"};UIManager[k].directEventTypes.onGestureHandlerStateChange = {registrationName: "onGestureHandlerStateChange"};}}

添加后的 index.js:

import UIManager from "UIManager";
for (let k in UIManager) {if (UIManager.hasOwnProperty(k) && UIManager[k] && UIManager[k].directEventTypes) {UIManager[k].directEventTypes.onGestureHandlerEvent = {registrationName: "onGestureHandlerEvent"};UIManager[k].directEventTypes.onGestureHandlerStateChange = {registrationName: "onGestureHandlerStateChange"};}
}import React, { Component } from 'react';
import {AppRegistry
} from 'react-native';import SetUp from './app/SetUp';
AppRegistry.registerComponent('loveChatApp', () =>SetUp );

如果是其他版本则在index.js最上方加上如下代码:

import 'react-native-gesture-handler'

参考文档:

https://github.com/kmagiera/react-native-gesture-handler/issues/320

Unsupported top level event type onGestureHandlerStateChange dispatched相关推荐

  1. 编译驱动时报错:./arch/x86/include/asm/atomic64_64.h: At top level:

    在编译6ULL驱动的时候程序报错: base.c:4: ./arch/x86/include/asm/atomic64_64.h: At top level: ./arch/x86/include/a ...

  2. Expressions are not allowed at the top level

    Swift中,直接在类的外面调用类内部的方法,会出现Bug:Expressions are not allowed at the top level. 原因是: 在App工程里, .swift 文件都 ...

  3. 一个函数处理同个元素多个事件行为------event.type

    // 一个函数处理同个元素的多个事件var oBtn=document.querySelector('#btn');oBtn.onclick=handler;oBtn.onmouseover=hand ...

  4. PAT (Top Level) Practise 1008 Airline Routes(Tarjan模版题)

    1008. Airline Routes (35) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue Given a ...

  5. react 中使用import()实现按需加载报错 解决方法 --‘import’ and ‘export’ may only appear at the top level

    react 中使用import()实现按需加载报错 解决方法 --'import' and 'export' may only appear at the top level 参考文章: (1)rea ...

  6. Debezium报错处理系列九:“ddl“ : “# Dummy event replacing event type 160 that slave cannot handle.“

    Debezium报错处理系列九:"ddl" : "# Dummy event replacing event type 160 that slave cannot han ...

  7. Protobuf的奇怪问题解决--Expected top - level statement (e.g message)

    最近天天都在玩Protobuf,因此,最近总结的问题过半都是关于它的.话说昨天遇到一个很奇怪的问题,转换.proto为java文件的过程中,报错:Expected top - level statem ...

  8. nib must contain exactly one top level object which must be a UITableViewCell instance

    今天突然报了这个错误:"nib must contain exactly one top level object which must be a UITableViewCell insta ...

  9. iOS开发-invalid nib registered for identifier (Cell) - nib must contain exactly one top level object

    error reason: 'invalid nib registered for identifier (WorksCell) - nib must contain exactly one top ...

最新文章

  1. 原创 | IJCAI 2020灭霸式拒稿,AI审稿是否更公平?
  2. hdu4920 矩阵乘法%3
  3. LeetCode-80: 删除排序数组中的重复项 II
  4. Codeforces Round #496 (Div. 3)【未完结】
  5. SVM 核函数相关知识
  6. android 获取当前网络,Android 获取当前网络连接的类型信息
  7. Dojo学习笔记(一):Hello Dojo!
  8. MyBatis-Plus_断言
  9. 如何查看外网ip地址_如何查看本机ip地址?
  10. JAVA大数——lightoj1024
  11. ruby设计模式之观察者模式2————更加一般化的观察者模式
  12. Atitit.Hibernate中Criteria 使用总结and 关联查询 and 按照子对象查询 o9o
  13. 免费下载百度文库需下载券文件
  14. 网络经商赚钱经典50问
  15. cadence17.2小白eda365skill 安装教程
  16. 安装postgreSQL出现configure:error:readline library not found解决方法及pg安装全过程
  17. 佳蓝php智能应答系统|在线客服 v1.0,佳蓝PHP智能应答系统|在线客服 v1.0
  18. 微信中扫一扫自动调用手机外部浏览器打开链接下载APP(APK)
  19. 利率里面的BP是什么意思,基准利率bp是什么意思
  20. VS无法下载,提示无法连接到网络

热门文章

  1. IT忍者神龟之修改IE地址栏Tomcat 小猫咪图标
  2. 代码随想录算法训练营第六天|454.四数相加II,383. 赎金信,15. 三数之和,18. 四数之和。
  3. C/C++ TCHAR* 作为函数返回值的问题
  4. c# 使用多个TASK事务,等待返回值
  5. 海思3559万能平台搭建:DDR移植的一些问题
  6. ObjectARX 创建AcDbLeader引线附着块对象实例
  7. MYSQL把字符串按逗号拆分
  8. 推荐系统之推荐中心逻辑
  9. halcon MLP分类器
  10. Zygote进程探索