Unsupported top level event type onGestureHandlerStateChange dispatched
问题:
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相关推荐
- 编译驱动时报错:./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 ...
- Expressions are not allowed at the top level
Swift中,直接在类的外面调用类内部的方法,会出现Bug:Expressions are not allowed at the top level. 原因是: 在App工程里, .swift 文件都 ...
- 一个函数处理同个元素多个事件行为------event.type
// 一个函数处理同个元素的多个事件var oBtn=document.querySelector('#btn');oBtn.onclick=handler;oBtn.onmouseover=hand ...
- PAT (Top Level) Practise 1008 Airline Routes(Tarjan模版题)
1008. Airline Routes (35) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue Given a ...
- 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 ...
- Debezium报错处理系列九:“ddl“ : “# Dummy event replacing event type 160 that slave cannot handle.“
Debezium报错处理系列九:"ddl" : "# Dummy event replacing event type 160 that slave cannot han ...
- Protobuf的奇怪问题解决--Expected top - level statement (e.g message)
最近天天都在玩Protobuf,因此,最近总结的问题过半都是关于它的.话说昨天遇到一个很奇怪的问题,转换.proto为java文件的过程中,报错:Expected top - level statem ...
- 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 ...
- 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 ...
最新文章
- 原创 | IJCAI 2020灭霸式拒稿,AI审稿是否更公平?
- hdu4920 矩阵乘法%3
- LeetCode-80: 删除排序数组中的重复项 II
- Codeforces Round #496 (Div. 3)【未完结】
- SVM 核函数相关知识
- android 获取当前网络,Android 获取当前网络连接的类型信息
- Dojo学习笔记(一):Hello Dojo!
- MyBatis-Plus_断言
- 如何查看外网ip地址_如何查看本机ip地址?
- JAVA大数——lightoj1024
- ruby设计模式之观察者模式2————更加一般化的观察者模式
- Atitit.Hibernate中Criteria 使用总结and 关联查询 and 按照子对象查询 o9o
- 免费下载百度文库需下载券文件
- 网络经商赚钱经典50问
- cadence17.2小白eda365skill 安装教程
- 安装postgreSQL出现configure:error:readline library not found解决方法及pg安装全过程
- 佳蓝php智能应答系统|在线客服 v1.0,佳蓝PHP智能应答系统|在线客服 v1.0
- 微信中扫一扫自动调用手机外部浏览器打开链接下载APP(APK)
- 利率里面的BP是什么意思,基准利率bp是什么意思
- VS无法下载,提示无法连接到网络