react-native
react-native copied to clipboard
onPress work one time only
Description
I try to create my bottom sheet. onPress work only one time, when pressable component is in root. Sometimes it's just the first time click, sometimes is after many clicks, and after does not work anymore. onPressIn work perfectly
The bug is on v0.73.7 (new arch, bridgless false) and v0.74.0 (new arch, bridgless true), tested only on Android.
Steps to reproduce
(TEST ON ANDROID, v0.73.7, and v0.74.0, new arch)
- Create component (BottomOption), that show only with state true, with pressable for testing
- In App component, add BottomOption inside GestureHandlerRootView.
- Click pressable inside screen, that change visible state of BottomOption.
- Try click pressable of BottomOption.
React Native Version
0.74.0
Affected Platforms
Runtime - Android
Output of npx react-native info
System:
OS: Windows 10 10.0.19045
CPU: "(2) x64 AMD Athlon Silver 3050U with Radeon Graphics "
Memory: 426.10 MB / 3.42 GB
Binaries:
Node:
version: 18.19.1
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 1.22.22
path: ~\AppData\Roaming\npm\yarn.CMD
npm:
version: 10.2.4
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Not Found
Visual Studio: Not Found
Languages:
Java: 17.0.10
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.74.0
wanted: 0.74.0
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
No crash or failure in logs
I try debug onPress call with console.log("TEST");
as onPress doesn't call, console.log too.
Reproducer
github.com/pigeonmal/react-native-onpress-bug
Screenshots and Videos
This is video of my app. Normally it's like the reproducer.
https://github.com/facebook/react-native/assets/40658543/408b7987-8291-4c71-a465-ec481ade907b
:warning: | Missing Reproducible Example |
---|---|
:information_source: | We could not detect a reproducible example in your issue report. Please provide either:
|
Descrição
Tento criar minha folha de baixo. onPress funciona apenas uma vez, quando o componente pressionável está na raiz. Às vezes é apenas o primeiro clique, às vezes depois de muitos cliques e depois não funciona mais. onPressIn funciona perfeitamente
O bug está na v0.73.7 (novo arco, bridgless falso) e v0.74.0 (novo arco, bridgless verdadeiro), testado apenas no Android.
Passos para reproduzir
(TESTE NO ANDROID, v0.73.7 e v0.74.0, novo arco)
- Criar componente (BottomOption), que mostra apenas com estado verdadeiro, com pressionável para teste
- No componente App, adicione BottomOption dentro de GestureHandlerRootView.
- Clique em pressionável dentro da tela, que altera o estado visível de BottomOption.
- Tente clicar pressionável em BottomOption.
Versão nativa do React
0,74,0
Plataformas afetadas
Tempo de execução - Android
Saída de
npx react-native info
System: OS: Windows 10 10.0.19045 CPU: "(2) x64 AMD Athlon Silver 3050U with Radeon Graphics " Memory: 426.10 MB / 3.42 GB Binaries: Node: version: 18.19.1 path: C:\Program Files\nodejs\node.EXE Yarn: version: 1.22.22 path: ~\AppData\Roaming\npm\yarn.CMD npm: version: 10.2.4 path: C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: Not Found Visual Studio: Not Found Languages: Java: 17.0.10 Ruby: Not Found npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.74.0 wanted: 0.74.0 react-native-windows: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: true iOS: hermesEnabled: Not found newArchEnabled: Not found
Stacktrace ou registros
No crash or failure in logs I try debug onPress call with console.log("TEST"); as onPress doesn't call, console.log too.
Reprodutor
github.com/pigeonmal/react-native-onpress-bug
Capturas de tela e vídeos
Este é o vídeo do meu aplicativo. Normalmente é como o reprodutor.
Registro_2024-04-24-22-06-44.mp4
Hey, @pigeonmal! Create a valid reproduction! I tried to adjust some things, but it still couldn't run.
When the example is ok, it will be a pleasure to try to help.
Sorry for the slow response, I finally managed to get the bug in the reproducer.
CHECK: https://github.com/pigeonmal/react-native-onpress-bug/
I have put the same code as my app.
When newArchEnabled=false: NO BUG, pressable work When newArchEnabled=true: BUG, pressable don't work
I don't know for the moment if this a bug in react-native, or in my packages, I must do more tests.
I think it is about "react-native-animated" not the react-native.
I try to remove react-native-reanimated, the bug has disappeared