Skip to content

iOS longPress does not trigger onPressIn in the beginning #4754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
Iskander508 opened this issue Apr 8, 2025 · 0 comments
Open
2 tasks done

iOS longPress does not trigger onPressIn in the beginning #4754

Iskander508 opened this issue Apr 8, 2025 · 0 comments

Comments

@Iskander508
Copy link

Iskander508 commented Apr 8, 2025

Did you test using the latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test fail and you're not sure why?

  • I have read the troubleshooting guide and it didn't help me.

What happened?

Detox longPress action does not trigger the TouchableOpacity onPressIn callback immediately, only in the end of the action.

Help us reproduce this issue!

I have created a small reproducible demo here: https://github.com/Iskander508/detox-long-press-test

In what environment did this happen?

Detox version: 20.36.4
React Native version: 0.78.2 (also reproduced with 0.77.1)
Has Fabric (React Native's new rendering system) enabled: yes
Node version: 18.20.5
Device model: iPhone 16 Pro Max
iOS version: 18.2
macOS version: 15.3.2 (24D81)
Xcode version: 16.2
Test-runner: jest

Detox logs

Detox logs
11:51:24.077 detox[84898] E lifecycle beforeEach
11:51:24.077 detox[84898] B lifecycle test_fn
11:51:24.078 detox[84898] i ws-client send message
  data: {"type":"invoke","params":{"type":"action","action":"longPress","params":[null,5000],"predicate":{"type":"id","value":"button","isRegex":false}},"messageId":2}

 RUNS  e2e/longpress.test.js
11:51:24.078 detox[84897] i ws-server@61952 get
  data: {"type":"invoke","params":{"type":"action","action":"longPress","params":[null,5000],"predicate":{"type":"id","value":"button","isRegex":false}},"messageId":2}
11:51:24.078 detox[84897] i ws-server@61987 send
  data: {
    "type": "invoke",
    "params": {
      "type": "action",
      "action": "longPress",
      "params": [
        null,
        5000
      ],
      "predicate": {
        "type": "id",
        "value": "button",
        "isRegex": false
      }
    },
11:51:24.078 detox[84898] B ws-client long press for 5000ms
  data: {
    "type": "action",
    "action": "longPress",
    "params": [
      null,
      5000
    ],
    "predicate": {
      "type": "id",
      "value": "button",
      "isRegex": false
    }
  }
  stack: Object.longPress (/e2e/longpress.test.js:7:36)
  Generator.next (<anonymous>)
  asyncGeneratorStep (/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:17)
  _next (/node_modules/@babel/runtime/helpers/asyncToGenerator.js:17:9)
  /node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:7
  new Promise (<anonymous>)
  Object.<anonymous> (/node_modules/@babel/runtime/helpers/asyncToGenerator.js:14:12)
  Promise.then.completed (/node_modules/jest-circus/build/utils.js:298:28)
  new Promise (<anonymous>)
  callAsyncCircusFn (/node_modules/jest-circus/build/utils.js:231:10)
  _callCircusTest (/node_modules/jest-circus/build/run.js:316:40)
  _runTest (/node_modules/jest-circus/build/run.js:252:3)
  _runTestsForDescribeBlock (/node_modules/jest-circus/build/run.js:126:9)
  _runTestsForDescribeBlock (/node_modules/jest-circus/build/run.js:121:9)
  run (/node_modules/jest-circus/build/run.js:71:3)
  runAndTransformResultsToJestFormat (/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
  jestAdapter (/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
  runTestInternal (/node_modules/jest-runner/build/runTest.js:367:16)
  runTest (/node_modules/jest-runner/build/runTest.js:444:34)

 RUNS  e2e/longpress.test.js
11:51:30.980 detox[84897] i ws-server@61987 get
  data: {"params":{},"messageId":2,"type":"invokeResult"}
11:51:30.981 detox[84897] i ws-server@61952 send
  data: {
    "params": {},
    "messageId": 2,
11:51:30.981 detox[84898] i ws-client get message
  data: {"params":{},"messageId":2,"type":"invokeResult"}
   
11:51:30.982 detox[84898] E ws-client long press for 5000ms
11:51:30.983 detox[84898] E lifecycle test_fn
11:51:30.983 detox[84898] B artifacts-manager onTestDone
  args: ({"title":"longPress 5secs","fullName":"Test longPress 5secs","status":"passed","invocations":1})
11:51:30.984 detox[84898] i artifact:ARTIFACT_STOP stopping SimulatorLogRecording
11:51:31.037 detox[84898] i child-process:SPAWN_KILL sending SIGINT to: /usr/bin/xcrun simctl spawn 48886A6C-C6C8-4277-88A7-0028FE9DB29A log stream --level debug --style compact --predicate processImagePath beginsWith "/Users/pavelzarecky/Library/Developer/CoreSimulator/Devices/48886A6C-C6C8-4277-88A7-0028FE9DB29A/data/Containers/Bundle/Application/6741FB08-44CC-44EB-95A6-30A3A33EFD88/detoxlongpresstest.app"
11:51:31.052 detox[84898] i child-process:SPAWN_END /usr/bin/xcrun simctl spawn 48886A6C-C6C8-4277-88A7-0028FE9DB29A log stream --level debug --style compact --predicate "processImagePath beginsWith \"/Users/pavelzarecky/Library/Developer/CoreSimulator/Devices/48886A6C-C6C8-4277-88A7-0028FE9DB29A/data/Containers/Bundle/Application/6741FB08-44CC-44EB-95A6-30A3A33EFD88/detoxlongpresstest.app\"" exited with code #0
11:51:31.054 detox[84898] E artifacts-manager onTestDone
11:51:31.054 detox[84898] E lifecycle longPress 5secs
11:51:31.055 detox[84898] i lifecycle Test: longPress 5secs [OK]

Device logs

device.log

Video

video showing difference of longPress behavior (in regards to the TouchableOpacity callbacks) compared to manual long press:

longpress_y9Ok67Ws.mp4

Strangely it looks like the callbacks are called internally, but do not manifest visually. The react states appear only after the button press is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant