react-native-reanimated 2.8.0 → 2.10.0
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.
- package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +4 -4
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +38 -0
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +23 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +17 -11
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +8 -0
- package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +8 -0
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +5 -0
- package/RNReanimated.podspec +22 -3
- package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/CMakeLists.txt +216 -84
- package/android/build.gradle +255 -229
- package/android/react-native-reanimated-66-hermes.aar +0 -0
- package/android/react-native-reanimated-66-jsc.aar +0 -0
- package/android/react-native-reanimated-67-hermes.aar +0 -0
- package/android/react-native-reanimated-67-jsc.aar +0 -0
- package/android/react-native-reanimated-68-hermes.aar +0 -0
- package/android/react-native-reanimated-68-jsc.aar +0 -0
- package/android/react-native-reanimated-69-hermes.aar +0 -0
- package/android/react-native-reanimated-69-jsc.aar +0 -0
- package/android/react-native-reanimated-70-hermes.aar +0 -0
- package/android/react-native-reanimated-70-jsc.aar +0 -0
- package/{lib/types/lib/reanimated2/platform-specific/RNRenderer.web.d.ts → android/rnVersionPatch/69/.gitkeep} +0 -0
- package/android/rnVersionPatch/70/.gitkeep +0 -0
- package/android/src/main/cpp/NativeProxy.cpp +56 -11
- package/android/src/main/cpp/OnLoad.cpp +1 -0
- package/android/src/main/cpp/headers/NativeProxy.h +29 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +25 -0
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +3 -1
- package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +165 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +19 -16
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +5 -1
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +24 -1
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +7 -5
- package/ios/REANodesManager.m +31 -8
- package/ios/keyboardObserver/REAKeyboardEventObserver.h +17 -0
- package/ios/keyboardObserver/REAKeyboardEventObserver.m +198 -0
- package/ios/native/NativeProxy.mm +20 -1
- package/ios/native/REAInitializer.mm +10 -4
- package/ios/sensor/ReanimatedSensor.m +27 -18
- package/lib/Animated.js +8 -21
- package/lib/index.js +12 -20
- package/lib/index.web.js +4 -0
- package/lib/reanimated2/Colors.js +1 -1
- package/lib/reanimated2/NativeMethods.js +3 -0
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +7 -1
- package/lib/reanimated2/animation/sequence.js +0 -3
- package/lib/reanimated2/animation/util.js +4 -1
- package/lib/reanimated2/commonTypes.js +8 -1
- package/lib/reanimated2/component/FlatList.js +8 -8
- package/lib/reanimated2/component/Image.js +4 -0
- package/lib/reanimated2/component/ScrollView.js +4 -0
- package/lib/reanimated2/component/Text.js +4 -0
- package/lib/reanimated2/component/View.js +4 -0
- package/lib/reanimated2/core.js +5 -9
- package/lib/reanimated2/frameCallback/FrameCallbackRegistryJS.js +32 -0
- package/lib/reanimated2/frameCallback/FrameCallbackRegistryUI.js +47 -0
- package/lib/reanimated2/globals.d.ts +3 -0
- package/lib/reanimated2/hook/index.js +2 -0
- package/lib/reanimated2/hook/useAnimatedKeyboard.js +31 -0
- package/lib/reanimated2/hook/useAnimatedSensor.js +3 -3
- package/lib/reanimated2/hook/useFrameCallback.js +23 -0
- package/lib/reanimated2/hook/utils.js +0 -5
- package/lib/reanimated2/jestUtils.js +11 -3
- package/lib/reanimated2/js-reanimated/JSReanimated.js +7 -0
- package/lib/reanimated2/js-reanimated/global.js +36 -0
- package/lib/reanimated2/js-reanimated/index.js +0 -24
- package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +1 -1
- package/lib/reanimated2/mock.js +6 -0
- package/lib/types/Animated.d.ts +8 -0
- package/lib/types/{lib/ConfigHelper.d.ts → ConfigHelper.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedEventEmitter.d.ts → ReanimatedEventEmitter.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModule.d.ts → ReanimatedModule.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModule.macos.d.ts → ReanimatedModule.macos.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModule.native.d.ts → ReanimatedModule.native.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModule.windows.d.ts → ReanimatedModule.windows.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModuleCompat.d.ts → ReanimatedModuleCompat.d.ts} +0 -0
- package/lib/types/{lib/createAnimatedComponent.d.ts → createAnimatedComponent.d.ts} +0 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/index.web.d.ts +3 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/Bezier.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/Colors.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/Easing.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/NativeMethods.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/NativeReanimated/NativeReanimated.d.ts +3 -1
- package/lib/types/{lib/reanimated2 → reanimated2}/NativeReanimated/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/PlatformChecker.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/PropAdapters.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/UpdateProps.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/ViewDescriptorsSet.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/WorkletEventHandler.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/__mocks__/MutableValue.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/__mocks__/NativeReanimated.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/__mocks__/NativeReanimated.native.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/commonTypes.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/decay.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/delay.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/repeat.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/sequence.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/spring.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/styleAnimation.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/timing.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/util.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/commonTypes.d.ts +12 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/component/FlatList.d.ts +2 -2
- package/lib/types/reanimated2/component/Image.d.ts +3 -0
- package/lib/types/reanimated2/component/ScrollView.d.ts +3 -0
- package/lib/types/reanimated2/component/Text.d.ts +3 -0
- package/lib/types/reanimated2/component/View.d.ts +3 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/core.d.ts +0 -0
- package/lib/types/reanimated2/frameCallback/FrameCallbackRegistryJS.d.ts +7 -0
- package/lib/types/reanimated2/frameCallback/FrameCallbackRegistryUI.d.ts +10 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/Hooks.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/commonTypes.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/index.d.ts +3 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedGestureHandler.d.ts +0 -0
- package/lib/types/reanimated2/hook/useAnimatedKeyboard.d.ts +2 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedReaction.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedRef.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedScrollHandler.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedSensor.d.ts +1 -1
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedStyle.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useDerivedValue.d.ts +0 -0
- package/lib/types/reanimated2/hook/useFrameCallback.d.ts +6 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useSharedValue.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/utils.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/interpolateColor.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/interpolation.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/jestUtils.d.ts +1 -1
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/JSReanimated.d.ts +3 -1
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/Mapper.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/MapperRegistry.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/MutableValue.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/commonTypes.d.ts +0 -0
- package/lib/types/reanimated2/js-reanimated/global.d.ts +2 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/LayoutAnimationRepository.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/commonTypes.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Bounce.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Default.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Fade.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Flip.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Lightspeed.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Pinwheel.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Roll.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Rotate.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Slide.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Stretch.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Zoom.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/FadingTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/LinearTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/mock.d.ts +6 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/platform-specific/RNRenderer.d.ts +0 -0
- package/lib/types/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/utils.d.ts +0 -0
- package/lib/types/{lib/setAndForwardRef.d.ts → setAndForwardRef.d.ts} +0 -0
- package/mock.js +1 -0
- package/package.json +15 -10
- package/plugin.js +7 -6
- package/react-native-reanimated.d.ts +56 -8
- package/src/Animated.ts +13 -0
- package/src/index.ts +15 -0
- package/src/index.web.ts +5 -0
- package/src/reanimated2/Colors.ts +1 -1
- package/src/reanimated2/NativeMethods.ts +5 -0
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +10 -1
- package/src/reanimated2/animation/sequence.ts +0 -5
- package/src/reanimated2/animation/util.ts +8 -1
- package/src/reanimated2/commonTypes.ts +15 -0
- package/src/reanimated2/component/FlatList.tsx +32 -25
- package/src/reanimated2/component/Image.ts +6 -0
- package/src/reanimated2/component/ScrollView.ts +6 -0
- package/src/reanimated2/component/Text.ts +6 -0
- package/src/reanimated2/component/View.ts +6 -0
- package/src/reanimated2/core.ts +8 -13
- package/src/reanimated2/frameCallback/FrameCallbackRegistryJS.ts +43 -0
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +64 -0
- package/src/reanimated2/globals.d.ts +3 -0
- package/src/reanimated2/hook/index.ts +3 -0
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +35 -0
- package/src/reanimated2/hook/useAnimatedSensor.ts +5 -5
- package/src/reanimated2/hook/useFrameCallback.ts +39 -0
- package/src/reanimated2/hook/utils.ts +0 -6
- package/src/reanimated2/jestUtils.ts +11 -3
- package/src/reanimated2/js-reanimated/JSReanimated.ts +16 -1
- package/src/reanimated2/js-reanimated/global.ts +45 -0
- package/src/reanimated2/js-reanimated/index.ts +0 -31
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +1 -1
- package/src/reanimated2/mock.ts +6 -0
- package/android/react-native-reanimated-64-hermes.aar +0 -0
- package/android/react-native-reanimated-64-jsc.aar +0 -0
- package/android/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/lib/reanimated2/component/WrappedComponents.js +0 -9
- package/lib/reanimated2/component/index.js +0 -4
- package/lib/types/lib/reanimated2/component/WrappedComponents.d.ts +0 -8
- package/lib/types/lib/reanimated2/component/index.d.ts +0 -9
- package/lib/types/react-native-reanimated-tests.d.ts +0 -1
- package/src/Animated.js +0 -22
- package/src/reanimated2/component/WrappedComponents.ts +0 -11
- package/src/reanimated2/component/index.ts +0 -9
|
@@ -35,10 +35,10 @@ jsi::Value AnimatedSensorModule::registerSensor(
|
|
|
35
35
|
setter = [&, mutableObject](double newValues[]) {
|
|
36
36
|
jsi::Runtime &runtime = *runtimeManager_->runtime.get();
|
|
37
37
|
jsi::Object value(runtime);
|
|
38
|
-
value.setProperty(runtime, "
|
|
39
|
-
value.setProperty(runtime, "
|
|
40
|
-
value.setProperty(runtime, "
|
|
41
|
-
value.setProperty(runtime, "
|
|
38
|
+
value.setProperty(runtime, "qx", newValues[0]);
|
|
39
|
+
value.setProperty(runtime, "qy", newValues[1]);
|
|
40
|
+
value.setProperty(runtime, "qz", newValues[2]);
|
|
41
|
+
value.setProperty(runtime, "qw", newValues[3]);
|
|
42
42
|
value.setProperty(runtime, "yaw", newValues[4]);
|
|
43
43
|
value.setProperty(runtime, "pitch", newValues[5]);
|
|
44
44
|
value.setProperty(runtime, "roll", newValues[6]);
|
|
@@ -98,6 +98,10 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
98
98
|
this->onRender(timestampMs);
|
|
99
99
|
};
|
|
100
100
|
updaterFunction = platformDepMethodsHolder.updaterFunction;
|
|
101
|
+
subscribeForKeyboardEventsFunction =
|
|
102
|
+
platformDepMethodsHolder.subscribeForKeyboardEvents;
|
|
103
|
+
unsubscribeFromKeyboardEventsFunction =
|
|
104
|
+
platformDepMethodsHolder.unsubscribeFromKeyboardEvents;
|
|
101
105
|
}
|
|
102
106
|
|
|
103
107
|
void NativeReanimatedModule::installCoreFunctions(
|
|
@@ -327,4 +331,38 @@ void NativeReanimatedModule::unregisterSensor(
|
|
|
327
331
|
animatedSensorModule.unregisterSensor(sensorId);
|
|
328
332
|
}
|
|
329
333
|
|
|
334
|
+
jsi::Value NativeReanimatedModule::subscribeForKeyboardEvents(
|
|
335
|
+
jsi::Runtime &rt,
|
|
336
|
+
const jsi::Value &keyboardEventContainer) {
|
|
337
|
+
jsi::Object keyboardEventObj = keyboardEventContainer.getObject(rt);
|
|
338
|
+
std::unordered_map<std::string, std::shared_ptr<ShareableValue>>
|
|
339
|
+
sharedProperties;
|
|
340
|
+
std::shared_ptr<ShareableValue> keyboardStateShared = ShareableValue::adapt(
|
|
341
|
+
rt, keyboardEventObj.getProperty(rt, "state"), this);
|
|
342
|
+
std::shared_ptr<ShareableValue> heightShared = ShareableValue::adapt(
|
|
343
|
+
rt, keyboardEventObj.getProperty(rt, "height"), this);
|
|
344
|
+
|
|
345
|
+
auto keyboardEventDataUpdater =
|
|
346
|
+
[this, &rt, keyboardStateShared, heightShared](
|
|
347
|
+
int keyboardState, int height) {
|
|
348
|
+
auto &keyboardStateValue =
|
|
349
|
+
ValueWrapper::asMutableValue(keyboardStateShared->valueContainer);
|
|
350
|
+
keyboardStateValue->setValue(rt, jsi::Value(keyboardState));
|
|
351
|
+
|
|
352
|
+
auto &heightMutableValue =
|
|
353
|
+
ValueWrapper::asMutableValue(heightShared->valueContainer);
|
|
354
|
+
heightMutableValue->setValue(rt, jsi::Value(height));
|
|
355
|
+
|
|
356
|
+
this->mapperRegistry->execute(*this->runtime);
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
return subscribeForKeyboardEventsFunction(keyboardEventDataUpdater);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
void NativeReanimatedModule::unsubscribeFromKeyboardEvents(
|
|
363
|
+
jsi::Runtime &rt,
|
|
364
|
+
const jsi::Value &listenerId) {
|
|
365
|
+
unsubscribeFromKeyboardEventsFunction(listenerId.asNumber());
|
|
366
|
+
}
|
|
367
|
+
|
|
330
368
|
} // namespace reanimated
|
|
@@ -138,6 +138,25 @@ static jsi::Value SPEC_PREFIX(configureProps)(
|
|
|
138
138
|
return jsi::Value::undefined();
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
static jsi::Value SPEC_PREFIX(subscribeForKeyboardEvents)(
|
|
142
|
+
jsi::Runtime &rt,
|
|
143
|
+
TurboModule &turboModule,
|
|
144
|
+
const jsi::Value *args,
|
|
145
|
+
size_t count) {
|
|
146
|
+
return static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
147
|
+
->subscribeForKeyboardEvents(rt, std::move(args[0]));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
static jsi::Value SPEC_PREFIX(unsubscribeFromKeyboardEvents)(
|
|
151
|
+
jsi::Runtime &rt,
|
|
152
|
+
TurboModule &turboModule,
|
|
153
|
+
const jsi::Value *args,
|
|
154
|
+
size_t count) {
|
|
155
|
+
static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
156
|
+
->unsubscribeFromKeyboardEvents(rt, std::move(args[0]));
|
|
157
|
+
return jsi::Value::undefined();
|
|
158
|
+
}
|
|
159
|
+
|
|
141
160
|
NativeReanimatedModuleSpec::NativeReanimatedModuleSpec(
|
|
142
161
|
std::shared_ptr<CallInvoker> jsInvoker)
|
|
143
162
|
: TurboModule("NativeReanimated", jsInvoker) {
|
|
@@ -163,5 +182,9 @@ NativeReanimatedModuleSpec::NativeReanimatedModuleSpec(
|
|
|
163
182
|
methodMap_["unregisterSensor"] =
|
|
164
183
|
MethodMetadata{1, SPEC_PREFIX(unregisterSensor)};
|
|
165
184
|
methodMap_["configureProps"] = MethodMetadata{2, SPEC_PREFIX(configureProps)};
|
|
185
|
+
methodMap_["subscribeForKeyboardEvents"] =
|
|
186
|
+
MethodMetadata{1, SPEC_PREFIX(subscribeForKeyboardEvents)};
|
|
187
|
+
methodMap_["unsubscribeFromKeyboardEvents"] =
|
|
188
|
+
MethodMetadata{1, SPEC_PREFIX(unsubscribeFromKeyboardEvents)};
|
|
166
189
|
}
|
|
167
190
|
} // namespace reanimated
|
|
@@ -71,21 +71,27 @@ void RuntimeDecorator::decorateRuntime(
|
|
|
71
71
|
1,
|
|
72
72
|
setGlobalConsole));
|
|
73
73
|
|
|
74
|
+
auto chronoNow = [](jsi::Runtime &rt,
|
|
75
|
+
const jsi::Value &thisValue,
|
|
76
|
+
const jsi::Value *args,
|
|
77
|
+
size_t count) -> jsi::Value {
|
|
78
|
+
double now = std::chrono::system_clock::now().time_since_epoch() /
|
|
79
|
+
std::chrono::milliseconds(1);
|
|
80
|
+
return jsi::Value(now);
|
|
81
|
+
};
|
|
82
|
+
|
|
74
83
|
rt.global().setProperty(
|
|
75
84
|
rt,
|
|
76
85
|
"_chronoNow",
|
|
77
86
|
jsi::Function::createFromHostFunction(
|
|
78
|
-
rt,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
std::chrono::milliseconds(1);
|
|
87
|
-
return jsi::Value(now);
|
|
88
|
-
}));
|
|
87
|
+
rt, jsi::PropNameID::forAscii(rt, "_chronoNow"), 0, chronoNow));
|
|
88
|
+
jsi::Object performance(rt);
|
|
89
|
+
performance.setProperty(
|
|
90
|
+
rt,
|
|
91
|
+
"now",
|
|
92
|
+
jsi::Function::createFromHostFunction(
|
|
93
|
+
rt, jsi::PropNameID::forAscii(rt, "now"), 0, chronoNow));
|
|
94
|
+
rt.global().setProperty(rt, "performance", performance);
|
|
89
95
|
}
|
|
90
96
|
|
|
91
97
|
void RuntimeDecorator::decorateUIRuntime(
|
|
@@ -89,6 +89,12 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
89
89
|
const jsi::Value &interval,
|
|
90
90
|
const jsi::Value &sensorDataContainer) override;
|
|
91
91
|
void unregisterSensor(jsi::Runtime &rt, const jsi::Value &sensorId) override;
|
|
92
|
+
jsi::Value subscribeForKeyboardEvents(
|
|
93
|
+
jsi::Runtime &rt,
|
|
94
|
+
const jsi::Value &keyboardEventContainer) override;
|
|
95
|
+
void unsubscribeFromKeyboardEvents(
|
|
96
|
+
jsi::Runtime &rt,
|
|
97
|
+
const jsi::Value &listenerId) override;
|
|
92
98
|
|
|
93
99
|
private:
|
|
94
100
|
std::shared_ptr<MapperRegistry> mapperRegistry;
|
|
@@ -103,6 +109,8 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
103
109
|
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy;
|
|
104
110
|
AnimatedSensorModule animatedSensorModule;
|
|
105
111
|
ConfigurePropsFunction configurePropsPlatformFunction;
|
|
112
|
+
KeyboardEventSubscribeFunction subscribeForKeyboardEventsFunction;
|
|
113
|
+
KeyboardEventUnsubscribeFunction unsubscribeFromKeyboardEventsFunction;
|
|
106
114
|
};
|
|
107
115
|
|
|
108
116
|
} // namespace reanimated
|
|
@@ -69,6 +69,14 @@ class JSI_EXPORT NativeReanimatedModuleSpec : public TurboModule {
|
|
|
69
69
|
jsi::Runtime &rt,
|
|
70
70
|
const jsi::Value &sensorId) = 0;
|
|
71
71
|
|
|
72
|
+
// keyboard
|
|
73
|
+
virtual jsi::Value subscribeForKeyboardEvents(
|
|
74
|
+
jsi::Runtime &rt,
|
|
75
|
+
const jsi::Value &keyboardEventContainer) = 0;
|
|
76
|
+
virtual void unsubscribeFromKeyboardEvents(
|
|
77
|
+
jsi::Runtime &rt,
|
|
78
|
+
const jsi::Value &listenerId) = 0;
|
|
79
|
+
|
|
72
80
|
// other
|
|
73
81
|
virtual jsi::Value enableLayoutAnimations(
|
|
74
82
|
jsi::Runtime &rt,
|
|
@@ -30,6 +30,9 @@ using ConfigurePropsFunction = std::function<void(
|
|
|
30
30
|
jsi::Runtime &rt,
|
|
31
31
|
const jsi::Value &uiProps,
|
|
32
32
|
const jsi::Value &nativeProps)>;
|
|
33
|
+
using KeyboardEventSubscribeFunction =
|
|
34
|
+
std::function<int(std::function<void(int, int)>)>;
|
|
35
|
+
using KeyboardEventUnsubscribeFunction = std::function<void(int)>;
|
|
33
36
|
|
|
34
37
|
struct PlatformDepMethodsHolder {
|
|
35
38
|
RequestRender requestRender;
|
|
@@ -41,6 +44,8 @@ struct PlatformDepMethodsHolder {
|
|
|
41
44
|
UnregisterSensorFunction unregisterSensor;
|
|
42
45
|
SetGestureStateFunction setGestureStateFunction;
|
|
43
46
|
ConfigurePropsFunction configurePropsFunction;
|
|
47
|
+
KeyboardEventSubscribeFunction subscribeForKeyboardEvents;
|
|
48
|
+
KeyboardEventUnsubscribeFunction unsubscribeFromKeyboardEvents;
|
|
44
49
|
};
|
|
45
50
|
|
|
46
51
|
} // namespace reanimated
|
package/RNReanimated.podspec
CHANGED
|
@@ -4,14 +4,16 @@ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
|
4
4
|
|
|
5
5
|
reactVersion = '0.0.0'
|
|
6
6
|
reactTargetTvOS = false
|
|
7
|
+
isUserApp = false
|
|
7
8
|
|
|
8
9
|
begin
|
|
9
|
-
#
|
|
10
|
+
# user app
|
|
10
11
|
# /appName/node_modules/react-native-reanimated/RNReanimated.podspec
|
|
11
12
|
# /appName/node_modules/react-native/package.json
|
|
12
13
|
reactJson = JSON.parse(File.read(File.join(__dir__, "..", "..", "node_modules", "react-native", "package.json")))
|
|
13
14
|
reactVersion = reactJson["version"]
|
|
14
15
|
reactTargetTvOS = reactJson["name"] == "react-native-tvos"
|
|
16
|
+
isUserApp = true
|
|
15
17
|
rescue
|
|
16
18
|
begin
|
|
17
19
|
# monorepo
|
|
@@ -31,11 +33,25 @@ rescue
|
|
|
31
33
|
rescue
|
|
32
34
|
# should never happen
|
|
33
35
|
reactVersion = '0.68.0'
|
|
34
|
-
puts "[RNReanimated] Unable to
|
|
36
|
+
puts "[RNReanimated] Unable to recognize your `react-native` version! Default `react-native` version: " + reactVersion
|
|
35
37
|
end
|
|
36
38
|
end
|
|
37
39
|
end
|
|
38
40
|
|
|
41
|
+
if isUserApp
|
|
42
|
+
libInstances = %x[find ../../ -name "package.json" | grep "/react-native-reanimated/package.json"]
|
|
43
|
+
libInstancesArray = libInstances.split("\n")
|
|
44
|
+
if libInstancesArray.length() > 1
|
|
45
|
+
parsedLocation = ''
|
|
46
|
+
for location in libInstancesArray
|
|
47
|
+
location['../../'] = '- '
|
|
48
|
+
location['/package.json'] = ''
|
|
49
|
+
parsedLocation += location + "\n"
|
|
50
|
+
end
|
|
51
|
+
raise "[Reanimated] Multiple versions of Reanimated were detected. Only one instance of react-native-reanimated can be installed in a project. You need to resolve the conflict manually. Check out the documentation: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/troubleshooting#multiple-versions-of-reanimated-were-detected \n\nConflict between: \n" + parsedLocation
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
39
55
|
rnVersion = reactVersion.split('.')[1]
|
|
40
56
|
|
|
41
57
|
folly_prefix = ""
|
|
@@ -46,7 +62,6 @@ end
|
|
|
46
62
|
|
|
47
63
|
folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DRNVERSION=' + rnVersion
|
|
48
64
|
folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
|
|
49
|
-
folly_version = '2021.04.26.00'
|
|
50
65
|
boost_compiler_flags = '-Wno-documentation'
|
|
51
66
|
|
|
52
67
|
Pod::Spec.new do |s|
|
|
@@ -86,6 +101,10 @@ Pod::Spec.new do |s|
|
|
|
86
101
|
s.requires_arc = true
|
|
87
102
|
|
|
88
103
|
s.dependency "React-Core"
|
|
104
|
+
s.dependency "#{folly_prefix}Folly"
|
|
105
|
+
s.dependency "RCTRequired"
|
|
106
|
+
s.dependency "RCTTypeSafety"
|
|
107
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
89
108
|
s.dependency 'FBLazyVector'
|
|
90
109
|
s.dependency 'FBReactNativeSpec'
|
|
91
110
|
s.dependency 'RCTRequired'
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#
|
|
1
|
+
#Fri Aug 19 13:09:51 UTC 2022
|
|
2
2
|
gradle.version=7.2
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|