[android] [ios] [web] `measure` returns incorrect values of `View` if its parent `View` is `scale`d using `transform` style
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 50/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- javascript, react-native
- Ambito
- mobile-dev
Direzione di ricerca
Inizia con il riproduttore Snack obbligatorio e confronta measure con onLayout su Android, iOS e web. Traccia il comportamento di misurazione specifico della piattaforma mostrato dal riproduttore; il lavoro è completato quando measure restituisce valori coerenti con il layout non scalato e con i risultati esistenti di web e onLayout.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
If use measure method to calculate x, y, width, height, pageX, pageY values of View it will return incorrect values in case if parent View has styles:
transform: [
{
scale: 2,
},
],
in this case width, height, pageX, pageY values from measure callback will be doubled compared to real ones.
Specs
- It is wrong due docs as
transformstyle prop doesnt change layout,transformis used to change appearance only:Transforms are style properties that will help you modify the appearance and position of your components using 2D or 3D transformations. However, once you apply transforms, the layouts remain the same around the transformed component
- It is inconsistent with
react-native-webwheretransformdoesnt affectwidth, height, pageX, pageYvalues - It is inconsistent with response of
onLayoutcallback which will returnwidth, heightNOT scaled
Problem
There are 3 different behaviors:
react-native-webreturns real sizesonLayoutreturns real sizesmeasurereturns size SCALED due to its parenttransformstyle
Steps to reproduce
See example
React Native Version
0.81.5
Affected Platforms
Runtime - Android,
Runtime - iOS,
Runtime - Web
Output of npx @react-native-community/cli info
See example
Stacktrace or Logs
See example console logs on Android (or iOS)
MANDATORY Reproducer
https://snack.expo.dev/@sepu/rn-measure-bug-w-transform
Screenshots and Videos
web console logs (3rd and 4th parameters are the same) which is ok:
>>>>> useLayoutEffect measure x, y, width, height, pageX, pageY 134 351 71 39 134 351
onLayoutHandler layout.x, layout.y, layout.width, layout.height 134 351 71 39
Android / iOS console logs (3rd and 4th parameters for measure are 2x bigger than from onLayout):
>>>>> useLayoutEffect measure x, y, width, height, pageX, pageY 176 456 148 78 139 437
onLayoutHandler layout.x, layout.y, layout.width, layout.height 176 456 74 39
- Lingua principale
- C++
- Stelle
- 127k
- Fork
- 25.3k
- Merge medio
- 1g 23h
- PR unite (30g)
- 4
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di react/react-native
-
Needs: Triage :mag:
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
react/react-native#58565 · 1 commento · 2 reazioni ·
-
Needs: Author Feedback Needs: Repro
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
react/react-native#58555 · 4 commenti · 1 reazione ·
-
Needs: Attention Needs: Repro
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
react/react-native#58526 · 2 commenti ·
-
Needs: Author Feedback Needs: Repro
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
react/react-native#58448 · 1 commento ·
-
Needs: Attention Needs: Repro
Difficoltà 2/5 Mezza giornata Idoneità per principianti 82/100
react/react-native#58441 · 2 commenti ·
Tutte le issue di react/react-native
Issue simili
-
[BUG] Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
eunomia-bpf/llvmbpf#51 · 1 commento ·
-
status:needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PX4/PX4-Autopilot#28776 ·
-
Website Doc Typo Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
autowarefoundation/autoware_universe#13413 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100