javascript - nativeEvent 对象未出现在 React Native 中
问题描述
我正在尝试使用本机反应在我的移动应用程序上集成简单的地图,并希望获取用户在屏幕上点击的位置坐标。使用的库是以 MapView 作为组件的 react-native-maps。
当我尝试点击屏幕以获取点击区域的坐标时,如果我 console.log 在我的控制台上记录 onPress() 事件,则不会出现 nativeEvent 对象。相反,我得到了 "_nativeTag": 3,它没有出现在我搜索的许多教程和博客中。
请告诉此查询的任何解决方案或替代方案。
SyntheticEvent {
"_dispatchInstances": FiberNode {
"tag": 5,
"key": null,
"type": "AIRMap",
},
"_dispatchListeners": [Function selectLocationHandler],
"_targetInst": FiberNode {
"tag": 5,
"key": null,
"type": "AIRMap",
},
"bubbles": undefined,
"cancelable": undefined,
"currentTarget": ReactNativeFiberHostComponent {
"_children": Array [],
"_internalFiberInstanceHandleDEV": FiberNode {
"tag": 5,
"key": null,
"type": "AIRMap",
},
*****"_nativeTag": 3,*****
"viewConfig": Object {
"Commands": Object {
"animateCamera": 12,
"animateToBearing": 4,
"animateToCoordinate": 2,
"animateToNavigation": 9,
"animateToRegion": 1,
"animateToViewingAngle": 3,
"fitToCoordinates": 7,
"fitToElements": 5,
"fitToSuppliedMarkers": 6,
"setCamera": 11,
"setIndoorActiveLevelIndex": 10,
"setMapBoundaries": 8,
},
解决方案
推荐阅读
- html - HTML 在图像底部添加扩展边框并在其上写入文本
- github - 通过 API 获取 GitHub 存储库的只读属性
- arrays - MongoDB 从对象数组中查找平均值
- vue.js - Vuetify Snackbar 在 x 秒后消失,如何防止
- c++ - 有没有办法在 STL 中禁用异常,或者使用 EASTL 是唯一的选择?
- mysql - SQL 考试规范化问题
- php - 如何在新查询中使用查询结果作为参数?
- html - 如何在表格中格式化特殊的 TD?
- java - 为什么我仍然有这个错误分离实体传递给坚持:用户 - SpringBoot
- bash - 删除所有包含特定表达式的文件