react-native-reanimated 3.1.0 → 3.2.0-nightly-20230516-474ca875c

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.
Files changed (94) hide show
  1. package/android/build.gradle +58 -41
  2. package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +1 -1
  3. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +3 -3
  4. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +3 -1
  5. package/ios/LayoutReanimation/REAAnimationsManager.m +2 -1
  6. package/ios/REANodesManager.mm +81 -35
  7. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +1 -2
  8. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  9. package/lib/commonjs/reanimated2/Sensor.js +69 -0
  10. package/lib/commonjs/reanimated2/Sensor.js.map +1 -0
  11. package/lib/commonjs/reanimated2/SensorContainer.js +53 -0
  12. package/lib/commonjs/reanimated2/SensorContainer.js.map +1 -0
  13. package/lib/commonjs/reanimated2/animation/util.js +25 -0
  14. package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
  15. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  16. package/lib/commonjs/reanimated2/core.js +19 -4
  17. package/lib/commonjs/reanimated2/core.js.map +1 -1
  18. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  19. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +1 -1
  20. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
  21. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +14 -34
  22. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  23. package/lib/commonjs/reanimated2/jestUtils.js +4 -4
  24. package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
  25. package/lib/commonjs/reanimated2/mappers.js +4 -1
  26. package/lib/commonjs/reanimated2/mappers.js.map +1 -1
  27. package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js +2 -3
  28. package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js.map +1 -1
  29. package/lib/commonjs/reanimated2/platform-specific/jsVersion.js +1 -1
  30. package/lib/commonjs/reanimated2/platform-specific/jsVersion.js.map +1 -1
  31. package/lib/commonjs/reanimated2/shareables.js +2 -12
  32. package/lib/commonjs/reanimated2/shareables.js.map +1 -1
  33. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +1 -2
  34. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  35. package/lib/module/reanimated2/Sensor.js +61 -0
  36. package/lib/module/reanimated2/Sensor.js.map +1 -0
  37. package/lib/module/reanimated2/SensorContainer.js +45 -0
  38. package/lib/module/reanimated2/SensorContainer.js.map +1 -0
  39. package/lib/module/reanimated2/animation/util.js +25 -0
  40. package/lib/module/reanimated2/animation/util.js.map +1 -1
  41. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  42. package/lib/module/reanimated2/core.js +17 -4
  43. package/lib/module/reanimated2/core.js.map +1 -1
  44. package/lib/module/reanimated2/globals.d.js.map +1 -1
  45. package/lib/module/reanimated2/hook/useAnimatedRef.js +1 -1
  46. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  47. package/lib/module/reanimated2/hook/useAnimatedSensor.js +15 -34
  48. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  49. package/lib/module/reanimated2/jestUtils.js +4 -4
  50. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  51. package/lib/module/reanimated2/mappers.js +4 -1
  52. package/lib/module/reanimated2/mappers.js.map +1 -1
  53. package/lib/module/reanimated2/platform-specific/checkCppVersion.js +2 -3
  54. package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -1
  55. package/lib/module/reanimated2/platform-specific/jsVersion.js +1 -1
  56. package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -1
  57. package/lib/module/reanimated2/shareables.js +2 -12
  58. package/lib/module/reanimated2/shareables.js.map +1 -1
  59. package/package.json +8 -6
  60. package/plugin/build/plugin.js +0 -1
  61. package/plugin/build/plugin.js.map +2 -2
  62. package/react-native-reanimated.d.ts +6 -1
  63. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +1 -2
  64. package/src/reanimated2/Sensor.ts +81 -0
  65. package/src/reanimated2/SensorContainer.ts +71 -0
  66. package/src/reanimated2/animation/util.ts +44 -0
  67. package/src/reanimated2/commonTypes.ts +18 -1
  68. package/src/reanimated2/core.ts +27 -8
  69. package/src/reanimated2/globals.d.ts +2 -0
  70. package/src/reanimated2/hook/useAnimatedRef.ts +11 -3
  71. package/src/reanimated2/hook/useAnimatedSensor.ts +30 -66
  72. package/src/reanimated2/jestUtils.ts +13 -7
  73. package/src/reanimated2/mappers.ts +4 -1
  74. package/src/reanimated2/platform-specific/checkCppVersion.ts +2 -3
  75. package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
  76. package/src/reanimated2/shareables.ts +2 -14
  77. package/plugin/.eslintrc.js +0 -7
  78. package/plugin/README.md +0 -241
  79. package/plugin/package.json +0 -23
  80. package/plugin/src/buildWorkletString.ts +0 -213
  81. package/plugin/src/commonObjects.ts +0 -60
  82. package/plugin/src/injectVersion.ts +0 -37
  83. package/plugin/src/makeWorklet.ts +0 -375
  84. package/plugin/src/plugin.ts +0 -49
  85. package/plugin/src/processForCalleesWorklets.ts +0 -106
  86. package/plugin/src/processIfGestureHandlerEventCallbackFunctionNode.ts +0 -156
  87. package/plugin/src/processIfWorkletFunction.ts +0 -55
  88. package/plugin/src/processIfWorkletNode.ts +0 -44
  89. package/plugin/src/processInlineStylesWarning.ts +0 -129
  90. package/plugin/src/processWorkletObjectMethod.ts +0 -31
  91. package/plugin/src/types.ts +0 -15
  92. package/plugin/src/utils.ts +0 -6
  93. package/plugin/tsconfig.json +0 -15
  94. package/plugin/yarn.lock +0 -2193
@@ -2,6 +2,9 @@ import com.android.Version
2
2
  import org.apache.tools.ant.filters.ReplaceTokens
3
3
  import org.apache.tools.ant.taskdefs.condition.Os
4
4
  import groovy.json.JsonSlurper
5
+
6
+ import javax.inject.Inject
7
+ import java.nio.file.Files
5
8
  import java.nio.file.Paths
6
9
 
7
10
  /**
@@ -141,41 +144,6 @@ def shouldAssertNoMultipleInstances() {
141
144
  }
142
145
  }
143
146
 
144
- def findReanimatedInstancesForPath(String path) {
145
- return fileTree(path) {
146
- include "**/react-native-reanimated/package.json"
147
- exclude "**/.yarn/**"
148
- exclude {{ file, attr -> attr.isSymbolicLink() }}
149
- }.files
150
- }
151
-
152
- def checkNoMultipleInstances() {
153
- // Assert there are no multiple installations of Reanimated
154
- Set<File> files
155
- if (projectDir.path.contains(rootDir.parent)) {
156
- // standard app
157
- files = findReanimatedInstancesForPath(rootDir.parent + "/node_modules")
158
- } else {
159
- // monorepo
160
- files = findReanimatedInstancesForPath(rootDir.parent + "/node_modules")
161
- files.addAll(
162
- findReanimatedInstancesForPath(file(projectDir.parent).parent)
163
- )
164
- }
165
- if (files.size() > 1) {
166
- String parsedLocation = files.stream().map({
167
- File file -> "- " + file.toString().replace("/package.json", "")
168
- }).collect().join("\n")
169
- String exceptionMessage = "\n[react-native-reanimated] Multiple versions of Reanimated " +
170
- "were detected. Only one instance of react-native-reanimated can be installed in a " +
171
- "project. You need to resolve the conflict manually. Check out the documentation: " +
172
- "https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/" +
173
- "troubleshooting#multiple-versions-of-reanimated-were-detected \n\nConflict " +
174
- "between: \n" + parsedLocation + "\n";
175
- throw new GradleException(exceptionMessage)
176
- }
177
- }
178
-
179
147
  def getReanimatedVersion() {
180
148
  def inputFile = file(projectDir.path + '/../package.json')
181
149
  def json = new JsonSlurper().parseText(inputFile.text)
@@ -584,15 +552,64 @@ android {
584
552
  }
585
553
  }
586
554
 
