@react-native-oh/react-native-harmony 0.72.27-2 → 0.72.27-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,10 +40,8 @@ let queue: Array<() => void> = [];
40
40
  // $FlowFixMe
41
41
  let singleOpQueue: Array<any> = [];
42
42
 
43
- const useSingleOpBatching =
44
- Platform.OS === 'android' &&
45
- !!NativeAnimatedModule?.queueAndExecuteBatchedOperations &&
46
- ReactNativeFeatureFlags.animatedShouldUseSingleOp();
43
+ // RNOH: patch
44
+ const useSingleOpBatching = true; // while we do not use operationBatching we want to use logic for listening to events
47
45
  let flushQueueTimeout = null;
48
46
 
49
47
  const eventListenerGetValueCallbacks: {
@@ -55,40 +53,8 @@ const eventListenerAnimationFinishedCallbacks: {
55
53
  let globalEventEmitterGetValueListener: ?EventSubscription = null;
56
54
  let globalEventEmitterAnimationFinishedListener: ?EventSubscription = null;
57
55
 
58
- const nativeOps: ?typeof NativeAnimatedModule = useSingleOpBatching
59
- ? ((function () {
60
- const apis = [
61
- 'createAnimatedNode', // 1
62
- 'updateAnimatedNodeConfig', // 2
63
- 'getValue', // 3
64
- 'startListeningToAnimatedNodeValue', // 4
65
- 'stopListeningToAnimatedNodeValue', // 5
66
- 'connectAnimatedNodes', // 6
67
- 'disconnectAnimatedNodes', // 7
68
- 'startAnimatingNode', // 8
69
- 'stopAnimation', // 9
70
- 'setAnimatedNodeValue', // 10
71
- 'setAnimatedNodeOffset', // 11
72
- 'flattenAnimatedNodeOffset', // 12
73
- 'extractAnimatedNodeOffset', // 13
74
- 'connectAnimatedNodeToView', // 14
75
- 'disconnectAnimatedNodeFromView', // 15
76
- 'restoreDefaultValues', // 16
77
- 'dropAnimatedNode', // 17
78
- 'addAnimatedEventToView', // 18
79
- 'removeAnimatedEventFromView', // 19
80
- 'addListener', // 20
81
- 'removeListener', // 21
82
- ];
83
- return apis.reduce<{[string]: number}>((acc, functionName, i) => {
84
- // These indices need to be kept in sync with the indices in native (see NativeAnimatedModule in Java, or the equivalent for any other native platform).
85
- // $FlowFixMe[prop-missing]
86
- acc[functionName] = i + 1;
87
- return acc;
88
- }, {});
89
- })(): $FlowFixMe)
90
- : NativeAnimatedModule;
91
-
56
+ // RNOH: patch
57
+ const nativeOps = NativeAnimatedModule;
92
58
  /**
93
59
  * Wrappers around NativeAnimatedModule to provide flow and autocomplete support for
94
60
  * the native module methods, and automatic queue management on Android
@@ -166,7 +132,11 @@ const API = {
166
132
  // use RCTDeviceEventEmitter. This reduces overhead of sending lots of
167
133
  // JSI functions across to native code; but also, TM infrastructure currently
168
134
  // does not support packing a function into native arrays.
169
- NativeAnimatedModule?.queueAndExecuteBatchedOperations?.(singleOpQueue);
135
+
136
+ // RNOH: patch
137
+ for (let q = 0, l = singleOpQueue.length; q < l; q++) {
138
+ singleOpQueue[q]();
139
+ }
170
140
  singleOpQueue.length = 0;
171
141
  } else {
172
142
  Platform.OS === 'android' &&
@@ -184,18 +154,13 @@ const API = {
184
154
  fn: Fn,
185
155
  ...args: Args
186
156
  ): void => {
187
- if (useSingleOpBatching) {
188
- // Get the command ID from the queued function, and push that ID and any arguments needed to execute the operation
189
- // $FlowFixMe: surprise, fn is actually a number
190
- singleOpQueue.push(fn, ...args);
191
- return;
192
- }
193
-
194
157
  // If queueing is explicitly on, *or* the queue has not yet
195
158
  // been flushed, use the queue. This is to prevent operations
196
159
  // from being executed out of order.
197
- if (queueOperations || queue.length !== 0) {
198
- queue.push(() => fn(...args));
160
+ // RNOH: patch
161
+ const currentlyUsedQueue = useSingleOpBatching ? singleOpQueue : queue;
162
+ if (queueOperations || currentlyUsedQueue.length !== 0) {
163
+ currentlyUsedQueue.push(() => fn(...args));
199
164
  } else {
200
165
  fn(...args);
201
166
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-oh/react-native-harmony",
3
- "version": "0.72.27-2",
3
+ "version": "0.72.27-3",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -49,7 +49,7 @@
49
49
  "./*.har"
50
50
  ],
51
51
  "dependencies": {
52
- "@react-native-oh/react-native-harmony-cli": "^0.0.26-2",
52
+ "@react-native-oh/react-native-harmony-cli": "^0.0.26-3",
53
53
  "colors": "^1.4.0",
54
54
  "fs-extra": "^11.1.1",
55
55
  "metro": "^0.76.3",