react-native-reanimated 2.9.1 → 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/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 +214 -95
- package/android/build.gradle +247 -236
- 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/70/.gitkeep} +0 -0
- package/android/src/main/cpp/NativeProxy.cpp +54 -20
- 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/ReanimatedSensorType.java +1 -1
- 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 +8 -12
- package/ios/sensor/ReanimatedSensor.m +26 -17
- package/lib/index.js +11 -3
- 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 +6 -0
- package/lib/reanimated2/animation/util.js +4 -1
- package/lib/reanimated2/commonTypes.js +8 -1
- package/lib/reanimated2/component/FlatList.js +5 -5
- package/lib/reanimated2/core.js +5 -4
- 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/jestUtils.js +11 -3
- package/lib/reanimated2/js-reanimated/JSReanimated.js +7 -0
- package/lib/reanimated2/js-reanimated/global.js +33 -22
- package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +1 -1
- package/lib/types/{lib/Animated.d.ts → Animated.d.ts} +0 -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/{lib/index.d.ts → index.web.d.ts} +0 -1
- 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/{lib/reanimated2 → reanimated2}/component/Image.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/component/ScrollView.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/component/Text.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/component/View.d.ts +0 -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 +0 -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 +5 -6
- package/plugin.js +7 -16
- package/react-native-reanimated.d.ts +55 -4
- package/src/index.ts +11 -3
- 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 +9 -0
- package/src/reanimated2/animation/util.ts +8 -1
- package/src/reanimated2/commonTypes.ts +15 -0
- package/src/reanimated2/component/FlatList.tsx +29 -19
- package/src/reanimated2/core.ts +8 -8
- 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/jestUtils.ts +11 -3
- package/src/reanimated2/js-reanimated/JSReanimated.ts +16 -1
- package/src/reanimated2/js-reanimated/global.ts +41 -29
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +1 -1
- package/android/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/lib/types/lib/reanimated2/js-reanimated/global.d.ts +0 -1
- package/lib/types/react-native-reanimated-tests.d.ts +0 -1
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
#include <memory>
|
|
8
8
|
#include <string>
|
|
9
9
|
|
|
10
|
-
#if
|
|
10
|
+
#if JS_RUNTIME_HERMES
|
|
11
11
|
#include <hermes/hermes.h>
|
|
12
|
+
#elif JS_RUNTIME_V8
|
|
13
|
+
#include <v8runtime/V8RuntimeFactory.h>
|
|
12
14
|
#else
|
|
13
15
|
#include <jsi/JSCRuntime.h>
|
|
14
16
|
#endif
|
|
@@ -38,10 +40,8 @@ NativeProxy::NativeProxy(
|
|
|
38
40
|
layoutAnimations(std::move(_layoutAnimations)) {}
|
|
39
41
|
|
|
40
42
|
NativeProxy::~NativeProxy() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
jsi::PropNameID::forAscii(*runtime_, "__reanimatedModuleProxy"),
|
|
44
|
-
jsi::Value::undefined());
|
|
43
|
+
// removed temporary, new event listener mechanism need fix on the RN side
|
|
44
|
+
// reactScheduler_->removeEventListener(eventListener_);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
jni::local_ref<NativeProxy::jhybriddata> NativeProxy::initHybrid(
|
|
@@ -136,31 +136,44 @@ void NativeProxy::installJSIBindings() {
|
|
|
136
136
|
auto setGestureStateFunction = [this](int handlerTag, int newState) -> void {
|
|
137
137
|
setGestureState(handlerTag, newState);
|
|
138
138
|
};
|
|
139
|
-
|
|
139
|
+
|
|
140
|
+
auto subscribeForKeyboardEventsFunction =
|
|
141
|
+
[this](std::function<void(int, int)> keyboardEventDataUpdater) -> int {
|
|
142
|
+
return subscribeForKeyboardEvents(std::move(keyboardEventDataUpdater));
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
auto unsubscribeFromKeyboardEventsFunction = [this](int listenerId) -> void {
|
|
146
|
+
unsubscribeFromKeyboardEvents(listenerId);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
#if JS_RUNTIME_HERMES
|
|
140
150
|
auto config =
|
|
141
151
|
::hermes::vm::RuntimeConfig::Builder().withEnableSampleProfiling(false);
|
|
142
152
|
std::shared_ptr<jsi::Runtime> animatedRuntime =
|
|
143
153
|
facebook::hermes::makeHermesRuntime(config.build());
|
|
154
|
+
#elif JS_RUNTIME_V8
|
|
155
|
+
auto config = std::make_unique<rnv8::V8RuntimeConfig>();
|
|
156
|
+
config->enableInspector = false;
|
|
157
|
+
config->appName = "reanimated";
|
|
158
|
+
std::shared_ptr<jsi::Runtime> animatedRuntime =
|
|
159
|
+
rnv8::createSharedV8Runtime(runtime_, std::move(config));
|
|
144
160
|
#else
|
|
145
161
|
std::shared_ptr<jsi::Runtime> animatedRuntime =
|
|
146
162
|
facebook::jsc::makeJSCRuntime();
|
|
147
163
|
#endif
|
|
148
|
-
auto workletRuntimeValue =
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
.getObject(*runtime_)
|
|
156
|
-
|
|
157
|
-
.data(*runtime_));
|
|
164
|
+
auto workletRuntimeValue =
|
|
165
|
+
runtime_->global()
|
|
166
|
+
.getProperty(*runtime_, "ArrayBuffer")
|
|
167
|
+
.asObject(*runtime_)
|
|
168
|
+
.asFunction(*runtime_)
|
|
169
|
+
.callAsConstructor(*runtime_, {static_cast<double>(sizeof(void *))});
|
|
170
|
+
uintptr_t *workletRuntimeData = reinterpret_cast<uintptr_t *>(
|
|
171
|
+
workletRuntimeValue.getObject(*runtime_).getArrayBuffer(*runtime_).data(
|
|
172
|
+
*runtime_));
|
|
158
173
|
workletRuntimeData[0] = reinterpret_cast<uintptr_t>(animatedRuntime.get());
|
|
159
174
|
|
|
160
175
|
runtime_->global().setProperty(
|
|
161
|
-
*runtime_,
|
|
162
|
-
"_WORKLET_RUNTIME",
|
|
163
|
-
workletRuntimeValue);
|
|
176
|
+
*runtime_, "_WORKLET_RUNTIME", workletRuntimeValue);
|
|
164
177
|
|
|
165
178
|
std::shared_ptr<ErrorHandler> errorHandler =
|
|
166
179
|
std::make_shared<AndroidErrorHandler>(scheduler_);
|
|
@@ -198,7 +211,10 @@ void NativeProxy::installJSIBindings() {
|
|
|
198
211
|
registerSensorFunction,
|
|
199
212
|
unregisterSensorFunction,
|
|
200
213
|
setGestureStateFunction,
|
|
201
|
-
configurePropsFunction
|
|
214
|
+
configurePropsFunction,
|
|
215
|
+
subscribeForKeyboardEventsFunction,
|
|
216
|
+
unsubscribeFromKeyboardEventsFunction,
|
|
217
|
+
};
|
|
202
218
|
|
|
203
219
|
auto module = std::make_shared<NativeReanimatedModule>(
|
|
204
220
|
jsCallInvoker_,
|
|
@@ -345,4 +361,22 @@ void NativeProxy::configureProps(
|
|
|
345
361
|
.get());
|
|
346
362
|
}
|
|
347
363
|
|
|
364
|
+
int NativeProxy::subscribeForKeyboardEvents(
|
|
365
|
+
std::function<void(int, int)> keyboardEventDataUpdater) {
|
|
366
|
+
auto method = javaPart_->getClass()
|
|
367
|
+
->getMethod<int(KeyboardEventDataUpdater::javaobject)>(
|
|
368
|
+
"subscribeForKeyboardEvents");
|
|
369
|
+
return method(
|
|
370
|
+
javaPart_.get(),
|
|
371
|
+
KeyboardEventDataUpdater::newObjectCxxArgs(
|
|
372
|
+
std::move(keyboardEventDataUpdater))
|
|
373
|
+
.get());
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
void NativeProxy::unsubscribeFromKeyboardEvents(int listenerId) {
|
|
377
|
+
auto method = javaPart_->getClass()->getMethod<void(int)>(
|
|
378
|
+
"unsubscribeFromKeyboardEvents");
|
|
379
|
+
method(javaPart_.get(), listenerId);
|
|
380
|
+
}
|
|
381
|
+
|
|
348
382
|
} // namespace reanimated
|
|
@@ -13,5 +13,6 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
|
|
|
13
13
|
reanimated::AndroidScheduler::registerNatives();
|
|
14
14
|
reanimated::LayoutAnimations::registerNatives();
|
|
15
15
|
reanimated::SensorSetter::registerNatives();
|
|
16
|
+
reanimated::KeyboardEventDataUpdater::registerNatives();
|
|
16
17
|
});
|
|
17
18
|
}
|
|
@@ -118,6 +118,32 @@ class SensorSetter : public HybridClass<SensorSetter> {
|
|
|
118
118
|
std::function<void(double[])> callback_;
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
+
class KeyboardEventDataUpdater : public HybridClass<KeyboardEventDataUpdater> {
|
|
122
|
+
public:
|
|
123
|
+
static auto constexpr kJavaDescriptor =
|
|
124
|
+
"Lcom/swmansion/reanimated/NativeProxy$KeyboardEventDataUpdater;";
|
|
125
|
+
|
|
126
|
+
void keyboardEventDataUpdater(int keyboardState, int height) {
|
|
127
|
+
callback_(keyboardState, height);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
static void registerNatives() {
|
|
131
|
+
javaClassStatic()->registerNatives({
|
|
132
|
+
makeNativeMethod(
|
|
133
|
+
"keyboardEventDataUpdater",
|
|
134
|
+
KeyboardEventDataUpdater::keyboardEventDataUpdater),
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private:
|
|
139
|
+
friend HybridBase;
|
|
140
|
+
|
|
141
|
+
explicit KeyboardEventDataUpdater(std::function<void(int, int)> callback)
|
|
142
|
+
: callback_(std::move(callback)) {}
|
|
143
|
+
|
|
144
|
+
std::function<void(int, int)> callback_;
|
|
145
|
+
};
|
|
146
|
+
|
|
121
147
|
class NativeProxy : public jni::HybridClass<NativeProxy> {
|
|
122
148
|
public:
|
|
123
149
|
static auto constexpr kJavaDescriptor =
|
|
@@ -160,6 +186,9 @@ class NativeProxy : public jni::HybridClass<NativeProxy> {
|
|
|
160
186
|
jsi::Runtime &rt,
|
|
161
187
|
const jsi::Value &uiProps,
|
|
162
188
|
const jsi::Value &nativeProps);
|
|
189
|
+
int subscribeForKeyboardEvents(
|
|
190
|
+
std::function<void(int, int)> keyboardEventDataUpdater);
|
|
191
|
+
void unsubscribeFromKeyboardEvents(int listenerId);
|
|
163
192
|
|
|
164
193
|
explicit NativeProxy(
|
|
165
194
|
jni::alias_ref<NativeProxy::jhybridobject> jThis,
|
|
@@ -16,6 +16,7 @@ import com.facebook.react.turbomodule.core.CallInvokerHolderImpl;
|
|
|
16
16
|
import com.facebook.react.uimanager.UIManagerModule;
|
|
17
17
|
import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|
18
18
|
import com.swmansion.common.GestureHandlerStateManager;
|
|
19
|
+
import com.swmansion.reanimated.keyboardObserver.ReanimatedKeyboardEventListener;
|
|
19
20
|
import com.swmansion.reanimated.layoutReanimation.AnimationsManager;
|
|
20
21
|
import com.swmansion.reanimated.layoutReanimation.LayoutAnimations;
|
|
21
22
|
import com.swmansion.reanimated.layoutReanimation.NativeMethodsHolder;
|
|
@@ -87,6 +88,18 @@ public class NativeProxy {
|
|
|
87
88
|
public native void sensorSetter(float[] value);
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
@DoNotStrip
|
|
92
|
+
public static class KeyboardEventDataUpdater {
|
|
93
|
+
@DoNotStrip private final HybridData mHybridData;
|
|
94
|
+
|
|
95
|
+
@DoNotStrip
|
|
96
|
+
private KeyboardEventDataUpdater(HybridData hybridData) {
|
|
97
|
+
mHybridData = hybridData;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public native void keyboardEventDataUpdater(int keyboardState, int height);
|
|
101
|
+
}
|
|
102
|
+
|
|
90
103
|
@DoNotStrip
|
|
91
104
|
@SuppressWarnings("unused")
|
|
92
105
|
private final HybridData mHybridData;
|
|
@@ -96,6 +109,7 @@ public class NativeProxy {
|
|
|
96
109
|
private Scheduler mScheduler = null;
|
|
97
110
|
private ReanimatedSensorContainer reanimatedSensorContainer;
|
|
98
111
|
private final GestureHandlerStateManager gestureHandlerStateManager;
|
|
112
|
+
private ReanimatedKeyboardEventListener reanimatedKeyboardEventListener;
|
|
99
113
|
private Long firstUptime = SystemClock.uptimeMillis();
|
|
100
114
|
private boolean slowAnimationsEnabled = false;
|
|
101
115
|
|
|
@@ -110,6 +124,7 @@ public class NativeProxy {
|
|
|
110
124
|
mContext = new WeakReference<>(context);
|
|
111
125
|
prepare(LayoutAnimations);
|
|
112
126
|
reanimatedSensorContainer = new ReanimatedSensorContainer(mContext);
|
|
127
|
+
reanimatedKeyboardEventListener = new ReanimatedKeyboardEventListener(mContext);
|
|
113
128
|
addDevMenuOption();
|
|
114
129
|
|
|
115
130
|
GestureHandlerStateManager tempHandlerStateManager;
|
|
@@ -237,6 +252,16 @@ public class NativeProxy {
|
|
|
237
252
|
reanimatedSensorContainer.unregisterSensor(sensorId);
|
|
238
253
|
}
|
|
239
254
|
|
|
255
|
+
@DoNotStrip
|
|
256
|
+
private int subscribeForKeyboardEvents(KeyboardEventDataUpdater keyboardEventDataUpdater) {
|
|
257
|
+
return reanimatedKeyboardEventListener.subscribeForKeyboardEvents(keyboardEventDataUpdater);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
@DoNotStrip
|
|
261
|
+
private void unsubscribeFromKeyboardEvents(int listenerId) {
|
|
262
|
+
reanimatedKeyboardEventListener.unsubscribeFromKeyboardEvents(listenerId);
|
|
263
|
+
}
|
|
264
|
+
|
|
240
265
|
public void onCatalystInstanceDestroy() {
|
|
241
266
|
mScheduler.deactivate();
|
|
242
267
|
mHybridData.resetNative();
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package com.swmansion.reanimated;
|
|
2
2
|
|
|
3
|
+
import static java.lang.Float.NaN;
|
|
4
|
+
|
|
3
5
|
import android.util.SparseArray;
|
|
4
6
|
import android.view.View;
|
|
5
7
|
import com.facebook.react.bridge.Arguments;
|
|
@@ -83,7 +85,7 @@ public class NodesManager implements EventDispatcherListener {
|
|
|
83
85
|
view = mUIManager.resolveView(viewTag);
|
|
84
86
|
} catch (IllegalViewOperationException e) {
|
|
85
87
|
e.printStackTrace();
|
|
86
|
-
return (new float[] {});
|
|
88
|
+
return (new float[] {NaN, NaN, NaN, NaN, NaN, NaN});
|
|
87
89
|
}
|
|
88
90
|
return NativeMethodsHelper.measure(view);
|
|
89
91
|
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
package com.swmansion.reanimated.keyboardObserver;
|
|
2
|
+
|
|
3
|
+
import android.os.Handler;
|
|
4
|
+
import android.os.Looper;
|
|
5
|
+
import android.view.View;
|
|
6
|
+
import android.widget.FrameLayout;
|
|
7
|
+
import androidx.annotation.NonNull;
|
|
8
|
+
import androidx.core.view.ViewCompat;
|
|
9
|
+
import androidx.core.view.WindowCompat;
|
|
10
|
+
import androidx.core.view.WindowInsetsAnimationCompat;
|
|
11
|
+
import androidx.core.view.WindowInsetsCompat;
|
|
12
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
13
|
+
import com.facebook.react.uimanager.PixelUtil;
|
|
14
|
+
import com.swmansion.reanimated.BuildConfig;
|
|
15
|
+
import com.swmansion.reanimated.NativeProxy.KeyboardEventDataUpdater;
|
|
16
|
+
import java.lang.ref.WeakReference;
|
|
17
|
+
import java.util.HashMap;
|
|
18
|
+
import java.util.List;
|
|
19
|
+
|
|
20
|
+
public class ReanimatedKeyboardEventListener {
|
|
21
|
+
enum KeyboardState {
|
|
22
|
+
UNKNOWN(0),
|
|
23
|
+
OPENING(1),
|
|
24
|
+
OPEN(2),
|
|
25
|
+
CLOSING(3),
|
|
26
|
+
CLOSED(4);
|
|
27
|
+
|
|
28
|
+
private final int value;
|
|
29
|
+
|
|
30
|
+
KeyboardState(int value) {
|
|
31
|
+
this.value = value;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public int asInt() {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private final WeakReference<ReactApplicationContext> reactContext;
|
|
40
|
+
private int nextListenerId = 0;
|
|
41
|
+
private KeyboardState state;
|
|
42
|
+
private final HashMap<Integer, KeyboardEventDataUpdater> listeners = new HashMap<>();
|
|
43
|
+
|
|
44
|
+
public ReanimatedKeyboardEventListener(WeakReference<ReactApplicationContext> reactContext) {
|
|
45
|
+
this.reactContext = reactContext;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private View getRootView() {
|
|
49
|
+
return reactContext.get().getCurrentActivity().getWindow().getDecorView();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private void setupWindowInsets() {
|
|
53
|
+
View rootView = getRootView();
|
|
54
|
+
WindowCompat.setDecorFitsSystemWindows(
|
|
55
|
+
reactContext.get().getCurrentActivity().getWindow(), false);
|
|
56
|
+
ViewCompat.setOnApplyWindowInsetsListener(
|
|
57
|
+
rootView,
|
|
58
|
+
(v, insets) -> {
|
|
59
|
+
int paddingBottom = 0;
|
|
60
|
+
if (!BuildConfig.IS_NEW_ARCHITECTURE_ENABLED && BuildConfig.REACT_NATIVE_VERSION < 70) {
|
|
61
|
+
paddingBottom = insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom;
|
|
62
|
+
}
|
|
63
|
+
int paddingTop = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top;
|
|
64
|
+
View content =
|
|
65
|
+
rootView.getRootView().findViewById(com.swmansion.reanimated.R.id.action_bar_root);
|
|
66
|
+
|
|
67
|
+
FrameLayout.LayoutParams params =
|
|
68
|
+
new FrameLayout.LayoutParams(
|
|
69
|
+
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
|
|
70
|
+
params.setMargins(0, paddingTop, 0, paddingBottom);
|
|
71
|
+
content.setLayoutParams(params);
|
|
72
|
+
return insets;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private void updateKeyboard(int keyboardHeight) {
|
|
77
|
+
for (KeyboardEventDataUpdater listener : listeners.values()) {
|
|
78
|
+
listener.keyboardEventDataUpdater(state.asInt(), keyboardHeight);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private class WindowInsetsCallback extends WindowInsetsAnimationCompat.Callback {
|
|
83
|
+
private int keyboardHeight = 0;
|
|
84
|
+
|
|
85
|
+
public WindowInsetsCallback() {
|
|
86
|
+
super(WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_CONTINUE_ON_SUBTREE);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@NonNull
|
|
90
|
+
@Override
|
|
91
|
+
public WindowInsetsAnimationCompat.BoundsCompat onStart(
|
|
92
|
+
@NonNull WindowInsetsAnimationCompat animation,
|
|
93
|
+
@NonNull WindowInsetsAnimationCompat.BoundsCompat bounds) {
|
|
94
|
+
state = keyboardHeight == 0 ? KeyboardState.OPENING : KeyboardState.CLOSING;
|
|
95
|
+
updateKeyboard(keyboardHeight);
|
|
96
|
+
return super.onStart(animation, bounds);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@NonNull
|
|
100
|
+
@Override
|
|
101
|
+
public WindowInsetsCompat onProgress(
|
|
102
|
+
@NonNull WindowInsetsCompat insets,
|
|
103
|
+
@NonNull List<WindowInsetsAnimationCompat> runningAnimations) {
|
|
104
|
+
|
|
105
|
+
keyboardHeight =
|
|
106
|
+
(int)
|
|
107
|
+
PixelUtil.toDIPFromPixel(
|
|
108
|
+
Math.max(
|
|
109
|
+
0,
|
|
110
|
+
insets.getInsets(WindowInsetsCompat.Type.ime()).bottom
|
|
111
|
+
- insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom));
|
|
112
|
+
updateKeyboard(keyboardHeight);
|
|
113
|
+
return insets;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@Override
|
|
117
|
+
public void onEnd(@NonNull WindowInsetsAnimationCompat animation) {
|
|
118
|
+
state = keyboardHeight == 0 ? KeyboardState.CLOSED : KeyboardState.OPEN;
|
|
119
|
+
updateKeyboard(keyboardHeight);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private void setUpCallbacks() {
|
|
124
|
+
View rootView = getRootView();
|
|
125
|
+
new Handler(Looper.getMainLooper()).post(this::setupWindowInsets);
|
|
126
|
+
ViewCompat.setWindowInsetsAnimationCallback(rootView, new WindowInsetsCallback());
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
public int subscribeForKeyboardEvents(KeyboardEventDataUpdater updater) {
|
|
130
|
+
int listenerId = nextListenerId++;
|
|
131
|
+
if (listeners.isEmpty()) {
|
|
132
|
+
setUpCallbacks();
|
|
133
|
+
}
|
|
134
|
+
listeners.put(listenerId, updater);
|
|
135
|
+
return listenerId;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private void bringBackWindowInsets() {
|
|
139
|
+
WindowCompat.setDecorFitsSystemWindows(
|
|
140
|
+
reactContext.get().getCurrentActivity().getWindow(), true);
|
|
141
|
+
ViewCompat.setOnApplyWindowInsetsListener(getRootView(), null);
|
|
142
|
+
ViewCompat.setWindowInsetsAnimationCallback(getRootView(), null);
|
|
143
|
+
View content =
|
|
144
|
+
getRootView().getRootView().findViewById(com.swmansion.reanimated.R.id.action_bar_root);
|
|
145
|
+
|
|
146
|
+
FrameLayout.LayoutParams params =
|
|
147
|
+
new FrameLayout.LayoutParams(
|
|
148
|
+
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
|
|
149
|
+
params.setMargins(0, 0, 0, 0);
|
|
150
|
+
content.setLayoutParams(params);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
private void removeCallbacks() {
|
|
154
|
+
View rootView = getRootView();
|
|
155
|
+
new Handler(Looper.getMainLooper()).post(this::bringBackWindowInsets);
|
|
156
|
+
ViewCompat.setWindowInsetsAnimationCallback(rootView, null);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
public void unsubscribeFromKeyboardEvents(int listenerId) {
|
|
160
|
+
listeners.remove(listenerId);
|
|
161
|
+
if (listeners.isEmpty()) {
|
|
162
|
+
removeCallbacks();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java
CHANGED
|
@@ -229,24 +229,27 @@ public class AnimationsManager implements ViewHierarchyObserver {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
private void removeLeftovers() {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
232
|
+
//mToRemove may be null if onCatalystInstanceDestroy was called first
|
|
233
|
+
if(mToRemove != null){
|
|
234
|
+
HashSet<Integer> roots = new HashSet<>();
|
|
235
|
+
// go through ready to remove from bottom to top
|
|
236
|
+
for (int tag : mToRemove) {
|
|
237
|
+
View view = mViewForTag.get(tag);
|
|
238
|
+
if (view == null) {
|
|
239
|
+
try {
|
|
240
|
+
view = mUIManager.resolveView(tag);
|
|
241
|
+
mViewForTag.put(tag, view);
|
|
242
|
+
} catch (IllegalViewOperationException ignored) {
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
242
245
|
}
|
|
246
|
+
findRoot(view, roots);
|
|
243
247
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
dfs(view, view, mToRemove);
|
|
248
|
+
for (int tag : roots) {
|
|
249
|
+
View view = mViewForTag.get(tag);
|
|
250
|
+
if (view != null) {
|
|
251
|
+
dfs(view, view, mToRemove);
|
|
252
|
+
}
|
|
250
253
|
}
|
|
251
254
|
}
|
|
252
255
|
}
|
|
@@ -23,7 +23,11 @@ public class ReanimatedSensor {
|
|
|
23
23
|
sensorManager =
|
|
24
24
|
(SensorManager) reactContext.get().getSystemService(reactContext.get().SENSOR_SERVICE);
|
|
25
25
|
this.sensorType = sensorType;
|
|
26
|
-
|
|
26
|
+
if (interval == -1) {
|
|
27
|
+
this.interval = SensorManager.SENSOR_DELAY_UI;
|
|
28
|
+
} else {
|
|
29
|
+
this.interval = interval;
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
boolean initialize() {
|
|
@@ -3,7 +3,7 @@ package com.swmansion.reanimated.sensor;
|
|
|
3
3
|
import android.hardware.Sensor;
|
|
4
4
|
|
|
5
5
|
public enum ReanimatedSensorType {
|
|
6
|
-
ACCELEROMETER(Sensor.
|
|
6
|
+
ACCELEROMETER(Sensor.TYPE_LINEAR_ACCELERATION),
|
|
7
7
|
GYROSCOPE(Sensor.TYPE_GYROSCOPE),
|
|
8
8
|
GRAVITY(Sensor.TYPE_GRAVITY),
|
|
9
9
|
MAGNETIC_FIELD(Sensor.TYPE_MAGNETIC_FIELD),
|
package/ios/REANodesManager.m
CHANGED
|
@@ -509,9 +509,9 @@
|
|
|
509
509
|
_nativeProps = nativePropsSet;
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
-
- (BOOL)
|
|
512
|
+
- (BOOL)isNativeViewMounted:(NSNumber *)viewTag
|
|
513
513
|
{
|
|
514
|
-
return _viewRegistry[viewTag].superview
|
|
514
|
+
return _viewRegistry[viewTag].superview != nil;
|
|
515
515
|
}
|
|
516
516
|
|
|
517
517
|
- (void)setValueForNodeID:(nonnull NSNumber *)nodeID value:(nonnull NSNumber *)newValue
|
|
@@ -529,7 +529,17 @@
|
|
|
529
529
|
withName:(nonnull NSString *)viewName
|
|
530
530
|
{
|
|
531
531
|
ComponentUpdate *lastSnapshot = _componentUpdateBuffer[viewTag];
|
|
532
|
-
|
|
532
|
+
BOOL isNativeViewMounted = [self isNativeViewMounted:viewTag];
|
|
533
|
+
|
|
534
|
+
if (lastSnapshot != nil) {
|
|
535
|
+
NSMutableDictionary *lastProps = lastSnapshot.props;
|
|
536
|
+
for (NSString *key in props) {
|
|
537
|
+
[lastProps setValue:props[key] forKey:key];
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// If the component isn't mounted, we will bail early with a scheduled update
|
|
542
|
+
if (!isNativeViewMounted) {
|
|
533
543
|
if (lastSnapshot == nil) {
|
|
534
544
|
ComponentUpdate *propsSnapshot = [ComponentUpdate new];
|
|
535
545
|
propsSnapshot.props = [props mutableCopy];
|
|
@@ -537,15 +547,28 @@
|
|
|
537
547
|
propsSnapshot.viewName = viewName;
|
|
538
548
|
_componentUpdateBuffer[viewTag] = propsSnapshot;
|
|
539
549
|
atomic_store(&_shouldFlushUpdateBuffer, true);
|
|
540
|
-
} else {
|
|
541
|
-
NSMutableDictionary *lastProps = lastSnapshot.props;
|
|
542
|
-
for (NSString *key in props) {
|
|
543
|
-
[lastProps setValue:props[key] forKey:key];
|
|
544
|
-
}
|
|
545
550
|
}
|
|
551
|
+
|
|
546
552
|
return;
|
|
547
553
|
}
|
|
548
554
|
|
|
555
|
+
// The component may have been mounted with a pending snapshot (due to a race condition),
|
|
556
|
+
// so we should attempt run the update. Otherwise, the next call to -maybeFlushUpdateBuffer
|
|
557
|
+
// will only arrive when a new component is mounted (which might be never!)
|
|
558
|
+
//
|
|
559
|
+
// If there are 0 remaining items in the buffer, we can skip the run in -maybeFlushUpdateBuffer.
|
|
560
|
+
if (lastSnapshot != nil && isNativeViewMounted) {
|
|
561
|
+
props = lastSnapshot.props;
|
|
562
|
+
viewTag = lastSnapshot.viewTag;
|
|
563
|
+
viewName = lastSnapshot.viewName;
|
|
564
|
+
|
|
565
|
+
[_componentUpdateBuffer removeObjectForKey:viewTag];
|
|
566
|
+
|
|
567
|
+
if (_componentUpdateBuffer.count == 0) {
|
|
568
|
+
atomic_store(&_shouldFlushUpdateBuffer, false);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
549
572
|
// TODO: refactor PropsNode to also use this function
|
|
550
573
|
NSMutableDictionary *uiProps = [NSMutableDictionary new];
|
|
551
574
|
NSMutableDictionary *nativeProps = [NSMutableDictionary new];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#ifndef REAKeyboardEventManager_h
|
|
2
|
+
#define REAKeyboardEventManager_h
|
|
3
|
+
|
|
4
|
+
#import <RNReanimated/REAEventDispatcher.h>
|
|
5
|
+
#import <React/RCTEventDispatcher.h>
|
|
6
|
+
|
|
7
|
+
typedef void (^KeyboardEventListenerBlock)(int keyboardState, int height);
|
|
8
|
+
|
|
9
|
+
@interface REAKeyboardEventObserver : NSObject
|
|
10
|
+
|
|
11
|
+
- (instancetype)init;
|
|
12
|
+
- (int)subscribeForKeyboardEvents:(KeyboardEventListenerBlock)listener;
|
|
13
|
+
- (void)unsubscribeFromKeyboardEvents:(int)listenerId;
|
|
14
|
+
|
|
15
|
+
@end
|
|
16
|
+
|
|
17
|
+
#endif /* REAKeyboardEventManager_h */
|