小编Soo*_*ran的帖子

反应原生触发/模拟触摸事件

如何在 React Native 中模拟触摸事件?

基本上我有 onPress 事件的 X 和 Y 坐标,并且想在同一位置再次触发触摸事件。

这在 JavaScript 中是可行的

document.elementFromPoint(x, y).click();
Run Code Online (Sandbox Code Playgroud)

但在RN可行吗?

javascript event-handling touch-event reactjs react-native

5
推荐指数
0
解决办法
1272
查看次数

链接以在javascript中强制转换类型

   let finalPrice = room.points[0].price.finalPrice //string
   finalPrice = +finalPrice //number
   finalPrice = finalPrice.toFixed(2) //2 decimal
Run Code Online (Sandbox Code Playgroud)

是否可以缩短上述类型的转换?

如果我做

+room.points[0].price.finalPrice.toFixed(2)
Run Code Online (Sandbox Code Playgroud)

我会收到此错误: toFixed is not a function

javascript

1
推荐指数
1
解决办法
50
查看次数