Touches don’t work on absolutely positioned child when it goes outside parent’s bounds (Android only)
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 38/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- android, react-native
- Bereich
- mobile
Rechercherichtung
Starte, indem du den verlinkten Snack-Reproducer unter Android ausführst und sein Touch-Verhalten mit iOS vergleichst, wobei das absolut positionierte untergeordnete Element, das einen Switch oder WebView enthält, als Ausgangspunkt dient. Verfolge die Verarbeitung von Touch-Eingaben unter Android für untergeordnete Elemente, die über die Grenzen eines übergeordneten Elements hinausgehen. Als erledigt gilt die Aufgabe, wenn auch der Bereich außerhalb des übergeordneten Elements Interaktionen empfängt, ohne das Verhalten innerhalb des Elements zu ändern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Description
<GestureHandlerRootView style={styles.root}>
<GestureDetector gesture={composedGesture}>
<Animated.View style={styles.canvasWrapper}>
// the red box
<Animated.View style={[styles.canvasTransform, canvasAnimatedStyle]}>
<Animated.View
style={{
position: 'absolute',
left: 300,
top: 0,
}}
collapsable={false}>
<YoutubePlayer height={300} width={400} videoId={'HzL65tTeANs'} play={true} />
</Animated.View>
</Animated.View>
<Animated.View style={focalPointStyle} pointerEvents="none" />
</Animated.View>
</GestureDetector>
</GestureHandlerRootView>
I have a parent <Animated.View> (the red box in my demo). Inside it, I have another <Animated.View> that’s absolutely positioned and contains a react-native-youtube-iframe player
When the absolutely positioned animated.view is inside the red box(the parent), everything works fine. I can play pause and interact with the video
But once it goes outside the parent bounds, the video stops receiving touches.
as you can see from my demo video that only the part of the video inside the red box receives touch events
Note: the problem is not related to react-native-youtube-iframe i tested it with a regular React Native component like <Switch /> and the same behavior occurs with only android
Steps to reproduce
1- Create a parent <Animated.View> that acts as a container
2- Inside it, create another <Animated.View> with position: 'absolute' and place it so that part of it goes outside the parent’s bounds.
3- Inside the absolutely positioned animated.view, render for example <Switch /> or even a WebView.
4- Run the app on Android.
5- Try interacting with the <Switch />:
When the absolutely positioned animated.view and the switch are inside the parent's layout, the switch works fine.
When you move the absolutely positioned animated.view and the switch are outside the parent’s layout. the switch doesn't work
6- Run the same code on iOS. everything works fine
React Native Version
0.81.4
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: Windows 11 10.0.26100
CPU: (24) x64 Intel(R) Core(TM) i7-14650HX
Memory: 2.45 GB / 15.71 GB
Binaries:
Node:
version: 22.17.0
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 1.22.22
path: C:\Users\LEGION\AppData\Roaming\npm\yarn.CMD
npm:
version: 10.9.2
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: AI-251.26094.121.2513.14007798
Visual Studio: Not Found
Languages:
Java:
version: 17.0.16
path: C:\Program Files\Microsoft\jdk-17.0.16.8-hotspot\bin\javac.EXE
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 19.1.0
wanted: 19.1.0
react-native:
installed: 0.81.4
wanted: 0.81.4
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
The issue is only related to touch behavior on Android (no crash).
MANDATORY Reproducer
https://snack.expo.dev/@khldon123/repro?platform=web
Screenshots and Videos
https://github.com/user-attachments/assets/1146f77e-95d4-4960-85ba-f538cb73ec36
- Vorherrschende Sprache
- C++
- Sterne
- 127k
- Forks
- 25.3k
- Ø Merge
- 1 T. 23 Std.
- Gemergte PRs (30 T.)
- 4
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus react/react-native
-
Needs: Triage :mag:
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
react/react-native#58565 · 1 Kommentar · 2 Reaktionen ·
-
Needs: Author Feedback Needs: Repro
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
react/react-native#58555 · 4 Kommentare · 1 Reaktion ·
-
Needs: Attention Needs: Repro
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
react/react-native#58526 · 2 Kommentare ·
-
Needs: Author Feedback Needs: Repro
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
react/react-native#58448 · 1 Kommentar ·
-
Needs: Attention Needs: Repro
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 82/100
react/react-native#58441 · 2 Kommentare ·
Alle Issues in react/react-native
Ähnliche Issues
-
Website Doc Typo Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 92/100
autowarefoundation/autoware_universe#13413 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
automated-analysis bug memory-safety
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100