587
- def assertNoMultipleInstances = task assertNoMultipleInstancesTask {
588
- onlyIf { shouldAssertNoMultipleInstances() && CLIENT_SIDE_BUILD }
589
- doFirst {
590
- checkNoMultipleInstances()
555
+ abstract class NoMultipleInstancesAssertionTask extends DefaultTask {
556
+ @Inject abstract ObjectFactory getObjectFactory()
557
+
558
+ @Input abstract Property<File> getProjectDirFile()
559
+ @Input abstract Property<File> getRootDirFile()
560
+ @Input abstract Property<Boolean> getShouldCheck()
561
+
562
+ def findReanimatedInstancesForPath(String path) {
563
+ return objectFactory.fileTree().from(path)
564
+ .include("**/react-native-reanimated/package.json")
565
+ .exclude("**/.yarn/**")
566
+ .exclude({ Files.isSymbolicLink(it.getFile().toPath()) })
567
+ .findAll()
568
+ }
569
+
570
+ @TaskAction
571
+ def check() {
572
+ if (shouldCheck.get()) {
573
+ // Assert there are no multiple installations of Reanimated
574
+ Set<File> files
575
+
576
+ if (projectDirFile.get().parent.contains(rootDirFile.get().parent)) {
577
+ // standard app
578
+ files = findReanimatedInstancesForPath(rootDirFile.get().parent + "/node_modules")
579
+ } else {
580
+ // monorepo
581
+ files = findReanimatedInstancesForPath(rootDirFile.get().parent + "/node_modules")
582
+ files.addAll(
583
+ findReanimatedInstancesForPath(projectDirFile.get().parentFile.parent)
584
+ )
585
+ }
586
+
587
+ if (files.size() > 1) {
588
+ String parsedLocation = files.stream().map({
589
+ File file -> "- " + file.toString().replace("/package.json", "")
590
+ }).collect().join("\n")
591
+ String exceptionMessage = "\n[react-native-reanimated] Multiple versions of Reanimated " +
592
+ "were detected. Only one instance of react-native-reanimated can be installed in a " +
593
+ "project. You need to resolve the conflict manually. Check out the documentation: " +
594
+ "https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/" +
595
+ "troubleshooting#multiple-versions-of-reanimated-were-detected \n\nConflict " +
596
+ "between: \n" + parsedLocation + "\n"
597
+ throw new GradleException(exceptionMessage)
598
+ }
599
+ }
591
600
  }
592
601
  }
593
602
 
603
+ tasks.register('assertNoMultipleInstances', NoMultipleInstancesAssertionTask) {
604
+ shouldCheck = shouldAssertNoMultipleInstances()
605
+ rootDirFile = rootDir
606
+ projectDirFile = projectDir
607
+ }
608
+
609
+ def NEW_ARCH_ENABLED = isNewArchitectureEnabled()
610
+
594
611
  def assertNoReanimated2WithNewArchitecture = task assertNoReanimated2WithNewArchitectureTask {
595
- onlyIf { isNewArchitectureEnabled() && REANIMATED_MAJOR_VERSION == 2 }
612
+ onlyIf { NEW_ARCH_ENABLED && REANIMATED_MAJOR_VERSION == 2 }
596
613
  doFirst {
597
614
  throw new GradleException(
598
615
  "\n[react-native-reanimated] Reanimated 2.x does not support Fabric. " +
@@ -603,7 +620,7 @@ def assertNoReanimated2WithNewArchitecture = task assertNoReanimated2WithNewArch
603
620
  }
604
621
 
605
622
  def assertLatestReactNativeWithNewArchitecture = task assertLatestReactNativeWithNewArchitectureTask {
606
- onlyIf { isNewArchitectureEnabled() && REANIMATED_MAJOR_VERSION == 3 && REACT_NATIVE_MINOR_VERSION < 72 }
623
+ onlyIf { NEW_ARCH_ENABLED && REANIMATED_MAJOR_VERSION == 3 && REACT_NATIVE_MINOR_VERSION < 72 }
607
624
  doFirst {
608
625
  throw new GradleException(
609
626
  "\n[react-native-reanimated] Reanimated " + REANIMATED_VERSION + " supports the New Architecture " +
@@ -145,7 +145,7 @@ public class ReanimatedKeyboardEventListener {
145
145
 
146
146
  private void bringBackWindowInsets() {
147
147
  WindowCompat.setDecorFitsSystemWindows(
148
- reactContext.get().getCurrentActivity().getWindow(), true);
148
+ reactContext.get().getCurrentActivity().getWindow(), !isStatusBarTranslucent);
149
149
  ViewCompat.setOnApplyWindowInsetsListener(getRootView(), null);
150
150
  ViewCompat.setWindowInsetsAnimationCallback(getRootView(), null);
151
151
  View content =
@@ -84,7 +84,7 @@ public class AnimationsManager implements ViewHierarchyObserver {
84
84
  Integer tag = view.getId();
85
85
  mCallbacks.put(tag, callback);
86
86
 
87
- if (!removeOrAnimateExitRecursive(view, parent, true)) {
87
+ if (!removeOrAnimateExitRecursive(view, true)) {
88
88
  removeView(view, parent);
89
89
  }
90
90
  }
@@ -473,7 +473,7 @@ public class AnimationsManager implements ViewHierarchyObserver {
473
473
  return mNativeMethodsHolder != null && mNativeMethodsHolder.isLayoutAnimationEnabled();
474
474
  }
475
475
 
476
- private boolean removeOrAnimateExitRecursive(View view, ViewGroup parent, boolean shouldRemove) {
476
+ private boolean removeOrAnimateExitRecursive(View view, boolean shouldRemove) {
477
477
  int tag = view.getId();
478
478
  ViewManager viewManager = resolveViewManager(tag);
479
479
 
@@ -501,7 +501,7 @@ public class AnimationsManager implements ViewHierarchyObserver {
501
501
  ViewGroup viewGroup = (ViewGroup) view;
502
502
  for (int i = viewGroup.getChildCount() - 1; i >= 0; i--) {
503
503
  View child = viewGroup.getChildAt(i);
504
- if (removeOrAnimateExitRecursive(child, viewGroup, shouldRemove)) {
504
+ if (removeOrAnimateExitRecursive(child, shouldRemove)) {
505
505
  hasAnimatedChildren = true;
506
506
  } else if (shouldRemove) {
507
507
  toBeRemoved.add(child);
@@ -69,7 +69,9 @@ public class ReanimatedSensorListener implements SensorEventListener {
69
69
  };
70
70
  setter.sensorSetter(data, orientationDegrees);
71
71
  } else {
72
- setter.sensorSetter(event.values, orientationDegrees);
72
+ // Set the opposite values to be consistent with iOS
73
+ float[] data = new float[] {-event.values[0], -event.values[1], -event.values[2]};
74
+ setter.sensorSetter(data, orientationDegrees);
73
75
  }
74
76
  }
75
77
 
@@ -396,7 +396,8 @@ BOOL REANodeFind(id<RCTComponent> view, int (^block)(id<RCTComponent>))
396
396
  return NO;
397
397
  }
398
398
 
399
- BOOL hasExitAnimation = _hasAnimationForTag(view.reactTag, EXITING) || [_exitingViews objectForKey:view.reactTag];
399
+ BOOL hasExitAnimation =
400
+ [self hasAnimationForTag:view.reactTag type:EXITING] || [_exitingViews objectForKey:view.reactTag];
400
401
  BOOL hasAnimatedChildren = NO;
401
402
  shouldRemoveSubviewsWithoutAnimations = shouldRemoveSubviewsWithoutAnimations && !hasExitAnimation;
402
403
  NSMutableArray *toBeRemoved = [[NSMutableArray alloc] init];
@@ -12,6 +12,10 @@
12
12
  #import <stdatomic.h>
13
13
  #endif
14
14
 
15
+ #if __has_include(<RNScreens/RNSScreenStackHeaderConfig.h>)
16
+ #import <RNScreens/RNSScreenStackHeaderConfig.h>
17
+ #endif
18
+
15
19
  #ifdef RCT_NEW_ARCH_ENABLED
16
20
  using namespace facebook::react;
17
21
  #endif
@@ -85,19 +89,77 @@ using namespace facebook::react;
85
89
 
86
90
  @end
87
91
 
88
- @interface REANodesManager () <RCTUIManagerObserver>
92
+ #ifndef RCT_NEW_ARCH_ENABLED
89
93
 
94
+ @interface REASyncUpdateObserver : NSObject <RCTUIManagerObserver>
90
95
  @end
91
96
 
97
+ @implementation REASyncUpdateObserver {
98
+ volatile void (^_mounting)(void);
99
+ volatile BOOL _waitTimedOut;
100
+ dispatch_semaphore_t _semaphore;
101
+ }
102
+
103
+ - (instancetype)init
104
+ {
105
+ self = [super init];
106
+ if (self) {
107
+ _mounting = nil;
108
+ _waitTimedOut = NO;
109
+ _semaphore = dispatch_semaphore_create(0);
110
+ }
111
+ return self;
112
+ }
113
+
114
+ - (void)dealloc
115
+ {
116
+ RCTAssert(_mounting == nil, @"Mouting block was set but never executed. This may lead to UI inconsistencies");
117
+ }
118
+
119
+ - (void)unblockUIThread
120
+ {
121
+ RCTAssertUIManagerQueue();
122
+ dispatch_semaphore_signal(_semaphore);
123
+ }
124
+
125
+ - (void)waitAndMountWithTimeout:(NSTimeInterval)timeout
126
+ {
127
+ RCTAssertMainQueue();
128
+ long result = dispatch_semaphore_wait(_semaphore, dispatch_time(DISPATCH_TIME_NOW, timeout * NSEC_PER_SEC));
129
+ if (result != 0) {
130
+ @synchronized(self) {
131
+ _waitTimedOut = YES;
132
+ }
133
+ }
134
+ if (_mounting) {
135
+ _mounting();
136
+ _mounting = nil;
137
+ }
138
+ }
139
+
140
+ - (BOOL)uiManager:(RCTUIManager *)manager performMountingWithBlock:(RCTUIManagerMountingBlock)block
141
+ {
142
+ RCTAssertUIManagerQueue();
143
+ @synchronized(self) {
144
+ if (_waitTimedOut) {
145
+ return NO;
146
+ } else {
147
+ _mounting = block;
148
+ return YES;
149
+ }
150
+ }
151
+ }
152
+
153
+ @end
154
+
155
+ #endif
156
+
92
157
  @implementation REANodesManager {
93
158
  CADisplayLink *_displayLink;
94
159
  BOOL _wantRunUpdates;
95
160
  NSMutableArray<REAOnAnimationCallback> *_onAnimationCallbacks;
96
161
  BOOL _tryRunBatchUpdatesSynchronously;
97
162
  REAEventHandler _eventHandler;
98
- volatile void (^_mounting)(void);
99
- NSObject *_syncLayoutUpdatesWaitLock;
100
- volatile BOOL _syncLayoutUpdatesWaitTimedOut;
101
163
  NSMutableDictionary<NSNumber *, ComponentUpdate *> *_componentUpdateBuffer;
102
164
  NSMutableDictionary<NSNumber *, UIView *> *_viewRegistry;
103
165
  #ifdef RCT_NEW_ARCH_ENABLED
@@ -125,7 +187,6 @@ using namespace facebook::react;
125
187
  _operationsInBatch = [NSMutableDictionary new];
126
188
  _componentUpdateBuffer = [NSMutableDictionary new];
127
189
  _viewRegistry = [_uiManager valueForKey:@"_viewRegistry"];
128
- _syncLayoutUpdatesWaitLock = [NSObject new];
129
190
  }
130
191
 
131
192
  _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onAnimationFrame:)];
@@ -241,19 +302,6 @@ using namespace facebook::react;
241
302
  }
242
303
  }
243
304
 
244
- - (BOOL)uiManager:(RCTUIManager *)manager performMountingWithBlock:(RCTUIManagerMountingBlock)block
245
- {
246
- RCTAssert(_mounting == nil, @"Mouting block is expected to not be set");
247
- @synchronized(_syncLayoutUpdatesWaitLock) {
248
- if (_syncLayoutUpdatesWaitTimedOut) {
249
- return NO;
250
- } else {
251
- _mounting = block;
252
- return YES;
253
- }
254
- }
255
- }
256
-
257
305
  - (void)performOperations
258
306
  {
259
307
  #ifdef RCT_NEW_ARCH_ENABLED
@@ -268,8 +316,7 @@ using namespace facebook::react;
268
316
  _tryRunBatchUpdatesSynchronously = NO;
269
317
 
270
318
  __weak __typeof__(self) weakSelf = self;
271
- dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
272
- _syncLayoutUpdatesWaitTimedOut = NO;
319
+ REASyncUpdateObserver *syncUpdateObserver = [REASyncUpdateObserver new];
273
320
  RCTExecuteOnUIManagerQueue(^{
274
321
  __typeof__(self) strongSelf = weakSelf;
275
322
  if (strongSelf == nil) {
@@ -278,7 +325,7 @@ using namespace facebook::react;
278
325
  BOOL canUpdateSynchronously = trySynchronously && ![strongSelf.uiManager hasEnqueuedUICommands];
279
326
 
280
327
  if (!canUpdateSynchronously) {
281
- dispatch_semaphore_signal(semaphore);
328
+ [syncUpdateObserver unblockUIThread];
282
329
  }
283
330
 
284
331
  for (int i = 0; i < copiedOperationsQueue.count; i++) {
@@ -286,8 +333,8 @@ using namespace facebook::react;
286
333
  }
287
334
 
288
335
  if (canUpdateSynchronously) {
289
- [strongSelf.uiManager runSyncUIUpdatesWithObserver:strongSelf];
290
- dispatch_semaphore_signal(semaphore);
336
+ [strongSelf.uiManager runSyncUIUpdatesWithObserver:syncUpdateObserver];
337
+ [syncUpdateObserver unblockUIThread];
291
338
  }
292
339
  // In case canUpdateSynchronously=true we still have to send uiManagerWillPerformMounting event
293
340
  // to observers because some components (e.g. TextInput) update their UIViews only on that event.
@@ -298,17 +345,7 @@ using namespace facebook::react;
298
345
  // from CADisplayLink but it is easier to hardcode it for the time being.
299
346
  // The reason why we use frame duration here is that if takes longer than one frame to complete layout tasks
300
347
  // there is no point of synchronizing layout with the UI interaction as we get that one frame delay anyways.
301
- long result = dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, 16 * NSEC_PER_MSEC));
302
- if (result != 0) {
303
- @synchronized(_syncLayoutUpdatesWaitLock) {
304
- _syncLayoutUpdatesWaitTimedOut = YES;
305
- }
306
- }
307
- }
308
-
309
- if (_mounting) {
310
- _mounting();
311
- _mounting = nil;
348
+ [syncUpdateObserver waitAndMountWithTimeout:0.016];
312
349
  }
313
350
  }
314
351
  _wantRunUpdates = NO;
@@ -368,7 +405,16 @@ using namespace facebook::react;
368
405
 
369
406
  - (BOOL)isNativeViewMounted:(NSNumber *)viewTag
370
407
  {
371
- return _viewRegistry[viewTag].superview != nil;
408
+ UIView *view = _viewRegistry[viewTag];
409
+ if (view.superview != nil) {
410
+ return YES;
411
+ }
412
+ #if __has_include(<RNScreens/RNSScreenStackHeaderConfig.h>)
413
+ if ([view isKindOfClass:[RNSScreenStackHeaderConfig class]]) {
414
+ return ((RNSScreenStackHeaderConfig *)view).screenView != nil;
415
+ }
416
+ #endif
417
+ return NO;
372
418
  }
373
419
 
374
420
  #ifdef RCT_NEW_ARCH_ENABLED
@@ -24,11 +24,10 @@ class NativeReanimated {
24
24
  this.native = native;
25
25
  if (native) {
26
26
  if (this.InnerNativeModule === undefined) {
27
- console.error(`[Reanimated] The native part of Reanimated doesn't seem to be initialized. This could be caused by\n\
27
+ throw new Error(`[Reanimated] The native part of Reanimated doesn't seem to be initialized. This could be caused by\n\
28
28
  - not rebuilding the app after installing or upgrading Reanimated\n\
29
29
  - trying to run Reanimated on an unsupported platform\n\
30
30
  - running in a brownfield app without manually initializing the native library`);
31
- return;
32
31
  }
33
32
  (0, _checkCppVersion.checkCppVersion)();
34
33
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_checkCppVersion","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","NativeReanimated","constructor","native","arguments","length","global","__reanimatedModuleProxy","ReanimatedModule","NativeModules","installTurboModule","InnerNativeModule","console","error","checkCppVersion","installCoreFunctions","callGuard","valueUnpacker","makeShareableClone","shouldPersistRemote","makeSynchronizedDataHolder","valueRef","getDataSynchronously","ref","updateDataSynchronously","scheduleOnUI","shareable","registerSensor","sensorType","interval","iosReferenceFrame","handler","unregisterSensor","sensorId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","sharedTransitionTag","config","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","isStatusBarTranslucent","unsubscribeFromKeyboardEvents","listenerId","exports"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport {\n ShareableRef,\n ShareableSyncDataHolderRef,\n Value3D,\n ValueRotation,\n} from '../commonTypes';\nimport {\n LayoutAnimationFunction,\n LayoutAnimationType,\n} from '../layoutReanimation';\nimport { checkCppVersion } from '../platform-specific/checkCppVersion';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n if (native) {\n if (this.InnerNativeModule === undefined) {\n console.error(\n `[Reanimated] The native part of Reanimated doesn't seem to be initialized. This could be caused by\\n\\\n - not rebuilding the app after installing or upgrading Reanimated\\n\\\n - trying to run Reanimated on an unsupported platform\\n\\\n - running in a brownfield app without manually initializing the native library`\n );\n return;\n }\n checkCppVersion();\n }\n }\n\n installCoreFunctions(\n callGuard: <T extends Array<any>, U>(\n fn: (...args: T) => U,\n ...args: T\n ) => void,\n valueUnpacker: <T>(value: T) => T\n ): void {\n return this.InnerNativeModule.installCoreFunctions(\n callGuard,\n valueUnpacker\n );\n }\n\n makeShareableClone<T>(\n value: T,\n shouldPersistRemote: boolean\n ): ShareableRef<T> {\n return this.InnerNativeModule.makeShareableClone(\n value,\n shouldPersistRemote\n );\n }\n\n makeSynchronizedDataHolder<T>(\n valueRef: ShareableRef<T>\n ): ShareableSyncDataHolderRef<T> {\n return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);\n }\n\n getDataSynchronously<T>(ref: ShareableSyncDataHolderRef<T>): T {\n return this.InnerNativeModule.getDataSynchronously(ref);\n }\n\n updateDataSynchronously<T>(\n ref: ShareableSyncDataHolderRef<T>,\n value: T\n ): void {\n this.InnerNativeModule.updateDataSynchronously(ref, value);\n }\n\n scheduleOnUI<T>(shareable: ShareableRef<T>) {\n return this.InnerNativeModule.scheduleOnUI(shareable);\n }\n\n registerSensor<T>(\n sensorType: number,\n interval: number,\n iosReferenceFrame: number,\n handler: ShareableRef<T> | ((data: Value3D | ValueRotation) => void)\n ) {\n return this.InnerNativeModule.registerSensor(\n sensorType,\n interval,\n iosReferenceFrame,\n handler\n );\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: ShareableRef<T>\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: LayoutAnimationType,\n sharedTransitionTag: string,\n config: ShareableRef<Keyframe | LayoutAnimationFunction>\n ) {\n this.InnerNativeModule.configureLayoutAnimation(\n viewTag,\n type,\n sharedTransitionTag,\n config\n );\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(\n handler: ShareableRef<number>,\n isStatusBarTranslucent: boolean\n ): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(\n handler,\n isStatusBarTranslucent\n );\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAWA,IAA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AoBA,CAClBC,SAAiB,EACjBC,YAA6B,EACrB;IACR,OAAO,IAAI,CAACzB,iBAAiB,CAACuB,oBAAoB,CAACC,SAAS,EAAEC,YAAY,CAAC;EAC7E;EAEAC,sBAAsBA,CAACC,EAAU,EAAQ;IACvC,OAAO,IAAI,CAAC3B,iBAAiB,CAAC0B,sBAAsB,CAACC,EAAE,CAAC;EAC1D;EAEAC,WAAWA,CACTC,OAAe,EACfC,QAAgB,EAChBC,QAA8B,EAClB;IACZ,OAAO,IAAI,CAAC/B,iBAAiB,CAAC4B,WAAW,CAACC,OAAO,EAAEC,QAAQ,EAAEC,QAAQ,CAAC;EACxE;EAEAC,wBAAwBA,CACtBH,OAAe,EACfI,IAAyB,EACzBC,mBAA2B,EAC3BC,MAAwD,EACxD;IACA,IAAI,CAACnC,iBAAiB,CAACgC,wBAAwB,CAC7CH,OAAO,EACPI,IAAI,EACJC,mBAAmB,EACnBC,MAAM,CACP;EACH;EAEAC,sBAAsBA,CAACC,IAAa,EAAQ;IAC1C,IAAI,CAACrC,iBAAiB,CAACoC,sBAAsB,CAACC,IAAI,CAAC;EACrD;EAEAC,cAAcA,CAACC,OAAiB,EAAEC,WAAqB,EAAQ;IAC7D,IAAI,CAACxC,iBAAiB,CAACsC,cAAc,CAACC,OAAO,EAAEC,WAAW,CAAC;EAC7D;EAEAC,0BAA0BA,CACxBrB,OAA6B,EAC7BsB,sBAA+B,EACvB;IACR,OAAO,IAAI,CAAC1C,iBAAiB,CAACyC,0BAA0B,CACtDrB,OAAO,EACPsB,sBAAsB,CACvB;EACH;EAEAC,6BAA6BA,CAACC,UAAkB,EAAQ;IACtD,IAAI,CAAC5C,iBAAiB,CAAC2C,6BAA6B,CAACC,UAAU,CAAC;EAClE;AACF;AAACC,OAAA,CAAAvD,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_reactNative","require","_checkCppVersion","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","NativeReanimated","constructor","native","arguments","length","global","__reanimatedModuleProxy","ReanimatedModule","NativeModules","installTurboModule","InnerNativeModule","Error","checkCppVersion","installCoreFunctions","callGuard","valueUnpacker","makeShareableClone","shouldPersistRemote","makeSynchronizedDataHolder","valueRef","getDataSynchronously","ref","updateDataSynchronously","scheduleOnUI","shareable","registerSensor","sensorType","interval","iosReferenceFrame","handler","unregisterSensor","sensorId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","sharedTransitionTag","config","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","isStatusBarTranslucent","unsubscribeFromKeyboardEvents","listenerId","exports"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport {\n ShareableRef,\n ShareableSyncDataHolderRef,\n Value3D,\n ValueRotation,\n} from '../commonTypes';\nimport {\n LayoutAnimationFunction,\n LayoutAnimationType,\n} from '../layoutReanimation';\nimport { checkCppVersion } from '../platform-specific/checkCppVersion';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n if (native) {\n if (this.InnerNativeModule === undefined) {\n throw new Error(\n `[Reanimated] The native part of Reanimated doesn't seem to be initialized. This could be caused by\\n\\\n - not rebuilding the app after installing or upgrading Reanimated\\n\\\n - trying to run Reanimated on an unsupported platform\\n\\\n - running in a brownfield app without manually initializing the native library`\n );\n }\n checkCppVersion();\n }\n }\n\n installCoreFunctions(\n callGuard: <T extends Array<any>, U>(\n fn: (...args: T) => U,\n ...args: T\n ) => void,\n valueUnpacker: <T>(value: T) => T\n ): void {\n return this.InnerNativeModule.installCoreFunctions(\n callGuard,\n valueUnpacker\n );\n }\n\n makeShareableClone<T>(\n value: T,\n shouldPersistRemote: boolean\n ): ShareableRef<T> {\n return this.InnerNativeModule.makeShareableClone(\n value,\n shouldPersistRemote\n );\n }\n\n makeSynchronizedDataHolder<T>(\n valueRef: ShareableRef<T>\n ): ShareableSyncDataHolderRef<T> {\n return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);\n }\n\n getDataSynchronously<T>(ref: ShareableSyncDataHolderRef<T>): T {\n return this.InnerNativeModule.getDataSynchronously(ref);\n }\n\n updateDataSynchronously<T>(\n ref: ShareableSyncDataHolderRef<T>,\n value: T\n ): void {\n this.InnerNativeModule.updateDataSynchronously(ref, value);\n }\n\n scheduleOnUI<T>(shareable: ShareableRef<T>) {\n return this.InnerNativeModule.scheduleOnUI(shareable);\n }\n\n registerSensor<T>(\n sensorType: number,\n interval: number,\n iosReferenceFrame: number,\n handler: ShareableRef<T> | ((data: Value3D | ValueRotation) => void)\n ) {\n return this.InnerNativeModule.registerSensor(\n sensorType,\n interval,\n iosReferenceFrame,\n handler\n );\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: ShareableRef<T>\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: LayoutAnimationType,\n sharedTransitionTag: string,\n config: ShareableRef<Keyframe | LayoutAnimationFunction>\n ) {\n this.InnerNativeModule.configureLayoutAnimation(\n viewTag,\n type,\n sharedTransitionTag,\n config\n );\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(\n handler: ShareableRef<number>,\n isStatusBarTranslucent: boolean\n ): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(\n handler,\n isStatusBarTranslucent\n );\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAWA,IAAAC,gBAAA,GAAAD,OAAA;AAAuE,SAAAE,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AAEhE,MAAMU,gBAAgB,CAAC;EAI5BC,WAAWA,CAAA,EAAgB;IAAA,IAAfC,MAAM,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAR,SAAA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ACzC,iBAAiB,CAACwC,0BAA0B,CACtDrB,OAAO,EACPsB,sBAAsB,CACvB;EACH;EAEAC,6BAA6BA,CAACC,UAAkB,EAAQ;IACtD,IAAI,CAAC3C,iBAAiB,CAAC0C,6BAA6B,CAACC,UAAU,CAAC;EAClE;AACF;AAACC,OAAA,CAAAtD,gBAAA,GAAAA,gBAAA"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _NativeReanimated = _interopRequireDefault(require("./NativeReanimated"));
8
+ var _commonTypes = require("./commonTypes");
9
+ var _mutables = require("./mutables");
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
13
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
+ function initSensorData(sensorType) {
15
+ if (sensorType === _commonTypes.SensorType.ROTATION) {
16
+ return (0, _mutables.makeMutable)({
17
+ qw: 0,
18
+ qx: 0,
19
+ qy: 0,
20
+ qz: 0,
21
+ yaw: 0,
22
+ pitch: 0,
23
+ roll: 0,
24
+ interfaceOrientation: 0
25
+ });
26
+ } else {
27
+ return (0, _mutables.makeMutable)({
28
+ x: 0,
29
+ y: 0,
30
+ z: 0,
31
+ interfaceOrientation: 0
32
+ });
33
+ }
34
+ }
35
+ class Sensor {
36
+ constructor(sensorType, config) {
37
+ _defineProperty(this, "listenersNumber", 0);
38
+ _defineProperty(this, "sensorId", null);
39
+ _defineProperty(this, "sensorType", void 0);
40
+ _defineProperty(this, "data", void 0);
41
+ _defineProperty(this, "config", void 0);
42
+ this.sensorType = sensorType;
43
+ this.config = config;
44
+ this.data = initSensorData(sensorType);
45
+ }
46
+ register(eventHandler) {
47
+ const config = this.config;
48
+ const sensorType = this.sensorType;
49
+ this.sensorId = _NativeReanimated.default.registerSensor(sensorType, config.interval === 'auto' ? -1 : config.interval, config.iosReferenceFrame, eventHandler);
50
+ return this.sensorId !== -1;
51
+ }
52
+ isRunning() {
53
+ return this.sensorId !== -1 && this.sensorId !== null;
54
+ }
55
+ isAvailable() {
56
+ return this.sensorId !== -1;
57
+ }
58
+ getSharedValue() {
59
+ return this.data;
60
+ }
61
+ unregister() {
62
+ if (this.sensorId !== null && this.sensorId !== -1) {
63
+ _NativeReanimated.default.unregisterSensor(this.sensorId);
64
+ }
65
+ this.sensorId = null;
66
+ }
67
+ }
68
+ exports.default = Sensor;
69
+ //# sourceMappingURL=Sensor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_NativeReanimated","_interopRequireDefault","require","_commonTypes","_mutables","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","initSensorData","sensorType","SensorType","ROTATION","makeMutable","qw","qx","qy","qz","yaw","pitch","roll","interfaceOrientation","x","y","z","Sensor","constructor","config","data","register","eventHandler","sensorId","NativeReanimatedModule","registerSensor","interval","iosReferenceFrame","isRunning","isAvailable","getSharedValue","unregister","unregisterSensor","exports"],"sources":["Sensor.ts"],"sourcesContent":["import NativeReanimatedModule from './NativeReanimated';\nimport {\n SensorType,\n SensorConfig,\n SharedValue,\n Value3D,\n ValueRotation,\n ShareableRef,\n} from './commonTypes';\nimport { makeMutable } from './mutables';\n\nfunction initSensorData(\n sensorType: SensorType\n): SharedValue<Value3D | ValueRotation> {\n if (sensorType === SensorType.ROTATION) {\n return makeMutable<Value3D | ValueRotation>({\n qw: 0,\n qx: 0,\n qy: 0,\n qz: 0,\n yaw: 0,\n pitch: 0,\n roll: 0,\n interfaceOrientation: 0,\n });\n } else {\n return makeMutable<Value3D | ValueRotation>({\n x: 0,\n y: 0,\n z: 0,\n interfaceOrientation: 0,\n });\n }\n}\n\nexport default class Sensor<T> {\n public listenersNumber = 0;\n private sensorId: number | null = null;\n private sensorType: SensorType;\n private data: SharedValue<Value3D | ValueRotation>;\n private config: SensorConfig;\n\n constructor(sensorType: SensorType, config: SensorConfig) {\n this.sensorType = sensorType;\n this.config = config;\n this.data = initSensorData(sensorType);\n }\n\n register(\n eventHandler: ShareableRef<T> | ((data: Value3D | ValueRotation) => void)\n ) {\n const config = this.config;\n const sensorType = this.sensorType;\n this.sensorId = NativeReanimatedModule.registerSensor(\n sensorType,\n config.interval === 'auto' ? -1 : config.interval,\n config.iosReferenceFrame,\n eventHandler\n );\n return this.sensorId !== -1;\n }\n\n isRunning() {\n return this.sensorId !== -1 && this.sensorId !== null;\n }\n\n isAvailable() {\n return this.sensorId !== -1;\n }\n\n getSharedValue() {\n return this.data;\n }\n\n unregister() {\n if (this.sensorId !== null && this.sensorId !== -1) {\n NativeReanimatedModule.unregisterSensor(this.sensorId);\n }\n this.sensorId = null;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,SAAA,GAAAF,OAAA;AAAyC,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA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eAAA;IAMpC,IAAI,CAACuB,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACiB,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,IAAI,GAAGnB,cAAc,CAACC,UAAU,CAAC;EACxC;EAEAmB,QAAQA,CACNC,YAAyE,EACzE;IACA,MAAMH,MAAM,GAAG,IAAI,CAACA,MAAM;IAC1B,MAAMjB,UAAU,GAAG,IAAI,CAACA,UAAU;IAClC,IAAI,CAACqB,QAAQ,GAAGC,yBAAsB,CAACC,cAAc,CACnDvB,UAAU,EACViB,MAAM,CAACO,QAAQ,KAAK,MAAM,GAAG,CAAC,CAAC,GAAGP,MAAM,CAACO,QAAQ,EACjDP,MAAM,CAACQ,iBAAiB,EACxBL,YAAY,CACb;IACD,OAAO,IAAI,CAACC,QAAQ,KAAK,CAAC,CAAC;EAC7B;EAEAK,SAASA,CAAA,EAAG;IACV,OAAO,IAAI,CAACL,QAAQ,KAAK,CAAC,CAAC,IAAI,IAAI,CAACA,QAAQ,KAAK,IAAI;EACvD;EAEAM,WAAWA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACN,QAAQ,KAAK,CAAC,CAAC;EAC7B;EAEAO,cAAcA,CAAA,EAAG;IACf,OAAO,IAAI,CAACV,IAAI;EAClB;EAEAW,UAAUA,CAAA,EAAG;IACX,IAAI,IAAI,CAACR,QAAQ,KAAK,IAAI,IAAI,IAAI,CAACA,QAAQ,KAAK,CAAC,CAAC,EAAE;MAClDC,yBAAsB,CAACQ,gBAAgB,CAAC,IAAI,CAACT,QAAQ,CAAC;IACxD;IACA,IAAI,CAACA,QAAQ,GAAG,IAAI;EACtB;AACF;AAACU,OAAA,CAAAvD,OAAA,GAAAuC,MAAA"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SensorContainer = void 0;
7
+ var _Sensor = _interopRequireDefault(require("./Sensor"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
12
+ class SensorContainer {
13
+ constructor() {
14
+ _defineProperty(this, "nativeSensors", new Map());
15
+ }
16
+ getSensorId(sensorType, config) {
17
+ return sensorType * 100 + config.iosReferenceFrame * 10 + Number(config.adjustToInterfaceOrientation);
18
+ }
19
+ initializeSensor(sensorType, config) {
20
+ const sensorId = this.getSensorId(sensorType, config);
21
+ if (!this.nativeSensors.has(sensorId)) {
22
+ const newSensor = new _Sensor.default(sensorType, config);
23
+ this.nativeSensors.set(sensorId, newSensor);
24
+ }
25
+ const sensor = this.nativeSensors.get(sensorId);
26
+ return sensor.getSharedValue();
27
+ }
28
+ registerSensor(sensorType, config, handler) {
29
+ const sensorId = this.getSensorId(sensorType, config);
30
+ if (!this.nativeSensors.has(sensorId)) {
31
+ return -1;
32
+ }
33
+ const sensor = this.nativeSensors.get(sensorId);
34
+ if (sensor && sensor.isAvailable() && (sensor.isRunning() || sensor.register(handler))) {
35
+ sensor.listenersNumber++;
36
+ return sensorId;
37
+ }
38
+ return -1;
39
+ }
40
+ unregisterSensor(sensorId) {
41
+ if (this.nativeSensors.has(sensorId)) {
42
+ const sensor = this.nativeSensors.get(sensorId);
43
+ if (sensor && sensor.isRunning()) {
44
+ sensor.listenersNumber--;
45
+ if (sensor.listenersNumber === 0) {
46
+ sensor.unregister();
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ exports.SensorContainer = SensorContainer;
53
+ //# sourceMappingURL=SensorContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_Sensor","_interopRequireDefault","require","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","SensorContainer","constructor","Map","getSensorId","sensorType","config","iosReferenceFrame","adjustToInterfaceOrientation","initializeSensor","sensorId","nativeSensors","has","newSensor","Sensor","set","sensor","get","getSharedValue","registerSensor","handler","isAvailable","isRunning","register","listenersNumber","unregisterSensor","unregister","exports"],"sources":["SensorContainer.ts"],"sourcesContent":["import {\n SensorType,\n SensorConfig,\n Value3D,\n ValueRotation,\n ShareableRef,\n SharedValue,\n} from './commonTypes';\nimport Sensor from './Sensor';\n\nexport class SensorContainer {\n private nativeSensors: Map<number, Sensor<any>> = new Map();\n\n getSensorId(sensorType: SensorType, config: SensorConfig) {\n return (\n sensorType * 100 +\n config.iosReferenceFrame * 10 +\n Number(config.adjustToInterfaceOrientation)\n );\n }\n\n initializeSensor(\n sensorType: SensorType,\n config: SensorConfig\n ): SharedValue<Value3D | ValueRotation> {\n const sensorId = this.getSensorId(sensorType, config);\n\n if (!this.nativeSensors.has(sensorId)) {\n const newSensor = new Sensor(sensorType, config);\n this.nativeSensors.set(sensorId, newSensor);\n }\n\n const sensor = this.nativeSensors.get(sensorId);\n return sensor!.getSharedValue();\n }\n\n registerSensor<T>(\n sensorType: SensorType,\n config: SensorConfig,\n handler: ShareableRef<T> | ((data: Value3D | ValueRotation) => void)\n ): number {\n const sensorId = this.getSensorId(sensorType, config);\n\n if (!this.nativeSensors.has(sensorId)) {\n return -1;\n }\n\n const sensor = this.nativeSensors.get(sensorId);\n if (\n sensor &&\n sensor.isAvailable() &&\n (sensor.isRunning() || sensor.register(handler))\n ) {\n sensor.listenersNumber++;\n return sensorId;\n }\n return -1;\n }\n\n unregisterSensor(sensorId: number) {\n if (this.nativeSensors.has(sensorId)) {\n const sensor = this.nativeSensors.get(sensorId);\n if (sensor && sensor.isRunning()) {\n sensor.listenersNumber--;\n if (sensor.listenersNumber === 0) {\n sensor.unregister();\n }\n }\n }\n }\n}\n"],"mappings":";;;;;;AAQA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8B,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AAEvB,MAAMU,eAAe,CAAC;EAAAC,YAAA;IAAAvB,eAAA,wBACuB,IAAIwB,GAAG,EAAE;EAAA;EAE3DC,WAAWA,CAACC,UAAsB,EAAEC,MAAoB,EAAE;IACxD,OACED,UAAU,GAAG,GAAG,GAChBC,MAAM,C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CAACM,GAAG,CAACP,QAAQ,CAAC;MAC/C,IAAIM,MAAM,IAAIA,MAAM,CAACM,SAAS,EAAE,EAAE;QAChCN,MAAM,CAACQ,eAAe,EAAE;QACxB,IAAIR,MAAM,CAACQ,eAAe,KAAK,CAAC,EAAE;UAChCR,MAAM,CAACU,UAAU,EAAE;QACrB;MACF;IACF;EACF;AACF;AAACC,OAAA,CAAA1B,eAAA,GAAAA,eAAA"}
@@ -144,6 +144,27 @@ function decorateAnimation(animation) {
144
144
  });
145
145
  return finished;
146
146
  };
147
+ const objectOnStart = (animation, value, timestamp, previousAnimation) => {
148
+ for (const key in value) {
149
+ animation[key] = Object.assign({}, animationCopy);
150
+ animation[key].onStart = animation.onStart;
151
+ animation[key].current = value[key];
152
+ animation[key].toValue = animation.toValue[key];
153
+ animation[key].onStart(animation[key], value[key], timestamp, previousAnimation ? previousAnimation[key] : undefined);
154
+ }
155
+ animation.current = value;
156
+ };
157
+ const objectOnFrame = (animation, timestamp) => {
158
+ let finished = true;
159
+ const newObject = {};
160
+ for (const key in animation.current) {
161
+ // @ts-ignore: disable-next-line
162
+ finished &= animation[key].onFrame(animation[key], timestamp);
163
+ newObject[key] = animation[key].current;
164
+ }
165
+ animation.current = newObject;
166
+ return finished;
167
+ };
147
168
  animation.onStart = (animation, value, timestamp, previousAnimation) => {
148
169
  if ((0, _Colors.isColor)(value)) {
149
170
  colorOnStart(animation, value, timestamp, previousAnimation);
@@ -157,6 +178,10 @@ function decorateAnimation(animation) {
157
178
  prefNumberSuffOnStart(animation, value, timestamp, previousAnimation);
158
179
  animation.onFrame = prefNumberSuffOnFrame;
159
180
  return;
181
+ } else if (typeof value === 'object' && value !== null) {
182
+ objectOnStart(animation, value, timestamp, previousAnimation);
183
+ animation.onFrame = objectOnFrame;
184
+ return;
160
185
  }
161
186
  baseOnStart(animation, value, timestamp, previousAnimation);
162
187
  };