Commit aa51746
Formalize event timestamps and propagate from host platform to JS (#55878)
Summary:
Pull Request resolved: #55878
Changelog: [General][Fixed] - Fix event timestamp propagation from host platforms to JS
This adds event timestamps as a first class concept in Fabric during dispatch, and uses the new methods to dispatch events to pass the values from the host platform (Android and iOS). If the value isn't pass, the current timestamp at the time of dispatch is used (which is close enough).
This fixes several problems:
1. Makes event timestamps account for native event dispatch delay.
2. Normalizes event timestamps across APIs (event timestamp property, Event Timing API information, etc.).
NOTE: I had to implement clock correction on iOS because the timing we get from UITouch objects doesn't use the same clock as we do in C++.
Reviewed By: javache, NickGerleman
Differential Revision: D94669354
fbshipit-source-id: 945ce5dd2d2f44f2106e631854de40a109a6cb811 parent 238bd24 commit aa51746
File tree
36 files changed
+514
-60
lines changed- packages/react-native
- ReactAndroid
- api
- src
- main
- java/com/facebook/react
- animated
- fabric
- events
- mounting
- uimanager/events
- jni/react/fabric
- test/java/com/facebook/react/fabric/events
- ReactCommon/react/renderer
- components/view
- core
- tests
- scheduler
- uimanager
- React/Fabric
- src/private/webapis/performance/__tests__
36 files changed
+514
-60
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
19 | 38 | | |
20 | 39 | | |
21 | 40 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| 288 | + | |
288 | 289 | | |
289 | 290 | | |
290 | 291 | | |
| |||
345 | 346 | | |
346 | 347 | | |
347 | 348 | | |
348 | | - | |
| 349 | + | |
| 350 | + | |
349 | 351 | | |
350 | 352 | | |
351 | 353 | | |
| |||
365 | 367 | | |
366 | 368 | | |
367 | 369 | | |
| 370 | + | |
368 | 371 | | |
369 | 372 | | |
370 | 373 | | |
| |||
760 | 763 | | |
761 | 764 | | |
762 | 765 | | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
763 | 769 | | |
764 | | - | |
| 770 | + | |
765 | 771 | | |
766 | 772 | | |
767 | 773 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2261 | 2261 | | |
2262 | 2262 | | |
2263 | 2263 | | |
| 2264 | + | |
2264 | 2265 | | |
2265 | 2266 | | |
2266 | 2267 | | |
| |||
2287 | 2288 | | |
2288 | 2289 | | |
2289 | 2290 | | |
| 2291 | + | |
2290 | 2292 | | |
2291 | 2293 | | |
2292 | 2294 | | |
| |||
4804 | 4806 | | |
4805 | 4807 | | |
4806 | 4808 | | |
| 4809 | + | |
4807 | 4810 | | |
4808 | 4811 | | |
4809 | 4812 | | |
4810 | 4813 | | |
4811 | 4814 | | |
| 4815 | + | |
4812 | 4816 | | |
4813 | 4817 | | |
4814 | 4818 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
Lines changed: 77 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1067 | 1067 | | |
1068 | 1068 | | |
1069 | 1069 | | |
| 1070 | + | |
1070 | 1071 | | |
1071 | 1072 | | |
1072 | 1073 | | |
1073 | 1074 | | |
1074 | 1075 | | |
| 1076 | + | |
1075 | 1077 | | |
1076 | 1078 | | |
1077 | 1079 | | |
| |||
1091 | 1093 | | |
1092 | 1094 | | |
1093 | 1095 | | |
| 1096 | + | |
1094 | 1097 | | |
| 1098 | + | |
1095 | 1099 | | |
1096 | 1100 | | |
1097 | 1101 | | |
1098 | 1102 | | |
1099 | 1103 | | |
1100 | 1104 | | |
1101 | 1105 | | |
1102 | | - | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1103 | 1115 | | |
1104 | 1116 | | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
1105 | 1134 | | |
1106 | 1135 | | |
1107 | 1136 | | |
| |||
1111 | 1140 | | |
1112 | 1141 | | |
1113 | 1142 | | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
1114 | 1180 | | |
1115 | 1181 | | |
1116 | 1182 | | |
| |||
1128 | 1194 | | |
1129 | 1195 | | |
1130 | 1196 | | |
1131 | | - | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
1132 | 1204 | | |
1133 | 1205 | | |
1134 | 1206 | | |
| |||
1142 | 1214 | | |
1143 | 1215 | | |
1144 | 1216 | | |
1145 | | - | |
| 1217 | + | |
1146 | 1218 | | |
1147 | 1219 | | |
1148 | 1220 | | |
1149 | | - | |
| 1221 | + | |
1150 | 1222 | | |
1151 | | - | |
| 1223 | + | |
1152 | 1224 | | |
1153 | 1225 | | |
1154 | 1226 | | |
| |||
Lines changed: 25 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
34 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
35 | 44 | | |
36 | 45 | | |
37 | 46 | | |
38 | 47 | | |
39 | 48 | | |
40 | 49 | | |
| 50 | + | |
| 51 | + | |
41 | 52 | | |
42 | 53 | | |
43 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
44 | 60 | | |
45 | 61 | | |
46 | 62 | | |
47 | | - | |
| 63 | + | |
48 | 64 | | |
49 | 65 | | |
50 | 66 | | |
51 | | - | |
| 67 | + | |
52 | 68 | | |
53 | 69 | | |
54 | 70 | | |
55 | 71 | | |
56 | | - | |
| 72 | + | |
57 | 73 | | |
58 | 74 | | |
59 | 75 | | |
| |||
62 | 78 | | |
63 | 79 | | |
64 | 80 | | |
| 81 | + | |
65 | 82 | | |
66 | 83 | | |
67 | | - | |
| 84 | + | |
68 | 85 | | |
69 | 86 | | |
70 | 87 | | |
71 | | - | |
| 88 | + | |
72 | 89 | | |
73 | 90 | | |
74 | 91 | | |
| |||
Lines changed: 34 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
25 | 49 | | |
26 | 50 | | |
27 | 51 | | |
28 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
29 | 62 | | |
30 | 63 | | |
31 | 64 | | |
| |||
0 commit comments