From 968e2091250945e8d0ee686f077c40cba8045d65 Mon Sep 17 00:00:00 2001 From: Tomek Zawadzki Date: Wed, 11 May 2022 14:44:21 +0200 Subject: [PATCH] [Fabric] Reanimated for Fabric (#3206) ## Description This PR adds Fabric support to React Native Reanimated. Co-authored by @piaskowyk, @graszka22, @j-piasecki, @Szymon20000 and @kmagiera. --- .github/workflows/android-build.yml | 11 +- .github/workflows/docs-check.yml | 2 - .github/workflows/ios-build.yml | 13 +- ...cks.yml => static-example-apps-checks.yml} | 18 +- .github/workflows/static-root-checks.yml | 2 - .github/workflows/tv-os-build.yml | 2 - .github/workflows/validate-java.yml | 2 - Common/cpp/Fabric/FabricUtils.cpp | 128 + .../cpp/Fabric/ReanimatedUIManagerBinding.cpp | 197 + .../NativeModules/NativeReanimatedModule.cpp | 317 +- .../cpp/Registries/EventHandlerRegistry.cpp | 15 +- .../Registries/NewestShadowNodesRegistry.cpp | 68 + Common/cpp/SharedItems/ShareableValue.cpp | 18 + Common/cpp/Tools/Mapper.cpp | 27 +- Common/cpp/Tools/RuntimeDecorator.cpp | 124 +- Common/cpp/Tools/Scheduler.cpp | 4 + Common/cpp/headers/Fabric/FabricUtils.h | 78 + .../Fabric/ReanimatedUIManagerBinding.h | 46 + .../NativeModules/NativeReanimatedModule.h | 74 +- .../headers/Registries/EventHandlerRegistry.h | 8 + .../Registries/NewestShadowNodesRegistry.h | 41 + Common/cpp/headers/SharedItems/SharedParent.h | 3 + Common/cpp/headers/SharedItems/ValueWrapper.h | 25 + Common/cpp/headers/SpecTools/ErrorHandler.h | 5 + Common/cpp/headers/Tools/Mapper.h | 2 +- .../headers/Tools/PlatformDepMethodsHolder.h | 51 +- Common/cpp/headers/Tools/RuntimeDecorator.h | 11 +- Example/ios/Podfile.lock | 6 +- Example/package.json | 7 +- Example/src/CustomHandler/AnimatedText.tsx | 2 +- Example/tsconfig.json | 3 +- Example/yarn.lock | 274 +- FabricExample/.prettierrc.js | 7 - FabricExample/.prettierrc.json | 9 + FabricExample/App.js | 112 - FabricExample/App.tsx | 248 ++ FabricExample/Gemfile.lock | 100 + FabricExample/README.md | 19 + FabricExample/android/app/build.gradle | 2 +- FabricExample/android/build.gradle | 1 + FabricExample/android/gradle.properties | 2 +- FabricExample/babel.config.js | 1 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + FabricExample/ios/Podfile | 2 + FabricExample/ios/Podfile.lock | 473 ++- FabricExample/metro.config.js | 33 +- FabricExample/package.json | 38 +- .../react-native-gesture-handler+2.4.2.patch | 37 + ...react-native-safe-area-context+4.2.5.patch | 34 + .../patches/react-native-screens+3.13.1.patch | 55 + .../react-native-reanimated-tests.tsx | 4 +- FabricExample/src/AnimatedSensorExample.tsx | 38 + .../src/AnimatedTextInputExample.tsx | 63 + .../src/AnimatedTextWidthExample.tsx | 48 + FabricExample/src/BokehExample.tsx | 103 + FabricExample/src/BouncingBoxExample.tsx | 81 + FabricExample/src/BubblesExample.tsx | 81 + FabricExample/src/ChessboardExample.tsx | 84 + FabricExample/src/ColorExample.tsx | 96 + FabricExample/src/EmptyExample.tsx | 19 + FabricExample/src/GestureHandlerExample.tsx | 82 + FabricExample/src/MeasureExample.tsx | 66 + ...NewestShadowNodesRegistryRemoveExample.tsx | 65 + FabricExample/src/RefExample.tsx | 77 + FabricExample/src/ScreenStackExample.tsx | 84 + ...tackHeaderConfigBackgroundColorExample.tsx | 101 + FabricExample/src/ScrollToExample.tsx | 65 + FabricExample/src/ScrollViewExample.tsx | 35 + FabricExample/src/TransformExample.tsx | 73 + FabricExample/src/WidthExample.tsx | 72 + FabricExample/src/WorkletExample.tsx | 52 + FabricExample/src/useJSThreadKiller.ts | 13 + FabricExample/tsconfig.json | 7 + FabricExample/yarn.lock | 1707 +++++--- README-Fabric.md | 9 + README.md | 4 + RNReanimated.podspec | 33 +- android/CMakeLists.txt | 166 +- android/build.gradle | 295 +- .../com/swmansion/reanimated/NativeProxy.java | 310 ++ .../reanimated/ReaCompatibility.java | 25 + android/src/main/cpp/NativeProxy.cpp | 218 +- android/src/main/cpp/headers/NativeProxy.h | 50 +- .../swmansion/reanimated/NodesManager.java | 13 +- .../layoutReanimation/LayoutAnimations.java | 3 +- .../com/swmansion/reanimated/NativeProxy.java | 17 +- .../reanimated/ReaCompatibility.java | 17 + docs/package.json | 2 +- ios/Fabric/REAInitializerRCTFabricSurface.h | 12 + ios/Fabric/REAInitializerRCTFabricSurface.mm | 73 + ios/REAEventDispatcher.m | 1 - ios/REAModule.h | 9 + ios/REAModule.m | 85 - ios/REAModule.mm | 284 ++ ios/REANodesManager.h | 36 +- ios/{REANodesManager.m => REANodesManager.mm} | 102 +- ios/native/NativeProxy.mm | 161 +- ios/native/REAInitializer.mm | 22 +- ios/native/UIResponder+Reanimated.h | 4 +- ios/native/UIResponder+Reanimated.mm | 4 +- jest.config.js | 2 +- package.json | 16 +- plugin.js | 5 +- prettier.config.js | 2 +- src/createAnimatedComponent.tsx | 28 +- src/reanimated2/NativeMethods.ts | 46 +- src/reanimated2/UpdateProps.ts | 57 +- src/reanimated2/commonTypes.ts | 5 +- src/reanimated2/component/FlatList.tsx | 13 +- src/reanimated2/core.ts | 8 +- src/reanimated2/fabricUtils.ts | 27 + src/reanimated2/globals.d.ts | 18 +- src/reanimated2/hook/commonTypes.ts | 6 +- src/reanimated2/hook/index.ts | 2 +- .../hook/useAnimatedGestureHandler.ts | 4 +- src/reanimated2/hook/useAnimatedRef.ts | 11 +- .../hook/useAnimatedScrollHandler.ts | 4 +- src/reanimated2/hook/utils.ts | 7 +- src/reanimated2/js-reanimated/index.ts | 5 + tsconfig.json | 7 +- yarn.lock | 3594 +++++++---------- 121 files changed, 8088 insertions(+), 3615 deletions(-) rename .github/workflows/{static-example-app-checks.yml => static-example-apps-checks.yml} (60%) create mode 100644 Common/cpp/Fabric/FabricUtils.cpp create mode 100644 Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp create mode 100644 Common/cpp/Registries/NewestShadowNodesRegistry.cpp create mode 100644 Common/cpp/headers/Fabric/FabricUtils.h create mode 100644 Common/cpp/headers/Fabric/ReanimatedUIManagerBinding.h create mode 100644 Common/cpp/headers/Registries/NewestShadowNodesRegistry.h delete mode 100644 FabricExample/.prettierrc.js create mode 100644 FabricExample/.prettierrc.json delete mode 100644 FabricExample/App.js create mode 100644 FabricExample/App.tsx create mode 100644 FabricExample/Gemfile.lock create mode 100644 FabricExample/README.md create mode 100644 FabricExample/ios/FabricExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 FabricExample/patches/react-native-gesture-handler+2.4.2.patch create mode 100644 FabricExample/patches/react-native-safe-area-context+4.2.5.patch create mode 100644 FabricExample/patches/react-native-screens+3.13.1.patch rename react-native-reanimated-tests.tsx => FabricExample/react-native-reanimated-tests.tsx (99%) create mode 100644 FabricExample/src/AnimatedSensorExample.tsx create mode 100644 FabricExample/src/AnimatedTextInputExample.tsx create mode 100644 FabricExample/src/AnimatedTextWidthExample.tsx create mode 100644 FabricExample/src/BokehExample.tsx create mode 100644 FabricExample/src/BouncingBoxExample.tsx create mode 100644 FabricExample/src/BubblesExample.tsx create mode 100644 FabricExample/src/ChessboardExample.tsx create mode 100644 FabricExample/src/ColorExample.tsx create mode 100644 FabricExample/src/EmptyExample.tsx create mode 100644 FabricExample/src/GestureHandlerExample.tsx create mode 100644 FabricExample/src/MeasureExample.tsx create mode 100644 FabricExample/src/NewestShadowNodesRegistryRemoveExample.tsx create mode 100644 FabricExample/src/RefExample.tsx create mode 100644 FabricExample/src/ScreenStackExample.tsx create mode 100644 FabricExample/src/ScreenStackHeaderConfigBackgroundColorExample.tsx create mode 100644 FabricExample/src/ScrollToExample.tsx create mode 100644 FabricExample/src/ScrollViewExample.tsx create mode 100644 FabricExample/src/TransformExample.tsx create mode 100644 FabricExample/src/WidthExample.tsx create mode 100644 FabricExample/src/WorkletExample.tsx create mode 100644 FabricExample/src/useJSThreadKiller.ts create mode 100644 FabricExample/tsconfig.json create mode 100644 README-Fabric.md create mode 100644 android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java create mode 100644 android/src/fabric/java/com/swmansion/reanimated/ReaCompatibility.java rename android/src/{main => paper}/java/com/swmansion/reanimated/NativeProxy.java (95%) create mode 100644 android/src/paper/java/com/swmansion/reanimated/ReaCompatibility.java create mode 100644 ios/Fabric/REAInitializerRCTFabricSurface.h create mode 100644 ios/Fabric/REAInitializerRCTFabricSurface.mm delete mode 100644 ios/REAModule.m create mode 100644 ios/REAModule.mm rename ios/{REANodesManager.m => REANodesManager.mm} (81%) create mode 100644 src/reanimated2/fabricUtils.ts diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index e34e14c4125..3b78fa03973 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -1,8 +1,6 @@ name: Test Android build on: pull_request: - branches: - - main paths: - 'android/**' - 'Common/**' @@ -12,8 +10,9 @@ on: jobs: build: runs-on: ubuntu-latest - env: - WORKING_DIRECTORY: Example + strategy: + matrix: + working-directory: [Example, FabricExample] concurrency: group: android-${{ github.ref }} cancel-in-progress: true @@ -41,8 +40,8 @@ jobs: - name: Install root node dependencies run: yarn - name: Install example app node dependencies - working-directory: ${{ env.WORKING_DIRECTORY }} + working-directory: ${{ matrix.working-directory }} run: yarn - name: Build app - working-directory: ${{ env.WORKING_DIRECTORY }}/android + working-directory: ${{ matrix.working-directory }}/android run: ./gradlew assembleDebug --console=plain diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index ed07fefba99..8a593acf278 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -2,8 +2,6 @@ name: Test docs build on: pull_request: - branches: - - main paths: - 'docs/**' diff --git a/.github/workflows/ios-build.yml b/.github/workflows/ios-build.yml index 3edcd0c9df6..9cfbc79884f 100644 --- a/.github/workflows/ios-build.yml +++ b/.github/workflows/ios-build.yml @@ -1,8 +1,6 @@ name: Test iOS build on: pull_request: - branches: - - main paths: - 'ios/**' - 'Common/**' @@ -13,8 +11,9 @@ jobs: build: # runs-on: macos-latest // issue: https://github.com/actions/virtual-environments/issues/4060 runs-on: macos-11 - env: - WORKING_DIRECTORY: Example + strategy: + matrix: + working-directory: [Example, FabricExample] concurrency: group: ios-${{ github.ref }} cancel-in-progress: true @@ -29,11 +28,11 @@ jobs: - name: Install Reanimated node dependencies run: yarn - name: Install node dependencies - working-directory: ${{ env.WORKING_DIRECTORY }} + working-directory: ${{ matrix.working-directory }} run: yarn - name: Install pods - working-directory: ${{ env.WORKING_DIRECTORY }}/ios + working-directory: ${{ matrix.working-directory }}/ios run: pod install - name: Build app - working-directory: ${{ env.WORKING_DIRECTORY }} + working-directory: ${{ matrix.working-directory }} run: npx react-native run-ios diff --git a/.github/workflows/static-example-app-checks.yml b/.github/workflows/static-example-apps-checks.yml similarity index 60% rename from .github/workflows/static-example-app-checks.yml rename to .github/workflows/static-example-apps-checks.yml index d65e7489e07..6e20e433522 100644 --- a/.github/workflows/static-example-app-checks.yml +++ b/.github/workflows/static-example-apps-checks.yml @@ -1,18 +1,18 @@ -name: Test Example App TypeScript and Lint +name: Test TypeScript and Lint on: pull_request: - branches: - - main paths: - 'Example/**' + - 'FabricExample/**' push: branches: - main jobs: check: runs-on: ubuntu-latest - env: - WORKING_DIRECTORY: Example + strategy: + matrix: + working-directory: [Example, FabricExample] concurrency: group: static-example-${{ github.ref }} cancel-in-progress: true @@ -26,12 +26,12 @@ jobs: cache: 'yarn' - name: Install root node dependencies run: yarn - - name: Install example app node dependencies - working-directory: ${{ env.WORKING_DIRECTORY }} + - name: Install ${{ matrix.working-directory }} app node dependencies + working-directory: ${{ matrix.working-directory }} run: yarn - name: Check types - working-directory: ${{ env.WORKING_DIRECTORY }} + working-directory: ${{ matrix.working-directory }} run: yarn tsc --noEmit - name: Lint - working-directory: ${{ env.WORKING_DIRECTORY }} + working-directory: ${{ matrix.working-directory }} run: yarn lint:js diff --git a/.github/workflows/static-root-checks.yml b/.github/workflows/static-root-checks.yml index d9f1264d499..29559445b7f 100644 --- a/.github/workflows/static-root-checks.yml +++ b/.github/workflows/static-root-checks.yml @@ -1,8 +1,6 @@ name: Test TypeScript and Lint on: pull_request: - branches: - - main paths: - 'src/**' - '*' diff --git a/.github/workflows/tv-os-build.yml b/.github/workflows/tv-os-build.yml index 8b2a616ca0f..8a15c52c315 100644 --- a/.github/workflows/tv-os-build.yml +++ b/.github/workflows/tv-os-build.yml @@ -1,8 +1,6 @@ name: Test tvOS build on: pull_request: - branches: - - main paths: - 'ios/**' - 'Common/**' diff --git a/.github/workflows/validate-java.yml b/.github/workflows/validate-java.yml index 3d1f021cf5b..2bbf57ed2d0 100644 --- a/.github/workflows/validate-java.yml +++ b/.github/workflows/validate-java.yml @@ -1,8 +1,6 @@ name: Java Lint on: pull_request: - branches: - - main paths: - 'android/src/main/java/**' push: diff --git a/Common/cpp/Fabric/FabricUtils.cpp b/Common/cpp/Fabric/FabricUtils.cpp new file mode 100644 index 00000000000..341a3492874 --- /dev/null +++ b/Common/cpp/Fabric/FabricUtils.cpp @@ -0,0 +1,128 @@ +#ifdef RCT_NEW_ARCH_ENABLED + +#include "FabricUtils.h" + +#include + +using namespace facebook::react; + +namespace reanimated { + +#ifdef ANDROID +RuntimeExecutor getRuntimeExecutorFromBinding(Binding *binding) { + BindingPublic *bindingPublic = reinterpret_cast(binding); + SchedulerPublic *schedulerPublic = + reinterpret_cast((bindingPublic->scheduler_).get()); + return schedulerPublic->runtimeExecutor_; +} +#endif + +inline static const UIManagerPublic *getUIManagerPublic( + const UIManager *uiManager) { + return reinterpret_cast(uiManager); +} + +std::shared_ptr getContextContainerFromUIManager( + const UIManager *uiManager) { + return getUIManagerPublic(uiManager)->contextContainer_; +} + +inline static UIManagerDelegate *getDelegateFromUIManager( + const UIManager *uiManager) { + return getUIManagerPublic(uiManager)->delegate_; +} + +void UIManager_dispatchCommand( + const std::shared_ptr &uiManager, + const ShadowNode::Shared &shadowNode, + std::string const &commandName, + folly::dynamic const &args) { + auto delegate_ = getDelegateFromUIManager(&*uiManager); + + // copied from UIManager.cpp + if (delegate_) { + delegate_->uiManagerDidDispatchCommand(shadowNode, commandName, args); + } +} + +LayoutMetrics UIManager_getRelativeLayoutMetrics( + const std::shared_ptr &uiManager, + ShadowNode const &shadowNode, + ShadowNode const *ancestorShadowNode, + LayoutableShadowNode::LayoutInspectingPolicy policy) { + // based on implementation from UIManager.cpp + const auto &shadowTreeRegistry = uiManager->getShadowTreeRegistry(); + + // We might store here an owning pointer to `ancestorShadowNode` to ensure + // that the node is not deallocated during method execution lifetime. + auto owningAncestorShadowNode = ShadowNode::Shared{}; + + if (!ancestorShadowNode) { + shadowTreeRegistry.visit( + shadowNode.getSurfaceId(), [&](ShadowTree const &shadowTree) { + owningAncestorShadowNode = + shadowTree.getCurrentRevision().rootShadowNode; + ancestorShadowNode = owningAncestorShadowNode.get(); + }); + } else { + // It is possible for JavaScript (or other callers) to have a reference + // to a previous version of ShadowNodes, but we enforce that + // metrics are only calculated on most recently committed versions. + owningAncestorShadowNode = + uiManager->getNewestCloneOfShadowNode(*ancestorShadowNode); + ancestorShadowNode = owningAncestorShadowNode.get(); + } + + auto layoutableAncestorShadowNode = + traitCast(ancestorShadowNode); + + if (!layoutableAncestorShadowNode) { + return EmptyLayoutMetrics; + } + + return LayoutableShadowNode::computeRelativeLayoutMetrics( + shadowNode.getFamily(), *layoutableAncestorShadowNode, policy); +} + +SharedShadowNode UIManager_cloneNode( + const UIManager *uiManager, + const ShadowNode::Shared &shadowNode, + const SharedShadowNodeSharedList &children, + const RawProps *rawProps) { + auto delegate_ = getDelegateFromUIManager(uiManager); + auto contextContainer_ = getContextContainerFromUIManager(uiManager); + + // copied from UIManager.cpp + PropsParserContext propsParserContext{ + shadowNode->getFamily().getSurfaceId(), *contextContainer_.get()}; + + auto &componentDescriptor = shadowNode->getComponentDescriptor(); + auto clonedShadowNode = componentDescriptor.cloneShadowNode( + *shadowNode, + { + /* .props = */ + rawProps ? componentDescriptor.cloneProps( + propsParserContext, shadowNode->getProps(), *rawProps) + : ShadowNodeFragment::propsPlaceholder(), + /* .children = */ children, + }); + + if (delegate_) { + delegate_->uiManagerDidCloneShadowNode( + *shadowNode.get(), *clonedShadowNode); + } + + return clonedShadowNode; +} + +void UIManager_appendChild( + const ShadowNode::Shared &parentShadowNode, + const ShadowNode::Shared &childShadowNode) { + // copied from UIManager.cpp + auto &componentDescriptor = parentShadowNode->getComponentDescriptor(); + componentDescriptor.appendChild(parentShadowNode, childShadowNode); +} + +} // namespace reanimated + +#endif // RCT_NEW_ARCH_ENABLED diff --git a/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp b/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp new file mode 100644 index 00000000000..f4e1261ca22 --- /dev/null +++ b/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp @@ -0,0 +1,197 @@ +#ifdef RCT_NEW_ARCH_ENABLED + +#include "ReanimatedUIManagerBinding.h" +#include "FabricUtils.h" +#include "NewestShadowNodesRegistry.h" + +using namespace facebook; +using namespace react; + +namespace reanimated { + +void ReanimatedUIManagerBinding::createAndInstallIfNeeded( + jsi::Runtime &runtime, + RuntimeExecutor const &runtimeExecutor, + std::shared_ptr const &uiManager, + std::shared_ptr const + &newestShadowNodesRegistry) { + // adapted from UIManagerBinding.cpp + auto uiManagerModuleName = "nativeFabricUIManager"; + auto uiManagerBinding = std::make_shared( + uiManager, runtimeExecutor, newestShadowNodesRegistry); + auto object = jsi::Object::createFromHostObject(runtime, uiManagerBinding); + runtime.global().setProperty(runtime, uiManagerModuleName, std::move(object)); +} + +ReanimatedUIManagerBinding::ReanimatedUIManagerBinding( + std::shared_ptr uiManager, + RuntimeExecutor runtimeExecutor, + std::shared_ptr newestShadowNodesRegistry) + : UIManagerBinding(uiManager, runtimeExecutor), + uiManager_(std::move(uiManager)), + newestShadowNodesRegistry_(newestShadowNodesRegistry) {} + +ReanimatedUIManagerBinding::~ReanimatedUIManagerBinding() {} + +void ReanimatedUIManagerBinding::invalidate() const { + uiManager_->setDelegate(nullptr); +} + +static inline ShadowNode::Shared cloneNode( + UIManager *uiManager, + NewestShadowNodesRegistry *newestShadowNodesRegistry, + const ShadowNode::Shared &shadowNode, + const SharedShadowNodeSharedList &children = nullptr, + const RawProps *rawProps = nullptr) { + { + auto lock = newestShadowNodesRegistry->createLock(); + auto newest = newestShadowNodesRegistry->get(shadowNode->getTag()); + if (newest != nullptr) { + // ShadowNode managed by Reanimated, use newest ShadowNode from registry + auto clone = UIManager_cloneNode(uiManager, newest, children, rawProps); + newestShadowNodesRegistry->update(clone); + return clone; + } + } // release lock since we don't need registry anymore + + // ShadowNode not managed by Reanimated (yet?) + return UIManager_cloneNode(uiManager, shadowNode, children, rawProps); +} + +jsi::Value ReanimatedUIManagerBinding::get( + jsi::Runtime &runtime, + jsi::PropNameID const &name) { + // Currently, we need to overwrite all variants of `cloneNode` as well as + // `appendChild` to prevent React from overwriting layout props animated using + // Reanimated. However, this may degrade performance due to using locks. + // We already have an idea how this can be done better without locks + // (i.e. by overwriting `completeRoot` and using UIManagerCommitHooks). + + // based on implementation from UIManagerBinding.cpp + auto methodName = name.utf8(runtime); + UIManager *uiManager = uiManager_.get(); + NewestShadowNodesRegistry *newestShadowNodesRegistry = + newestShadowNodesRegistry_.get(); + + // Semantic: Clones the node with *same* props and *same* children. + if (methodName == "cloneNode") { + return jsi::Function::createFromHostFunction( + runtime, + name, + 1, + [uiManager, newestShadowNodesRegistry]( + jsi::Runtime &runtime, + jsi::Value const &thisValue, + jsi::Value const *arguments, + size_t count) noexcept -> jsi::Value { + return valueFromShadowNode( + runtime, + cloneNode( + uiManager, + newestShadowNodesRegistry, + shadowNodeFromValue(runtime, arguments[0]))); + }); + } + + // Semantic: Clones the node with *same* props and *empty* children. + if (methodName == "cloneNodeWithNewChildren") { + return jsi::Function::createFromHostFunction( + runtime, + name, + 1, + [uiManager, newestShadowNodesRegistry]( + jsi::Runtime &runtime, + jsi::Value const &thisValue, + jsi::Value const *arguments, + size_t count) noexcept -> jsi::Value { + return valueFromShadowNode( + runtime, + cloneNode( + uiManager, + newestShadowNodesRegistry, + shadowNodeFromValue(runtime, arguments[0]), + ShadowNode::emptySharedShadowNodeSharedList())); + }); + } + + // Semantic: Clones the node with *given* props and *same* children. + if (methodName == "cloneNodeWithNewProps") { + return jsi::Function::createFromHostFunction( + runtime, + name, + 2, + [uiManager, newestShadowNodesRegistry]( + jsi::Runtime &runtime, + jsi::Value const &thisValue, + jsi::Value const *arguments, + size_t count) noexcept -> jsi::Value { + auto const &rawProps = RawProps(runtime, arguments[1]); + return valueFromShadowNode( + runtime, + cloneNode( + uiManager, + newestShadowNodesRegistry, + shadowNodeFromValue(runtime, arguments[0]), + nullptr, + &rawProps)); + }); + } + + // Semantic: Clones the node with *given* props and *empty* children. + if (methodName == "cloneNodeWithNewChildrenAndProps") { + return jsi::Function::createFromHostFunction( + runtime, + name, + 2, + [uiManager, newestShadowNodesRegistry]( + jsi::Runtime &runtime, + jsi::Value const &thisValue, + jsi::Value const *arguments, + size_t count) noexcept -> jsi::Value { + auto const &rawProps = RawProps(runtime, arguments[1]); + return valueFromShadowNode( + runtime, + cloneNode( + uiManager, + newestShadowNodesRegistry, + shadowNodeFromValue(runtime, arguments[0]), + ShadowNode::emptySharedShadowNodeSharedList(), + &rawProps)); + }); + } + + if (methodName == "appendChild") { + return jsi::Function::createFromHostFunction( + runtime, + name, + 2, + [newestShadowNodesRegistry]( + jsi::Runtime &runtime, + jsi::Value const &thisValue, + jsi::Value const *arguments, + size_t count) noexcept -> jsi::Value { + auto parent = shadowNodeFromValue(runtime, arguments[0]); + auto child = shadowNodeFromValue(runtime, arguments[1]); + { + auto lock = newestShadowNodesRegistry->createLock(); + auto newest = newestShadowNodesRegistry->get(child->getTag()); + if (newest != nullptr) { + child = newest; + } + } + UIManager_appendChild(parent, child); + return jsi::Value::undefined(); + }); + } + + // Methods like "findNodeAtPoint", "getRelativeLayoutMetrics", "measure" etc. + // use `UIManager::getNewestCloneOfShadowNode` or + // `ShadowTree::getCurrentRevision` under the hood, + // so there's no need to overwrite them. + + return UIManagerBinding::get(runtime, name); +} + +} // namespace reanimated + +#endif // RCT_NEW_ARCH_ENABLED diff --git a/Common/cpp/NativeModules/NativeReanimatedModule.cpp b/Common/cpp/NativeModules/NativeReanimatedModule.cpp index 50584dd7611..f6dc48ef38a 100644 --- a/Common/cpp/NativeModules/NativeReanimatedModule.cpp +++ b/Common/cpp/NativeModules/NativeReanimatedModule.cpp @@ -1,7 +1,20 @@ #include "NativeReanimatedModule.h" + +#ifdef RCT_NEW_ARCH_ENABLED +#include +#include +#endif + #include #include #include + +#ifdef RCT_NEW_ARCH_ENABLED +#include "FabricUtils.h" +#include "NewestShadowNodesRegistry.h" +#include "ReanimatedUIManagerBinding.h" +#endif + #include "EventHandlerRegistry.h" #include "FeaturesConfig.h" #include "FrozenObject.h" @@ -62,8 +75,12 @@ NativeReanimatedModule::NativeReanimatedModule( std::shared_ptr scheduler, std::shared_ptr rt, std::shared_ptr errorHandler, +#ifdef RCT_NEW_ARCH_ENABLED +// nothing +#else std::function propObtainer, +#endif std::shared_ptr layoutAnimationsProxy, PlatformDepMethodsHolder platformDepMethodsHolder) : NativeReanimatedModuleSpec(jsInvoker), @@ -71,10 +88,20 @@ NativeReanimatedModule::NativeReanimatedModule( mapperRegistry(std::make_shared()), eventHandlerRegistry(std::make_shared()), requestRender(platformDepMethodsHolder.requestRender), +#ifdef RCT_NEW_ARCH_ENABLED +// nothing +#else propObtainer(propObtainer), +#endif animatedSensorModule(platformDepMethodsHolder, this), +#ifdef RCT_NEW_ARCH_ENABLED + synchronouslyUpdateUIPropsFunction( + platformDepMethodsHolder.synchronouslyUpdateUIPropsFunction) +#else configurePropsPlatformFunction( - platformDepMethodsHolder.configurePropsFunction) { + platformDepMethodsHolder.configurePropsFunction) +#endif +{ auto requestAnimationFrame = [=](FrameCallback callback) { frameCallbacks.push_back(callback); maybeRequestRender(); @@ -82,12 +109,45 @@ NativeReanimatedModule::NativeReanimatedModule( this->layoutAnimationsProxy = layoutAnimationsProxy; +#ifdef RCT_NEW_ARCH_ENABLED + auto updateProps = [this]( + jsi::Runtime &rt, + const jsi::Value &shadowNodeValue, + const jsi::Value &props) { + this->updateProps(rt, shadowNodeValue, props); + }; + + auto removeShadowNodeFromRegistry = + [this](jsi::Runtime &rt, const jsi::Value &shadowNodeValue) { + this->removeShadowNodeFromRegistry(rt, shadowNodeValue); + }; + + auto measure = [this](jsi::Runtime &rt, const jsi::Value &shadowNodeValue) { + return this->measure(rt, shadowNodeValue); + }; + + auto dispatchCommand = [this]( + jsi::Runtime &rt, + const jsi::Value &shadowNodeValue, + const jsi::Value &commandNameValue, + const jsi::Value &argsValue) { + this->dispatchCommand(rt, shadowNodeValue, commandNameValue, argsValue); + }; +#endif + RuntimeDecorator::decorateUIRuntime( *runtime, - platformDepMethodsHolder.updaterFunction, - requestAnimationFrame, +#ifdef RCT_NEW_ARCH_ENABLED + updateProps, + measure, + removeShadowNodeFromRegistry, + dispatchCommand, +#else + platformDepMethodsHolder.updatePropsFunction, + platformDepMethodsHolder.measureFunction, platformDepMethodsHolder.scrollToFunction, - platformDepMethodsHolder.measuringFunction, +#endif + requestAnimationFrame, platformDepMethodsHolder.getCurrentTime, platformDepMethodsHolder.registerSensor, platformDepMethodsHolder.unregisterSensor, @@ -97,7 +157,12 @@ NativeReanimatedModule::NativeReanimatedModule( this->renderRequested = false; this->onRender(timestampMs); }; - updaterFunction = platformDepMethodsHolder.updaterFunction; + +#ifdef RCT_NEW_ARCH_ENABLED + // nothing +#else + updatePropsFunction = platformDepMethodsHolder.updatePropsFunction; +#endif } void NativeReanimatedModule::installCoreFunctions( @@ -253,15 +318,33 @@ jsi::Value NativeReanimatedModule::configureProps( jsi::Runtime &rt, const jsi::Value &uiProps, const jsi::Value &nativeProps) { +#ifdef RCT_NEW_ARCH_ENABLED + jsi::Array array = nativeProps.asObject(rt).asArray(rt); + for (int i = 0; i < array.size(rt); ++i) { + std::string name = array.getValueAtIndex(rt, i).asString(rt).utf8(rt); + nativePropNames_.insert(name); + } +#else configurePropsPlatformFunction(rt, uiProps, nativeProps); +#endif // RCT_NEW_ARCH_ENABLED + return jsi::Value::undefined(); } void NativeReanimatedModule::onEvent( std::string eventName, - std::string eventAsString) { +#ifdef RCT_NEW_ARCH_ENABLED + jsi::Value &&payload +#else + std::string eventAsString +#endif + /**/) { try { +#ifdef RCT_NEW_ARCH_ENABLED + eventHandlerRegistry->processEvent(*runtime, eventName, payload); +#else eventHandlerRegistry->processEvent(*runtime, eventName, eventAsString); +#endif mapperRegistry->execute(*runtime); if (mapperRegistry->needRunOnRender()) { maybeRequestRender(); @@ -327,4 +410,226 @@ void NativeReanimatedModule::unregisterSensor( animatedSensorModule.unregisterSensor(sensorId); } +#ifdef RCT_NEW_ARCH_ENABLED +bool NativeReanimatedModule::isThereAnyLayoutProp( + jsi::Runtime &rt, + const jsi::Value &props) { + const jsi::Array propNames = props.asObject(rt).getPropertyNames(rt); + for (size_t i = 0; i < propNames.size(rt); ++i) { + const std::string propName = + propNames.getValueAtIndex(rt, i).asString(rt).utf8(rt); + bool isLayoutProp = + nativePropNames_.find(propName) != nativePropNames_.end(); + if (isLayoutProp) { + return true; + } + } + return false; +} + +bool NativeReanimatedModule::handleEvent( + const std::string &eventName, + jsi::Value &&payload, + double currentTime) { + jsi::Runtime &rt = *runtime.get(); + jsi::Object global = rt.global(); + jsi::String eventTimestampName = + jsi::String::createFromAscii(rt, "_eventTimestamp"); + global.setProperty(rt, eventTimestampName, currentTime); + onEvent(eventName, std::move(payload)); + global.setProperty(rt, eventTimestampName, jsi::Value::undefined()); + + // TODO: return true if Reanimated successfully handled the event + // to avoid sending it to JavaScript + return false; +} + +bool NativeReanimatedModule::handleRawEvent( + const RawEvent &rawEvent, + double currentTime) { + const EventTarget *eventTarget = rawEvent.eventTarget.get(); + if (eventTarget == nullptr) { + // after app reload scrollview is unmounted and its content offset is set to + // 0 and view is thrown into recycle pool setting content offset triggers + // scroll event eventTarget is null though, because it's unmounting we can + // just ignore this event, because it's an event on unmounted component + return false; + } + const std::string &type = rawEvent.type; + const ValueFactory &payloadFactory = rawEvent.payloadFactory; + + int tag = eventTarget->getTag(); + std::string eventType = type; + if (eventType.rfind("top", 0) == 0) { + eventType = "on" + eventType.substr(3); + } + std::string eventName = std::to_string(tag) + eventType; + jsi::Runtime &rt = *runtime.get(); + jsi::Value payload = payloadFactory(rt); + + return handleEvent(eventName, std::move(payload), currentTime); +} + +void NativeReanimatedModule::updateProps( + jsi::Runtime &rt, + const jsi::Value &shadowNodeValue, + const jsi::Value &props) { + ShadowNode::Shared shadowNode = shadowNodeFromValue(rt, shadowNodeValue); + + // TODO: support multiple surfaces + surfaceId_ = shadowNode->getSurfaceId(); + + if (isThereAnyLayoutProp(rt, props)) { + operationsInBatch_.emplace_back( + shadowNode, std::make_unique(rt, props)); + } else { + // TODO: batch with layout props changes? + Tag tag = shadowNode->getTag(); + synchronouslyUpdateUIPropsFunction(rt, tag, props); + } +} + +void NativeReanimatedModule::performOperations() { + if (operationsInBatch_.empty()) { + return; + } + + auto copiedOperationsQueue = std::move(operationsInBatch_); + operationsInBatch_ = + std::vector>>(); + + auto copiedTagsToRemove = std::move(tagsToRemove_); + tagsToRemove_ = std::vector(); + + react_native_assert(uiManager_ != nullptr); + const auto &shadowTreeRegistry = uiManager_->getShadowTreeRegistry(); + auto contextContainer = getContextContainerFromUIManager( + &*uiManager_); // TODO: use Scheduler::getContextContainer + PropsParserContext propsParserContext{surfaceId_, *contextContainer}; + jsi::Runtime &rt = *runtime.get(); + + shadowTreeRegistry.visit(surfaceId_, [&](ShadowTree const &shadowTree) { + shadowTree.commit([&](RootShadowNode const &oldRootShadowNode) { + // lock once due to performance reasons + auto lock = newestShadowNodesRegistry_->createLock(); + + auto rootNode = oldRootShadowNode.ShadowNode::clone(ShadowNodeFragment{}); + + for (const auto &pair : copiedOperationsQueue) { + const ShadowNodeFamily &family = pair.first->getFamily(); + react_native_assert(family.getSurfaceId() == surfaceId_); + + auto newRootNode = + rootNode->cloneTree(family, [&](ShadowNode const &oldShadowNode) { + const auto newest = + newestShadowNodesRegistry_->get(oldShadowNode.getTag()); + + const auto &source = newest == nullptr ? oldShadowNode : *newest; + + const auto newProps = source.getComponentDescriptor().cloneProps( + propsParserContext, + source.getProps(), + RawProps(rt, *pair.second)); + + return source.clone({/* .props = */ newProps}); + }); + + if (newRootNode == nullptr) { + // this happens when React removed the component but Reanimated still + // tries to animate it, let's skip update for this specific component + continue; + } + rootNode = newRootNode; + + auto ancestors = family.getAncestors(*rootNode); + for (const auto &pair : ancestors) { + const auto &parent = pair.first.get(); + const auto &child = parent.getChildren().at(pair.second); + newestShadowNodesRegistry_->set(child, parent.getTag()); + } + } + + // remove ShadowNodes and its ancestors from NewestShadowNodesRegistry + for (auto tag : copiedTagsToRemove) { + newestShadowNodesRegistry_->remove(tag); + } + + return std::static_pointer_cast(rootNode); + }); + }); +} + +void NativeReanimatedModule::removeShadowNodeFromRegistry( + jsi::Runtime &rt, + const jsi::Value &shadowNodeValue) { + auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue); + tagsToRemove_.push_back(shadowNode->getTag()); +} + +void NativeReanimatedModule::dispatchCommand( + jsi::Runtime &rt, + const jsi::Value &shadowNodeValue, + const jsi::Value &commandNameValue, + const jsi::Value &argsValue) { + ShadowNode::Shared shadowNode = shadowNodeFromValue(rt, shadowNodeValue); + std::string commandName = stringFromValue(rt, commandNameValue); + folly::dynamic args = commandArgsFromValue(rt, argsValue); + + // TODO: use uiManager_->dispatchCommand once it's public + UIManager_dispatchCommand(uiManager_, shadowNode, commandName, args); +} + +jsi::Value NativeReanimatedModule::measure( + jsi::Runtime &rt, + const jsi::Value &shadowNodeValue) { + // based on implementation from UIManagerBinding.cpp + + auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue); + // TODO: use uiManager_->getRelativeLayoutMetrics once it's public + // auto layoutMetrics = uiManager_->getRelativeLayoutMetrics( + // *shadowNode, nullptr, {/* .includeTransform = */ true}); + auto layoutMetrics = UIManager_getRelativeLayoutMetrics( + uiManager_, *shadowNode, nullptr, {/* .includeTransform = */ true}); + + if (layoutMetrics == EmptyLayoutMetrics) { + return jsi::Value::undefined(); + } + auto newestCloneOfShadowNode = + uiManager_->getNewestCloneOfShadowNode(*shadowNode); + + auto layoutableShadowNode = + traitCast(newestCloneOfShadowNode.get()); + facebook::react::Point originRelativeToParent = layoutableShadowNode + ? layoutableShadowNode->getLayoutMetrics().frame.origin + : facebook::react::Point(); + + auto frame = layoutMetrics.frame; + + jsi::Object result(rt); + result.setProperty( + rt, "x", jsi::Value(static_cast(originRelativeToParent.x))); + result.setProperty( + rt, "y", jsi::Value(static_cast(originRelativeToParent.y))); + result.setProperty( + rt, "width", jsi::Value(static_cast(frame.size.width))); + result.setProperty( + rt, "height", jsi::Value(static_cast(frame.size.height))); + result.setProperty( + rt, "pageX", jsi::Value(static_cast(frame.origin.x))); + result.setProperty( + rt, "pageY", jsi::Value(static_cast(frame.origin.y))); + return result; +} + +void NativeReanimatedModule::setUIManager( + std::shared_ptr uiManager) { + uiManager_ = uiManager; +} + +void NativeReanimatedModule::setNewestShadowNodesRegistry( + std::shared_ptr newestShadowNodesRegistry) { + newestShadowNodesRegistry_ = newestShadowNodesRegistry; +} +#endif // RCT_NEW_ARCH_ENABLED + } // namespace reanimated diff --git a/Common/cpp/Registries/EventHandlerRegistry.cpp b/Common/cpp/Registries/EventHandlerRegistry.cpp index 2fb4d257d04..fd9287130a1 100644 --- a/Common/cpp/Registries/EventHandlerRegistry.cpp +++ b/Common/cpp/Registries/EventHandlerRegistry.cpp @@ -25,7 +25,12 @@ void EventHandlerRegistry::unregisterEventHandler(unsigned long id) { void EventHandlerRegistry::processEvent( jsi::Runtime &rt, std::string eventName, - std::string eventPayload) { +#ifdef RCT_NEW_ARCH_ENABLED + jsi::Value &eventPayload +#else + std::string eventPayload +#endif + /**/) { std::vector> handlersForEvent; { const std::lock_guard lock(instanceMutex); @@ -36,6 +41,13 @@ void EventHandlerRegistry::processEvent( } } } +#ifdef RCT_NEW_ARCH_ENABLED + eventPayload.asObject(rt).setProperty( + rt, "eventName", jsi::String::createFromUtf8(rt, eventName)); + for (auto handler : handlersForEvent) { + handler->process(rt, eventPayload); + } +#else // We receive here a JS Map with JSON as a value of NativeMap key // { NativeMap: { "jsonProp": "json value" } } // So we need to extract only JSON part @@ -57,6 +69,7 @@ void EventHandlerRegistry::processEvent( for (auto handler : handlersForEvent) { handler->process(rt, eventObject); } +#endif } bool EventHandlerRegistry::isAnyHandlerWaitingForEvent(std::string eventName) { diff --git a/Common/cpp/Registries/NewestShadowNodesRegistry.cpp b/Common/cpp/Registries/NewestShadowNodesRegistry.cpp new file mode 100644 index 00000000000..ab5c0ecda7f --- /dev/null +++ b/Common/cpp/Registries/NewestShadowNodesRegistry.cpp @@ -0,0 +1,68 @@ +#ifdef RCT_NEW_ARCH_ENABLED + +#include "NewestShadowNodesRegistry.h" + +#include +#include + +using namespace facebook::react; + +namespace reanimated { + +void NewestShadowNodesRegistry::set( + ShadowNode::Shared shadowNode, + Tag parentTag) { + map_[shadowNode->getTag()] = std::make_pair(shadowNode, parentTag); +} + +bool NewestShadowNodesRegistry::has( + const ShadowNode::Shared &shadowNode) const { + return map_.find(shadowNode->getTag()) != map_.cend(); +} + +ShadowNode::Shared NewestShadowNodesRegistry::get(Tag tag) const { + const auto it = map_.find(tag); + return it != map_.cend() ? it->second.first : nullptr; +} + +void NewestShadowNodesRegistry::update(ShadowNode::Shared shadowNode) { + const auto it = map_.find(shadowNode->getTag()); + react_native_assert(it != map_.cend()); + it->second.first = shadowNode; +} + +void NewestShadowNodesRegistry::remove(Tag tag) { + if (map_.find(tag) == map_.cend()) { + return; + } + + auto shadowNode = map_[tag].first; + + while (shadowNode != nullptr) { + bool hasAnyChildInMap = false; + for (const auto &child : shadowNode->getChildren()) { + if (has(child)) { + hasAnyChildInMap = true; + break; + } + } + + if (hasAnyChildInMap) { + break; + } + + auto it = map_.find(shadowNode->getTag()); + Tag parentTag = it->second.second; + map_.erase(it); + + shadowNode = map_[parentTag].first; + } +} + +std::lock_guard NewestShadowNodesRegistry::createLock() const { + return std::lock_guard(mutex_); +} + +} // namespace reanimated + +#endif // RCT_NEW_ARCH_ENABLED diff --git a/Common/cpp/SharedItems/ShareableValue.cpp b/Common/cpp/SharedItems/ShareableValue.cpp index d65b2a16bc4..786c04229d9 100644 --- a/Common/cpp/SharedItems/ShareableValue.cpp +++ b/Common/cpp/SharedItems/ShareableValue.cpp @@ -1,4 +1,9 @@ #include + +#ifdef RCT_NEW_ARCH_ENABLED +#include +#endif + #include "FrozenObject.h" #include "MutableValue.h" #include "MutableValueSetterProxy.h" @@ -157,6 +162,13 @@ void ShareableValue::adapt( valueContainer = std::make_unique(std::make_shared( rt, object, runtimeManager, runtimeManager->scheduler)); +#ifdef RCT_NEW_ARCH_ENABLED + } else if (object.isHostObject(rt)) { + type = ValueType::ShadowNodeType; + auto shadowNode = object.getHostObject(rt)->shadowNode; + valueContainer = std::make_unique(shadowNode); + adaptCache(rt, value); +#endif } else { // create frozen object based on a copy of a given object type = ValueType::FrozenObjectType; @@ -278,6 +290,12 @@ jsi::Value ShareableValue::toJSValue(jsi::Runtime &rt) { auto &mutableObject = ValueWrapper::asMutableValue(valueContainer); return createHost(rt, mutableObject); } +#ifdef RCT_NEW_ARCH_ENABLED + case ValueType::ShadowNodeType: { + auto &shadowNode = ValueWrapper::asShadowNode(valueContainer); + return createHost(rt, std::make_shared(shadowNode)); + } +#endif case ValueType::HostFunctionType: { auto hostFunctionWrapper = ValueWrapper::asHostFunctionWrapper(valueContainer); diff --git a/Common/cpp/Tools/Mapper.cpp b/Common/cpp/Tools/Mapper.cpp index b6ed9a713fd..fcf161a624a 100644 --- a/Common/cpp/Tools/Mapper.cpp +++ b/Common/cpp/Tools/Mapper.cpp @@ -25,7 +25,11 @@ void Mapper::execute(jsi::Runtime &rt) { if (optimalizationLvl == 0) { mapper->callWithThis(rt, *mapper); // call styleUpdater } else { +#ifdef RCT_NEW_ARCH_ENABLED + jsi::Value newStyle = userUpdater->call(rt).asObject(rt); +#else jsi::Object newStyle = userUpdater->call(rt).asObject(rt); +#endif auto jsViewDescriptorArray = viewDescriptors->getValue(rt) .getObject(rt) .getProperty(rt, "value") @@ -34,11 +38,16 @@ void Mapper::execute(jsi::Runtime &rt) { for (int i = 0; i < jsViewDescriptorArray.length(rt); ++i) { auto jsViewDescriptor = jsViewDescriptorArray.getValueAtIndex(rt, i).getObject(rt); - (*updateProps)( +#ifdef RCT_NEW_ARCH_ENABLED + updateProps( + rt, jsViewDescriptor.getProperty(rt, "shadowNodeWrapper"), newStyle); +#else + updateProps( rt, static_cast(jsViewDescriptor.getProperty(rt, "tag").asNumber()), jsViewDescriptor.getProperty(rt, "name"), newStyle); +#endif } } } @@ -52,10 +61,20 @@ void Mapper::enableFastMode( } viewDescriptors = jsViewDescriptors; this->optimalizationLvl = optimalizationLvl; - updateProps = &module->updaterFunction; - jsi::Runtime *rt = module->runtime.get(); +#ifdef RCT_NEW_ARCH_ENABLED + updateProps = [this]( + jsi::Runtime &rt, + const jsi::Value &shadowNodeValue, + const jsi::Value &props) { + this->module->updateProps(rt, shadowNodeValue, props); + }; +#else + // TODO: don't get public field, instead call this->module->updateProps + updateProps = module->updatePropsFunction; +#endif + jsi::Runtime &rt = *module->runtime; userUpdater = std::make_shared( - updater->getValue(*rt).asObject(*rt).asFunction(*rt)); + updater->getValue(rt).asObject(rt).asFunction(rt)); } Mapper::~Mapper() { diff --git a/Common/cpp/Tools/RuntimeDecorator.cpp b/Common/cpp/Tools/RuntimeDecorator.cpp index 72ae4697ca6..d30d81f6eff 100644 --- a/Common/cpp/Tools/RuntimeDecorator.cpp +++ b/Common/cpp/Tools/RuntimeDecorator.cpp @@ -90,10 +90,15 @@ void RuntimeDecorator::decorateRuntime( void RuntimeDecorator::decorateUIRuntime( jsi::Runtime &rt, - const UpdaterFunction updater, - const RequestFrameFunction requestFrame, + const UpdatePropsFunction updateProps, + const MeasureFunction measure, +#ifdef RCT_NEW_ARCH_ENABLED + const RemoveShadowNodeFromRegistryFunction removeShadowNodeFromRegistry, + const DispatchCommandFunction dispatchCommand, +#else const ScrollToFunction scrollTo, - const MeasuringFunction measure, +#endif + const RequestFrameFunction requestFrame, const TimeProviderFunction getCurrentTime, const RegisterSensorFunction registerSensor, const UnregisterSensorFunction unregisterSensor, @@ -102,42 +107,79 @@ void RuntimeDecorator::decorateUIRuntime( RuntimeDecorator::decorateRuntime(rt, "UI"); rt.global().setProperty(rt, "_UI", jsi::Value(true)); - auto clb = [updater]( +#ifdef RCT_NEW_ARCH_ENABLED + auto clb = [updateProps]( jsi::Runtime &rt, const jsi::Value &thisValue, const jsi::Value *args, const size_t count) -> jsi::Value { - const auto viewTag = args[0].asNumber(); - const jsi::Value *viewName = &args[1]; - const auto params = args[2].asObject(rt); - updater(rt, viewTag, *viewName, params); + updateProps(rt, args[0], args[1]); return jsi::Value::undefined(); }; - jsi::Value updateProps = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "_updateProps"), 2, clb); - rt.global().setProperty(rt, "_updateProps", updateProps); + jsi::Value updatePropsHostFunction = jsi::Function::createFromHostFunction( + rt, jsi::PropNameID::forAscii(rt, "_updatePropsFabric"), 2, clb); + rt.global().setProperty(rt, "_updatePropsFabric", updatePropsHostFunction); - auto clb2 = [requestFrame]( - jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - const size_t count) -> jsi::Value { - auto fun = - std::make_shared(args[0].asObject(rt).asFunction(rt)); - requestFrame([&rt, fun](double timestampMs) { - fun->call(rt, jsi::Value(timestampMs)); - }); + auto _removeShadowNodeFromRegistry = [removeShadowNodeFromRegistry]( + jsi::Runtime &rt, + const jsi::Value &thisValue, + const jsi::Value *args, + const size_t count) -> jsi::Value { + removeShadowNodeFromRegistry(rt, args[0]); return jsi::Value::undefined(); }; - jsi::Value requestAnimationFrame = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "requestAnimationFrame"), 1, clb2); - rt.global().setProperty(rt, "requestAnimationFrame", requestAnimationFrame); + jsi::Value removeShadowNodeFromRegistryHostFunction = + jsi::Function::createFromHostFunction( + rt, + jsi::PropNameID::forAscii(rt, "_removeShadowNodeFromRegistry"), + 2, + _removeShadowNodeFromRegistry); + rt.global().setProperty( + rt, + "_removeShadowNodeFromRegistry", + removeShadowNodeFromRegistryHostFunction); - auto clb3 = [scrollTo]( + auto clb3 = [dispatchCommand]( jsi::Runtime &rt, const jsi::Value &thisValue, const jsi::Value *args, const size_t count) -> jsi::Value { + dispatchCommand(rt, args[0], args[1], args[2]); + return jsi::Value::undefined(); + }; + jsi::Value dispatchCommandHostFunction = + jsi::Function::createFromHostFunction( + rt, jsi::PropNameID::forAscii(rt, "_dispatchCommand"), 3, clb3); + rt.global().setProperty(rt, "_dispatchCommand", dispatchCommandHostFunction); + + auto _measure = [measure]( + jsi::Runtime &rt, + const jsi::Value &thisValue, + const jsi::Value *args, + const size_t count) -> jsi::Value { + return measure(rt, args[0]); + }; +#else + auto clb = [updateProps]( + jsi::Runtime &rt, + const jsi::Value &thisValue, + const jsi::Value *args, + const size_t count) -> jsi::Value { + const auto viewTag = args[0].asNumber(); + const jsi::Value *viewName = &args[1]; + const auto params = args[2].asObject(rt); + updateProps(rt, viewTag, *viewName, params); + return jsi::Value::undefined(); + }; + jsi::Value updatePropsHostFunction = jsi::Function::createFromHostFunction( + rt, jsi::PropNameID::forAscii(rt, "_updatePropsPaper"), 3, clb); + rt.global().setProperty(rt, "_updatePropsPaper", updatePropsHostFunction); + + auto _scrollTo = [scrollTo]( + jsi::Runtime &rt, + const jsi::Value &thisValue, + const jsi::Value *args, + const size_t count) -> jsi::Value { int viewTag = static_cast(args[0].asNumber()); double x = args[1].asNumber(); double y = args[2].asNumber(); @@ -146,14 +188,14 @@ void RuntimeDecorator::decorateUIRuntime( return jsi::Value::undefined(); }; jsi::Value scrollToFunction = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "_scrollTo"), 4, clb3); + rt, jsi::PropNameID::forAscii(rt, "_scrollTo"), 4, _scrollTo); rt.global().setProperty(rt, "_scrollTo", scrollToFunction); - auto clb4 = [measure]( - jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - const size_t count) -> jsi::Value { + auto _measure = [measure]( + jsi::Runtime &rt, + const jsi::Value &thisValue, + const jsi::Value *args, + const size_t count) -> jsi::Value { int viewTag = static_cast(args[0].asNumber()); auto result = measure(viewTag); jsi::Object resultObject(rt); @@ -162,10 +204,28 @@ void RuntimeDecorator::decorateUIRuntime( } return resultObject; }; +#endif // RCT_NEW_ARCH_ENABLED + jsi::Value measureFunction = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "_measure"), 1, clb4); + rt, jsi::PropNameID::forAscii(rt, "_measure"), 1, _measure); rt.global().setProperty(rt, "_measure", measureFunction); + auto clb2 = [requestFrame]( + jsi::Runtime &rt, + const jsi::Value &thisValue, + const jsi::Value *args, + const size_t count) -> jsi::Value { + auto fun = + std::make_shared(args[0].asObject(rt).asFunction(rt)); + requestFrame([&rt, fun](double timestampMs) { + fun->call(rt, jsi::Value(timestampMs)); + }); + return jsi::Value::undefined(); + }; + jsi::Value requestAnimationFrame = jsi::Function::createFromHostFunction( + rt, jsi::PropNameID::forAscii(rt, "requestAnimationFrame"), 1, clb2); + rt.global().setProperty(rt, "requestAnimationFrame", requestAnimationFrame); + auto clb6 = [getCurrentTime]( jsi::Runtime &rt, const jsi::Value &thisValue, diff --git a/Common/cpp/Tools/Scheduler.cpp b/Common/cpp/Tools/Scheduler.cpp index abd6ab3dc89..50942107cf8 100644 --- a/Common/cpp/Tools/Scheduler.cpp +++ b/Common/cpp/Tools/Scheduler.cpp @@ -1,4 +1,8 @@ +#ifdef __APPLE__ +#include +#else #include "Scheduler.h" +#endif namespace reanimated { diff --git a/Common/cpp/headers/Fabric/FabricUtils.h b/Common/cpp/headers/Fabric/FabricUtils.h new file mode 100644 index 00000000000..136f205d94d --- /dev/null +++ b/Common/cpp/headers/Fabric/FabricUtils.h @@ -0,0 +1,78 @@ +#pragma once +#ifdef RCT_NEW_ARCH_ENABLED + +#ifdef ANDROID +#include +#include +#endif +#include + +#include +#include + +using namespace facebook::react; + +namespace reanimated { + +struct UIManagerBindingPublic { + void *vtable; + std::shared_ptr uiManager_; +}; + +struct UIManagerPublic { + void *vtable; + SharedComponentDescriptorRegistry componentDescriptorRegistry_; + UIManagerDelegate *delegate_; + UIManagerAnimationDelegate *animationDelegate_{nullptr}; + RuntimeExecutor const runtimeExecutor_{}; + ShadowTreeRegistry shadowTreeRegistry_{}; + BackgroundExecutor const backgroundExecutor_{}; + ContextContainer::Shared contextContainer_; +}; + +#ifdef ANDROID +struct BindingPublic : public jni::HybridClass, + public SchedulerDelegate, + public LayoutAnimationStatusDelegate { + butter::shared_mutex installMutex_; + std::shared_ptr mountingManager_; + std::shared_ptr scheduler_; +}; + +struct SchedulerPublic : public UIManagerDelegate { + SchedulerDelegate *delegate_; + SharedComponentDescriptorRegistry componentDescriptorRegistry_; + RuntimeExecutor runtimeExecutor_; +}; + +RuntimeExecutor getRuntimeExecutorFromBinding(Binding *binding); +#endif + +std::shared_ptr getContextContainerFromUIManager( + const UIManager *uiManager); + +void UIManager_dispatchCommand( + const std::shared_ptr &uiManager, + const ShadowNode::Shared &shadowNode, + std::string const &commandName, + folly::dynamic const &args); + +LayoutMetrics UIManager_getRelativeLayoutMetrics( + const std::shared_ptr &uiManager, + ShadowNode const &shadowNode, + ShadowNode const *ancestorShadowNode, + LayoutableShadowNode::LayoutInspectingPolicy policy); + +SharedShadowNode UIManager_cloneNode( + const UIManager *uiManager, + const ShadowNode::Shared &shadowNode, + const SharedShadowNodeSharedList &children = nullptr, + const RawProps *rawProps = nullptr); + +void UIManager_appendChild( + const ShadowNode::Shared &parentShadowNode, + const ShadowNode::Shared &childShadowNode); + +} // namespace reanimated + +#endif // RCT_NEW_ARCH_ENABLED diff --git a/Common/cpp/headers/Fabric/ReanimatedUIManagerBinding.h b/Common/cpp/headers/Fabric/ReanimatedUIManagerBinding.h new file mode 100644 index 00000000000..533ecf5850e --- /dev/null +++ b/Common/cpp/headers/Fabric/ReanimatedUIManagerBinding.h @@ -0,0 +1,46 @@ +#pragma once +#ifdef RCT_NEW_ARCH_ENABLED + +#include +#include +#include +#include +#include + +#include + +#include "NewestShadowNodesRegistry.h" + +using namespace facebook; +using namespace react; + +namespace reanimated { + +class ReanimatedUIManagerBinding : public UIManagerBinding { + public: + static void createAndInstallIfNeeded( + jsi::Runtime &runtime, + RuntimeExecutor const &runtimeExecutor, + std::shared_ptr const &uiManager, + std::shared_ptr const + &newestShadowNodesRegistry); + + ReanimatedUIManagerBinding( + std::shared_ptr uiManager, + RuntimeExecutor runtimeExecutor, + std::shared_ptr newestShadowNodesRegistry); + + ~ReanimatedUIManagerBinding(); + + void invalidate() const; + + jsi::Value get(jsi::Runtime &runtime, jsi::PropNameID const &name) override; + + private: + std::shared_ptr uiManager_; + std::shared_ptr newestShadowNodesRegistry_; +}; + +} // namespace reanimated + +#endif // RCT_NEW_ARCH_ENABLED diff --git a/Common/cpp/headers/NativeModules/NativeReanimatedModule.h b/Common/cpp/headers/NativeModules/NativeReanimatedModule.h index fdcea13424d..ae4af469b85 100644 --- a/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +++ b/Common/cpp/headers/NativeModules/NativeReanimatedModule.h @@ -1,8 +1,14 @@ #pragma once -#include +#ifdef RCT_NEW_ARCH_ENABLED +#include +#include "NewestShadowNodesRegistry.h" +#endif + #include #include +#include +#include #include #include "AnimatedSensorModule.h" @@ -34,8 +40,12 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec, std::shared_ptr scheduler, std::shared_ptr rt, std::shared_ptr errorHandler, +#ifdef RCT_NEW_ARCH_ENABLED + // nothing +#else std::function propObtainer, +#endif std::shared_ptr layoutAnimationsProxy, PlatformDepMethodsHolder platformDepMethodsHolder); @@ -77,11 +87,48 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec, const jsi::Value &nativeProps) override; void onRender(double timestampMs); +#ifdef RCT_NEW_ARCH_ENABLED + void onEvent(std::string eventName, jsi::Value &&eventAsString); +#else void onEvent(std::string eventName, std::string eventAsString); +#endif bool isAnyHandlerWaitingForEvent(std::string eventName); void maybeRequestRender(); - UpdaterFunction updaterFunction; + UpdatePropsFunction updatePropsFunction; + + bool handleEvent( + const std::string &eventName, + jsi::Value &&payload, + double currentTime); + +#ifdef RCT_NEW_ARCH_ENABLED + bool handleRawEvent(const RawEvent &rawEvent, double currentTime); + + void updateProps( + jsi::Runtime &rt, + const jsi::Value &shadowNodeValue, + const jsi::Value &props); + + void removeShadowNodeFromRegistry( + jsi::Runtime &rt, + const jsi::Value &shadowNodeValue); + + void performOperations(); + + void dispatchCommand( + jsi::Runtime &rt, + const jsi::Value &shadowNodeValue, + const jsi::Value &commandNameValue, + const jsi::Value &argsValue); + + jsi::Value measure(jsi::Runtime &rt, const jsi::Value &shadowNodeValue); + + void setUIManager(std::shared_ptr uiManager); + + void setNewestShadowNodesRegistry( + std::shared_ptr newestShadowNodesRegistry); +#endif jsi::Value registerSensor( jsi::Runtime &rt, @@ -91,6 +138,10 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec, void unregisterSensor(jsi::Runtime &rt, const jsi::Value &sensorId) override; private: +#ifdef RCT_NEW_ARCH_ENABLED + bool isThereAnyLayoutProp(jsi::Runtime &rt, const jsi::Value &props); +#endif // RCT_NEW_ARCH_ENABLED + std::shared_ptr mapperRegistry; std::shared_ptr eventHandlerRegistry; std::function requestRender; @@ -103,6 +154,25 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec, std::shared_ptr layoutAnimationsProxy; AnimatedSensorModule animatedSensorModule; ConfigurePropsFunction configurePropsPlatformFunction; + +#ifdef RCT_NEW_ARCH_ENABLED + SynchronouslyUpdateUIPropsFunction synchronouslyUpdateUIPropsFunction; + + std::shared_ptr uiManager_; + + // After app reload, surfaceId on iOS is still 1 but on Android it's 11. + // We can store surfaceId of the most recent ShadowNode as a workaround. + SurfaceId surfaceId_ = -1; + + std::vector>> + operationsInBatch_; // TODO: refactor std::pair to custom struct + + std::shared_ptr newestShadowNodesRegistry_; + + std::vector tagsToRemove_; // from newestShadowNodesRegistry_ +#endif + + std::unordered_set nativePropNames_; // filled by configureProps }; } // namespace reanimated diff --git a/Common/cpp/headers/Registries/EventHandlerRegistry.h b/Common/cpp/headers/Registries/EventHandlerRegistry.h index d887a4cf913..90ef848dcf2 100644 --- a/Common/cpp/headers/Registries/EventHandlerRegistry.h +++ b/Common/cpp/headers/Registries/EventHandlerRegistry.h @@ -27,10 +27,18 @@ class EventHandlerRegistry { void registerEventHandler(std::shared_ptr eventHandler); void unregisterEventHandler(unsigned long id); +#ifdef RCT_NEW_ARCH_ENABLED + void processEvent( + jsi::Runtime &rt, + std::string eventName, + jsi::Value &eventPayload); +#else void processEvent( jsi::Runtime &rt, std::string eventName, std::string eventPayload); +#endif + bool isAnyHandlerWaitingForEvent(std::string eventName); }; diff --git a/Common/cpp/headers/Registries/NewestShadowNodesRegistry.h b/Common/cpp/headers/Registries/NewestShadowNodesRegistry.h new file mode 100644 index 00000000000..c8cdf137fcf --- /dev/null +++ b/Common/cpp/headers/Registries/NewestShadowNodesRegistry.h @@ -0,0 +1,41 @@ +#pragma once +#ifdef RCT_NEW_ARCH_ENABLED + +#include +#include +#include +#include + +using namespace facebook::react; + +namespace reanimated { + +class NewestShadowNodesRegistry { + public: + std::lock_guard createLock() const; + // returns a lock you need to hold when calling any of the methods below + + void set(ShadowNode::Shared shadowNode, Tag parentTag); + // updates ShadowNode and sets parent tag, to be called from Reanimated + + bool has(const ShadowNode::Shared &shadowNode) const; + // checks if ShadowNode exists in the registry + + ShadowNode::Shared get(Tag tag) const; + // returns the most recent version of ShadowNode or nullptr if not found + + void update(ShadowNode::Shared shadowNode); + // updates ShadowNode that already exists in registry, to be called from RN + + void remove(Tag tag); + // removes ShadowNode from map along with its ancestors + + private: + std::unordered_map> map_; + // tag -> (most recent clone of shadow node, parent tag) + mutable std::mutex mutex_; // Protects `map_`. +}; + +} // namespace reanimated + +#endif // RCT_NEW_ARCH_ENABLED diff --git a/Common/cpp/headers/SharedItems/SharedParent.h b/Common/cpp/headers/SharedItems/SharedParent.h index 88a28d8439d..8f3085066e1 100644 --- a/Common/cpp/headers/SharedItems/SharedParent.h +++ b/Common/cpp/headers/SharedItems/SharedParent.h @@ -17,6 +17,9 @@ enum class ValueType { WorkletFunctionType, // function that gets run on the UI thread FrozenObjectType, // frozen object, can only be set and never modified FrozenArrayType, // frozen array, can only be set and never modified +#ifdef RCT_NEW_ARCH_ENABLED + ShadowNodeType, // ShadowNode::Shared +#endif // RCT_NEW_ARCH_ENABLED }; class ShareableValue; diff --git a/Common/cpp/headers/SharedItems/ValueWrapper.h b/Common/cpp/headers/SharedItems/ValueWrapper.h index beaf8034f5d..d751cdaab5d 100644 --- a/Common/cpp/headers/SharedItems/ValueWrapper.h +++ b/Common/cpp/headers/SharedItems/ValueWrapper.h @@ -1,6 +1,9 @@ #pragma once #include +#ifdef RCT_NEW_ARCH_ENABLED +#include +#endif #include #include #include @@ -9,6 +12,8 @@ #include "SharedParent.h" #include "WorkletsCache.h" +using namespace facebook::react; + namespace reanimated { class HostFunctionWrapper; @@ -42,6 +47,10 @@ class ValueWrapper { const std::unique_ptr &valueContainer); static inline const std::shared_ptr &asMutableValue( const std::unique_ptr &valueContainer); +#ifdef RCT_NEW_ARCH_ENABLED + static inline const ShadowNode::Shared &asShadowNode( + const std::unique_ptr &valueContainer); +#endif static const HostFunctionWrapper *asHostFunctionWrapper( const std::unique_ptr &valueContainer); @@ -109,6 +118,15 @@ class MutableValueWrapper : public ValueWrapper { std::shared_ptr value; }; +#ifdef RCT_NEW_ARCH_ENABLED +class ShadowNodeValueWrapper : public ValueWrapper { + public: + explicit ShadowNodeValueWrapper(const ShadowNode::Shared &_value) + : ValueWrapper(ValueType::ShadowNodeType), value(_value) {} + ShadowNode::Shared value; +}; +#endif + inline bool ValueWrapper::asBoolean( const std::unique_ptr &valueContainer) { return static_cast(valueContainer.get())->value; @@ -150,6 +168,13 @@ inline const std::shared_ptr &ValueWrapper::asMutableValue( return static_cast(valueContainer.get())->value; } +#ifdef RCT_NEW_ARCH_ENABLED +inline const ShadowNode::Shared &ValueWrapper::asShadowNode( + const std::unique_ptr &valueContainer) { + return static_cast(valueContainer.get())->value; +} +#endif + inline const HostFunctionWrapper *ValueWrapper::asHostFunctionWrapper( const std::unique_ptr &valueContainer) { return static_cast(valueContainer.get()); diff --git a/Common/cpp/headers/SpecTools/ErrorHandler.h b/Common/cpp/headers/SpecTools/ErrorHandler.h index 433c8c3afad..b19b8f00e83 100644 --- a/Common/cpp/headers/SpecTools/ErrorHandler.h +++ b/Common/cpp/headers/SpecTools/ErrorHandler.h @@ -2,7 +2,12 @@ #include #include + +#ifdef __APPLE__ +#include "RNReanimated/Scheduler.h" +#else #include "Scheduler.h" +#endif namespace reanimated { diff --git a/Common/cpp/headers/Tools/Mapper.h b/Common/cpp/headers/Tools/Mapper.h index 75bb672847b..9b53025a7ad 100644 --- a/Common/cpp/headers/Tools/Mapper.h +++ b/Common/cpp/headers/Tools/Mapper.h @@ -29,7 +29,7 @@ class Mapper : public std::enable_shared_from_this { std::vector> outputs; bool dirty = true; std::shared_ptr userUpdater; - UpdaterFunction *updateProps; + UpdatePropsFunction updateProps; int optimalizationLvl = 0; std::shared_ptr viewDescriptors; diff --git a/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h b/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h index 2c6558556eb..08ac999d666 100644 --- a/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +++ b/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h @@ -1,25 +1,56 @@ #pragma once #include -#include + +#ifdef RCT_NEW_ARCH_ENABLED +#include +#endif + #include #include #include using namespace facebook; +#ifdef RCT_NEW_ARCH_ENABLED +using namespace react; +#endif + namespace reanimated { -using UpdaterFunction = std::function; +using UpdatePropsFunction = std::function; +using RemoveShadowNodeFromRegistryFunction = + std::function; +using DispatchCommandFunction = std::function; +using MeasureFunction = std::function< + jsi::Value(jsi::Runtime &rt, const jsi::Value &shadowNodeValue)>; + +#else + +using UpdatePropsFunction = std::function; -using RequestRender = - std::function, jsi::Runtime &rt)>; using ScrollToFunction = std::function; -using MeasuringFunction = +using MeasureFunction = std::function>(int)>; + +#endif // RCT_NEW_ARCH_ENABLED + +using RequestRender = + std::function, jsi::Runtime &rt)>; using TimeProviderFunction = std::function; using RegisterSensorFunction = @@ -33,14 +64,18 @@ using ConfigurePropsFunction = std::function; }): React.ReactElement { const animatedProps = useAnimatedProps(() => { - return ({ text: text.value } as unknown) as TextInputProps; + return { text: text.value } as unknown as TextInputProps; }); return ( diff --git a/Example/tsconfig.json b/Example/tsconfig.json index 9667c3a701e..26a54029dc7 100644 --- a/Example/tsconfig.json +++ b/Example/tsconfig.json @@ -3,7 +3,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "react-native-reanimated": ["../react-native-reanimated.d.ts"] + "react-native-reanimated": ["../"], + "react": ["./node_modules/@types/react"], } }, "include": ["index.js", "src/**/*", "reanimated1/**/*", "test/**/*"] diff --git a/Example/yarn.lock b/Example/yarn.lock index a34b98b549c..75b5ecd26d4 100644 --- a/Example/yarn.lock +++ b/Example/yarn.lock @@ -9,13 +9,6 @@ dependencies: "@jridgewell/trace-mapping" "^0.3.0" -"@babel/code-frame@7.12.11": - version "7.12.11" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" - integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== - dependencies: - "@babel/highlight" "^7.10.4" - "@babel/code-frame@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" @@ -2690,19 +2683,19 @@ dependencies: "@types/hammerjs" "^2.0.36" -"@eslint/eslintrc@^0.4.3": - version "0.4.3" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" - integrity sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw== +"@eslint/eslintrc@^1.2.3": + version "1.2.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.2.3.tgz#fcaa2bcef39e13d6e9e7f6271f4cc7cae1174886" + integrity sha512-uGo44hIwoLGNyduRpjdEpovcbMdd+Nv7amtmJxnKmI8xj6yd5LncmSwDa5NgX/41lIFJtkjD6YdVfgEzPfJ5UA== dependencies: ajv "^6.12.4" - debug "^4.1.1" - espree "^7.3.0" + debug "^4.3.2" + espree "^9.3.2" globals "^13.9.0" - ignore "^4.0.6" + ignore "^5.2.0" import-fresh "^3.2.1" - js-yaml "^3.13.1" - minimatch "^3.0.4" + js-yaml "^4.1.0" + minimatch "^3.1.2" strip-json-comments "^3.1.1" "@expo/config-plugins@1.0.33", "@expo/config-plugins@^1.0.18": @@ -2867,16 +2860,16 @@ dependencies: "@hapi/hoek" "^9.0.0" -"@humanwhocodes/config-array@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9" - integrity sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg== +"@humanwhocodes/config-array@^0.9.2": + version "0.9.5" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.9.5.tgz#2cbaf9a89460da24b5ca6531b8bbfc23e1df50c7" + integrity sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw== dependencies: - "@humanwhocodes/object-schema" "^1.2.0" + "@humanwhocodes/object-schema" "^1.2.1" debug "^4.1.1" minimatch "^3.0.4" -"@humanwhocodes/object-schema@^1.2.0": +"@humanwhocodes/object-schema@^1.2.1": version "1.2.1" resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== @@ -4078,21 +4071,26 @@ acorn-globals@^6.0.0: acorn "^7.1.1" acorn-walk "^7.1.1" -acorn-jsx@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" - integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn-walk@^7.1.1: version "7.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== -acorn@^7.1.1, acorn@^7.4.0: +acorn@^7.1.1: version "7.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== +acorn@^8.7.1: + version "8.7.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30" + integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A== + ajv@^6.10.0, ajv@^6.12.4, ajv@^6.5.5: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" @@ -4103,25 +4101,10 @@ ajv@^6.10.0, ajv@^6.12.4, ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^8.0.1: - version "8.10.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.10.0.tgz#e573f719bd3af069017e3b66538ab968d040e54d" - integrity sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw== - dependencies: - fast-deep-equal "^3.1.1" - json-schema-traverse "^1.0.0" - require-from-string "^2.0.2" - uri-js "^4.2.2" - anser@^1.4.9: version "1.4.9" resolved "https://registry.yarnpkg.com/anser/-/anser-1.4.9.tgz#1f85423a5dcf8da4631a341665ff675b96845760" -ansi-colors@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" - integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== - ansi-escapes@^4.2.1: version "4.3.1" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.1.tgz#a5c47cc43181f1f38ffd7076837700d395522a61" @@ -4196,6 +4179,11 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" @@ -4286,11 +4274,6 @@ astral-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" -astral-regex@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" - integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== - async-limiter@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" @@ -5285,12 +5268,19 @@ debug@^3.1.0: dependencies: ms "2.0.0" -debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: +debug@^4.1.0, debug@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" dependencies: ms "^2.1.1" +debug@^4.3.2: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -5553,13 +5543,6 @@ end-of-stream@^1.1.0: dependencies: once "^1.4.0" -enquirer@^2.3.5: - version "2.3.6" - resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" - integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== - dependencies: - ansi-colors "^4.1.1" - entities@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5" @@ -5744,89 +5727,91 @@ eslint-scope@^5.0.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-scope@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" - integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== +eslint-scope@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" + integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== dependencies: esrecurse "^4.3.0" - estraverse "^4.1.1" + estraverse "^5.2.0" -eslint-utils@^2.0.0, eslint-utils@^2.1.0: +eslint-utils@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== dependencies: eslint-visitor-keys "^1.1.0" +eslint-utils@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" + integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== + dependencies: + eslint-visitor-keys "^2.0.0" + eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" -eslint-visitor-keys@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" - integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== - eslint-visitor-keys@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== -eslint@^7.32.0: - version "7.32.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" - integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA== +eslint-visitor-keys@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" + integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== + +eslint@^8.12.0: + version "8.15.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.15.0.tgz#fea1d55a7062da48d82600d2e0974c55612a11e9" + integrity sha512-GG5USZ1jhCu8HJkzGgeK8/+RGnHaNYZGrGDzUtigK3BsGESW/rs2az23XqE0WVwDxy1VRvvjSSGu5nB0Bu+6SA== dependencies: - "@babel/code-frame" "7.12.11" - "@eslint/eslintrc" "^0.4.3" - "@humanwhocodes/config-array" "^0.5.0" + "@eslint/eslintrc" "^1.2.3" + "@humanwhocodes/config-array" "^0.9.2" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" - debug "^4.0.1" + debug "^4.3.2" doctrine "^3.0.0" - enquirer "^2.3.5" escape-string-regexp "^4.0.0" - eslint-scope "^5.1.1" - eslint-utils "^2.1.0" - eslint-visitor-keys "^2.0.0" - espree "^7.3.1" + eslint-scope "^7.1.1" + eslint-utils "^3.0.0" + eslint-visitor-keys "^3.3.0" + espree "^9.3.2" esquery "^1.4.0" esutils "^2.0.2" fast-deep-equal "^3.1.3" file-entry-cache "^6.0.1" functional-red-black-tree "^1.0.1" - glob-parent "^5.1.2" + glob-parent "^6.0.1" globals "^13.6.0" - ignore "^4.0.6" + ignore "^5.2.0" import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" - js-yaml "^3.13.1" + js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" lodash.merge "^4.6.2" - minimatch "^3.0.4" + minimatch "^3.1.2" natural-compare "^1.4.0" optionator "^0.9.1" - progress "^2.0.0" - regexpp "^3.1.0" - semver "^7.2.1" - strip-ansi "^6.0.0" + regexpp "^3.2.0" + strip-ansi "^6.0.1" strip-json-comments "^3.1.0" - table "^6.0.9" text-table "^0.2.0" v8-compile-cache "^2.0.3" -espree@^7.3.0, espree@^7.3.1: - version "7.3.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" - integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== +espree@^9.3.2: + version "9.3.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.3.2.tgz#f58f77bd334731182801ced3380a8cc859091596" + integrity sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA== dependencies: - acorn "^7.4.0" - acorn-jsx "^5.3.1" - eslint-visitor-keys "^1.3.0" + acorn "^8.7.1" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.3.0" esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0: version "4.0.1" @@ -6480,12 +6465,12 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" -glob-parent@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== +glob-parent@^6.0.1: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== dependencies: - is-glob "^4.0.1" + is-glob "^4.0.3" glob-to-regexp@^0.4.0: version "0.4.1" @@ -6749,14 +6734,15 @@ ieee754@^1.1.13: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore@^4.0.6: - version "4.0.6" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" - ignore@^5.0.5: version "5.1.4" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" +ignore@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" + integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== + image-size@^0.6.0: version "0.6.3" resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.6.3.tgz#e7e5c65bb534bd7cdcedd6cb5166272a85f75fb2" @@ -6999,6 +6985,13 @@ is-glob@^4.0.0, is-glob@^4.0.1: dependencies: is-extglob "^2.1.1" +is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + is-interactive@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" @@ -7878,6 +7871,13 @@ js-yaml@^3.13.1, js-yaml@^3.9.0: argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -7966,11 +7966,6 @@ json-schema-traverse@^0.4.1: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== -json-schema-traverse@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" - integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== - json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" @@ -8208,11 +8203,6 @@ lodash.throttle@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" -lodash.truncate@^4.4.2: - version "4.4.2" - resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" - integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= - lodash@^4.17.10, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.5: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" @@ -8767,6 +8757,13 @@ min-document@^2.19.0: dependencies: brace-expansion "^1.1.7" +minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" @@ -8809,7 +8806,7 @@ ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" -ms@^2.1.1: +ms@2.1.2, ms@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -9500,6 +9497,11 @@ prettier@^2.0.2: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== +prettier@^2.6.1: + version "2.6.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.2.tgz#e26d71a18a74c3d0f0597f55f01fb6c06c206032" + integrity sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew== + pretty-format@^26.4.0, pretty-format@^26.5.2, pretty-format@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93" @@ -9533,10 +9535,6 @@ process@^0.11.10: resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= -progress@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" - promise-polyfill@^6.0.1: version "6.1.0" resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-6.1.0.tgz#dfa96943ea9c121fca4de9b5868cb39d3472e057" @@ -9968,11 +9966,16 @@ regexp.prototype.flags@^1.3.0: call-bind "^1.0.2" define-properties "^1.1.3" -regexpp@^3.0.0, regexpp@^3.1.0: +regexpp@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== +regexpp@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" + integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== + regexpu-core@^4.1.3: version "4.2.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.2.0.tgz#a3744fa03806cffe146dea4421a3e73bdcc47b1d" @@ -10328,7 +10331,7 @@ semver@^7.0.0: dependencies: lru-cache "^6.0.0" -semver@^7.2.1, semver@^7.3.2: +semver@^7.3.2: version "7.3.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97" integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== @@ -10510,15 +10513,6 @@ slice-ansi@^2.0.0: astral-regex "^1.0.0" is-fullwidth-code-point "^2.0.0" -slice-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" - integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== - dependencies: - ansi-styles "^4.0.0" - astral-regex "^2.0.0" - is-fullwidth-code-point "^3.0.0" - slugify@^1.3.4: version "1.5.3" resolved "https://registry.yarnpkg.com/slugify/-/slugify-1.5.3.tgz#36e009864f5476bfd5db681222643d92339c890d" @@ -10709,15 +10703,6 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" -string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string.prototype.matchall@^4.0.2: version "4.0.3" resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.3.tgz#24243399bc31b0a49d19e2b74171a15653ec996a" @@ -10857,17 +10842,6 @@ symbol-tree@^3.2.4: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== -table@^6.0.9: - version "6.8.0" - resolved "https://registry.yarnpkg.com/table/-/table-6.8.0.tgz#87e28f14fa4321c3377ba286f07b79b281a3b3ca" - integrity sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA== - dependencies: - ajv "^8.0.1" - lodash.truncate "^4.4.2" - slice-ansi "^4.0.0" - string-width "^4.2.3" - strip-ansi "^6.0.1" - tail@^2.0.0: version "2.2.3" resolved "https://registry.yarnpkg.com/tail/-/tail-2.2.3.tgz#3e6bf65963bb868913e4e3b770cc1584c9d8091c" diff --git a/FabricExample/.prettierrc.js b/FabricExample/.prettierrc.js deleted file mode 100644 index 2b540746a75..00000000000 --- a/FabricExample/.prettierrc.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - arrowParens: 'avoid', - bracketSameLine: true, - bracketSpacing: false, - singleQuote: true, - trailingComma: 'all', -}; diff --git a/FabricExample/.prettierrc.json b/FabricExample/.prettierrc.json new file mode 100644 index 00000000000..792c8d89e60 --- /dev/null +++ b/FabricExample/.prettierrc.json @@ -0,0 +1,9 @@ +{ + "bracketSameLine": true, + "printWidth": 80, + "tabWidth": 2, + "semi": true, + "singleQuote": true, + "trailingComma": "es5", + "quoteProps": "consistent" +} diff --git a/FabricExample/App.js b/FabricExample/App.js deleted file mode 100644 index f85f38d87ad..00000000000 --- a/FabricExample/App.js +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Sample React Native App - * https://github.com/facebook/react-native - * - * @format - * @flow strict-local - */ - -import React from 'react'; -import type {Node} from 'react'; -import { - SafeAreaView, - ScrollView, - StatusBar, - StyleSheet, - Text, - useColorScheme, - View, -} from 'react-native'; - -import { - Colors, - DebugInstructions, - Header, - LearnMoreLinks, - ReloadInstructions, -} from 'react-native/Libraries/NewAppScreen'; - -const Section = ({children, title}): Node => { - const isDarkMode = useColorScheme() === 'dark'; - return ( - - - {title} - - - {children} - - - ); -}; - -const App: () => Node = () => { - const isDarkMode = useColorScheme() === 'dark'; - - const backgroundStyle = { - backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, - }; - - return ( - - - -
- -
- Edit App.js to change this - screen and then come back to see your edits. -
-
- -
-
- -
-
- Read the docs to discover what to do next: -
- -
- - - ); -}; - -const styles = StyleSheet.create({ - sectionContainer: { - marginTop: 32, - paddingHorizontal: 24, - }, - sectionTitle: { - fontSize: 24, - fontWeight: '600', - }, - sectionDescription: { - marginTop: 8, - fontSize: 18, - fontWeight: '400', - }, - highlight: { - fontWeight: '700', - }, -}); - -export default App; diff --git a/FabricExample/App.tsx b/FabricExample/App.tsx new file mode 100644 index 00000000000..064929e7531 --- /dev/null +++ b/FabricExample/App.tsx @@ -0,0 +1,248 @@ +import { + FlatList, + Platform, + ScrollView, + StyleSheet, + Text, + TouchableNativeFeedback, + View, +} from 'react-native'; +import { NavigationContainer, useNavigation } from '@react-navigation/native'; + +import AnimatedSensorExample from './src/AnimatedSensorExample'; +import AnimatedTextInputExample from './src/AnimatedTextInputExample'; +import AnimatedTextWidthExample from './src/AnimatedTextWidthExample'; +import BokehExample from './src/BokehExample'; +import BouncingBoxExample from './src/BouncingBoxExample'; +import BubblesExample from './src/BubblesExample'; +import ChessboardExample from './src/ChessboardExample'; +import ColorExample from './src/ColorExample'; +import EmptyExample from './src/EmptyExample'; +import GestureHandlerExample from './src/GestureHandlerExample'; +import MeasureExample from './src/MeasureExample'; +import NewestShadowNodesRegistryRemoveExample from './src/NewestShadowNodesRegistryRemoveExample'; +import React from 'react'; +import { RectButton } from 'react-native-gesture-handler'; +import RefExample from './src/RefExample'; +import ScreenStackExample from './src/ScreenStackExample'; +import ScreenStackHeaderConfigBackgroundColorExample from './src/ScreenStackHeaderConfigBackgroundColorExample'; +import ScrollToExample from './src/ScrollToExample'; +import ScrollViewExample from './src/ScrollViewExample'; +import TransformExample from './src/TransformExample'; +import WidthExample from './src/WidthExample'; +import WorkletExample from './src/WorkletExample'; +import { createNativeStackNavigator } from '@react-navigation/native-stack'; + +const EXAMPLES = [ + { + name: 'AnimatedTextInputExample', + icon: '🎰', + title: 'Animated.TextInput value', + component: AnimatedTextInputExample, + }, + { + name: 'AnimatedTextWidthExample', + icon: '✂️', + title: 'Animated.Text width', + component: AnimatedTextWidthExample, + }, + { + name: 'BokehExample', + icon: '✨', + title: 'Bokeh', + component: BokehExample, + }, + { + name: 'BubblesExample', + icon: '🫧', + title: 'Bubbles', + component: BubblesExample, + }, + { + name: 'ColorExample', + icon: '🌈', + title: 'Colors', + component: ColorExample, + }, + { + name: 'ScreenStackHeaderConfigBackgroundColorExample', + icon: '🎨', + title: 'Screen header background color', + component: ScreenStackHeaderConfigBackgroundColorExample, + }, + { + name: 'ScreenStackExample', + icon: '🥞', + title: 'Screen stack', + component: ScreenStackExample, + }, + { + name: 'GestureHandlerExample', + icon: '👌', + title: 'Draggable circle', + component: GestureHandlerExample, + }, + { + name: 'BouncingBoxExample', + icon: '📦', + title: 'Bouncing box', + component: BouncingBoxExample, + }, + { + name: 'AnimatedSensorExample', + icon: '📡', + title: 'useAnimatedSensor', + component: AnimatedSensorExample, + }, + { + name: 'ScrollViewExample', + icon: '📜', + title: 'useAnimatedScrollHandler', + component: ScrollViewExample, + }, + { + name: 'ScrollToExample', + icon: '🦘', + title: 'scrollTo', + component: ScrollToExample, + }, + { + name: 'MeasureExample', + icon: '📐', + title: 'measure', + component: MeasureExample, + }, + { + name: 'WorkletExample', + icon: '🧵', + title: 'runOnJS / runOnUI', + component: WorkletExample, + }, + { + name: 'TransformExample', + icon: '🔄', + title: 'Transform', + component: TransformExample, + }, + { + name: 'WidthExample', + icon: '🌲', + title: 'Layout props', + component: WidthExample, + }, + { + name: 'RefExample', + icon: '🦑', + title: 'forwardRef & useImperativeHandle', + component: RefExample, + }, + { + name: 'ChessboardExample', + icon: '♟️', + title: 'Chessboard', + component: ChessboardExample, + }, + { + name: 'NewestShadowNodesRegistryRemoveExample', + icon: '🌓', + title: 'Conditional', + component: NewestShadowNodesRegistryRemoveExample, + }, + { + name: 'EmptyExample', + icon: '👻', + title: 'Empty', + component: EmptyExample, + }, +]; + +function HomeScreen() { + const navigation = useNavigation(); + + return ( + ( + navigation.navigate(item.name)} + /> + )} + renderScrollComponent={(props) => } + /> + ); +} + +function Item({ title, onPress }) { + if (Platform.OS === 'android') { + // RectButton doesn't work quite well on Android yet, + // so let's temporarily use React Native's TouchableNativeFeedback. + return ( + + + {title} + + + ); + } else { + return ( + + {title} + + ); + } +} + +function ItemSeparator() { + return ; +} + +const Stack = createNativeStackNavigator(); + +export default function App() { + // return ; + + return ( + + + + {EXAMPLES.map(({ name, title, component }) => ( + + ))} + + + ); +} + +export const styles = StyleSheet.create({ + list: { + backgroundColor: '#EFEFF4', + }, + separator: { + height: 1, + backgroundColor: '#DBDBE0', + }, + button: { + flex: 1, + height: 60, + padding: 15, + flexDirection: 'row', + alignItems: 'center', + backgroundColor: 'white', + }, + title: { + fontSize: 16, + backgroundColor: 'transparent', + }, +}); diff --git a/FabricExample/Gemfile.lock b/FabricExample/Gemfile.lock new file mode 100644 index 00000000000..640d2f1ed14 --- /dev/null +++ b/FabricExample/Gemfile.lock @@ -0,0 +1,100 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.5) + rexml + activesupport (6.1.4.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) + atomos (0.1.3) + claide (1.1.0) + cocoapods (1.11.2) + addressable (~> 2.8) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.11.2) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.4.0, < 2.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.4.0, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.8.0) + nap (~> 1.0) + ruby-macho (>= 1.0, < 3.0) + xcodeproj (>= 1.21.0, < 2.0) + cocoapods-core (1.11.2) + activesupport (>= 5.0, < 7) + addressable (~> 2.8) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + netrc (~> 0.11) + public_suffix (~> 4.0) + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.5) + cocoapods-downloader (1.5.1) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.1) + cocoapods-trunk (1.6.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.2.0) + colored2 (3.1.2) + concurrent-ruby (1.1.9) + escape (0.0.4) + ethon (0.15.0) + ffi (>= 1.15.0) + ffi (1.15.5) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + httpclient (2.8.3) + i18n (1.10.0) + concurrent-ruby (~> 1.0) + json (2.6.1) + minitest (5.15.0) + molinillo (0.8.0) + nanaimo (0.3.0) + nap (1.1.0) + netrc (0.11.0) + public_suffix (4.0.6) + rexml (3.2.5) + ruby-macho (2.5.1) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) + xcodeproj (1.21.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + zeitwerk (2.5.4) + +PLATFORMS + ruby + +DEPENDENCIES + cocoapods (~> 1.11, >= 1.11.2) + +RUBY VERSION + ruby 2.7.4p191 + +BUNDLED WITH + 2.2.27 diff --git a/FabricExample/README.md b/FabricExample/README.md new file mode 100644 index 00000000000..ac364145261 --- /dev/null +++ b/FabricExample/README.md @@ -0,0 +1,19 @@ +# React Native Reanimated example app with Fabric + +## Installing & running application + +Before running application you need to install all dependencies. To do that: +- In project's root directory run `yarn install` +- In FabricExample directory run `yarn install` + +### Android + +To run this application on Android you need to have Java 11 active on your computer. You can check which version you are using by running `javac --version`. You can change it by changing `JAVA_HOME` environment variable or in Android Studio settings. + +Then you can run this application by `yarn android` or from Android Studio. + +### iOS + +To run on iOS first go to `FabricExample/ios` and run `pod install`. This will install pods for Fabric architecture. + +Then in `FabricExample` run `yarn ios` or run application from Xcode. diff --git a/FabricExample/android/app/build.gradle b/FabricExample/android/app/build.gradle index 23339722c11..cc791b18aec 100644 --- a/FabricExample/android/app/build.gradle +++ b/FabricExample/android/app/build.gradle @@ -78,7 +78,7 @@ import com.android.build.OutputFile */ project.ext.react = [ - enableHermes: false, // clean and rebuild if changing + enableHermes: true, // clean and rebuild if changing ] apply from: "../../node_modules/react-native/react.gradle" diff --git a/FabricExample/android/build.gradle b/FabricExample/android/build.gradle index a53bfbfd50d..b3ccdc7ae3a 100644 --- a/FabricExample/android/build.gradle +++ b/FabricExample/android/build.gradle @@ -8,6 +8,7 @@ buildscript { minSdkVersion = 21 compileSdkVersion = 31 targetSdkVersion = 31 + kotlinVersion = "1.6.21" // for react-native-screens if (System.properties['os.arch'] == "aarch64") { // For M1 Users we need to use the NDK 24 which added support for aarch64 diff --git a/FabricExample/android/gradle.properties b/FabricExample/android/gradle.properties index fa4feae5f19..ac336f33972 100644 --- a/FabricExample/android/gradle.properties +++ b/FabricExample/android/gradle.properties @@ -37,4 +37,4 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 # your application. You should enable this flag either if you want # to write custom TurboModules/Fabric components OR use libraries that # are providing them. -newArchEnabled=false +newArchEnabled=true diff --git a/FabricExample/babel.config.js b/FabricExample/babel.config.js index f842b77fcfb..9fdec29821e 100644 --- a/FabricExample/babel.config.js +++ b/FabricExample/babel.config.js @@ -1,3 +1,4 @@ module.exports = { presets: ['module:metro-react-native-babel-preset'], + plugins: ['../plugin.js'], }; diff --git a/FabricExample/ios/FabricExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/FabricExample/ios/FabricExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000000..18d981003d6 --- /dev/null +++ b/FabricExample/ios/FabricExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/FabricExample/ios/Podfile b/FabricExample/ios/Podfile index dae197df435..e466fc50ffd 100644 --- a/FabricExample/ios/Podfile +++ b/FabricExample/ios/Podfile @@ -1,6 +1,8 @@ require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' +ENV['RCT_NEW_ARCH_ENABLED'] = '1' + platform :ios, '12.4' install! 'cocoapods', :deterministic_uuids => false diff --git a/FabricExample/ios/Podfile.lock b/FabricExample/ios/Podfile.lock index 54e68a21b2a..7a5bf0a0515 100644 --- a/FabricExample/ios/Podfile.lock +++ b/FabricExample/ios/Podfile.lock @@ -73,6 +73,7 @@ PODS: - FlipperKit/FlipperKitNetworkPlugin - fmt (6.2.1) - glog (0.3.5) + - hermes-engine (0.11.0) - libevent (2.1.12) - OpenSSL-Universal (1.1.1100) - RCT-Folly (2021.06.28.00-v2): @@ -86,6 +87,17 @@ PODS: - DoubleConversion - fmt (~> 6.2.1) - glog + - RCT-Folly/Fabric (2021.06.28.00-v2): + - boost + - DoubleConversion + - fmt (~> 6.2.1) + - glog + - RCT-Folly/Futures (2021.06.28.00-v2): + - boost + - DoubleConversion + - fmt (~> 6.2.1) + - glog + - libevent - RCTRequired (0.69.0-rc.0) - RCTTypeSafety (0.69.0-rc.0): - FBLazyVector (= 0.69.0-rc.0) @@ -114,8 +126,10 @@ PODS: - RCTRequired (= 0.69.0-rc.0) - RCTTypeSafety (= 0.69.0-rc.0) - React-Core (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) - React-jsi (= 0.69.0-rc.0) - React-jsiexecutor (= 0.69.0-rc.0) + - React-rncore (= 0.69.0-rc.0) - ReactCommon/turbomodule/core (= 0.69.0-rc.0) - React-Core (0.69.0-rc.0): - glog @@ -263,6 +277,328 @@ PODS: - React-logger (= 0.69.0-rc.0) - React-perflogger (= 0.69.0-rc.0) - React-runtimeexecutor (= 0.69.0-rc.0) + - React-Fabric (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-Fabric/animations (= 0.69.0-rc.0) + - React-Fabric/attributedstring (= 0.69.0-rc.0) + - React-Fabric/butter (= 0.69.0-rc.0) + - React-Fabric/componentregistry (= 0.69.0-rc.0) + - React-Fabric/componentregistrynative (= 0.69.0-rc.0) + - React-Fabric/components (= 0.69.0-rc.0) + - React-Fabric/config (= 0.69.0-rc.0) + - React-Fabric/core (= 0.69.0-rc.0) + - React-Fabric/debug_core (= 0.69.0-rc.0) + - React-Fabric/debug_renderer (= 0.69.0-rc.0) + - React-Fabric/imagemanager (= 0.69.0-rc.0) + - React-Fabric/leakchecker (= 0.69.0-rc.0) + - React-Fabric/mounting (= 0.69.0-rc.0) + - React-Fabric/runtimescheduler (= 0.69.0-rc.0) + - React-Fabric/scheduler (= 0.69.0-rc.0) + - React-Fabric/telemetry (= 0.69.0-rc.0) + - React-Fabric/templateprocessor (= 0.69.0-rc.0) + - React-Fabric/textlayoutmanager (= 0.69.0-rc.0) + - React-Fabric/uimanager (= 0.69.0-rc.0) + - React-Fabric/utils (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/animations (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/attributedstring (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/butter (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/componentregistry (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/componentregistrynative (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-Fabric/components/activityindicator (= 0.69.0-rc.0) + - React-Fabric/components/image (= 0.69.0-rc.0) + - React-Fabric/components/inputaccessory (= 0.69.0-rc.0) + - React-Fabric/components/legacyviewmanagerinterop (= 0.69.0-rc.0) + - React-Fabric/components/modal (= 0.69.0-rc.0) + - React-Fabric/components/root (= 0.69.0-rc.0) + - React-Fabric/components/safeareaview (= 0.69.0-rc.0) + - React-Fabric/components/scrollview (= 0.69.0-rc.0) + - React-Fabric/components/slider (= 0.69.0-rc.0) + - React-Fabric/components/text (= 0.69.0-rc.0) + - React-Fabric/components/textinput (= 0.69.0-rc.0) + - React-Fabric/components/unimplementedview (= 0.69.0-rc.0) + - React-Fabric/components/view (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components/activityindicator (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components/image (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components/inputaccessory (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components/legacyviewmanagerinterop (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components/modal (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components/root (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components/safeareaview (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components/scrollview (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components/slider (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components/text (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components/textinput (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components/unimplementedview (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/components/view (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - Yoga + - React-Fabric/config (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/core (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/debug_core (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/debug_renderer (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/imagemanager (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - React-RCTImage (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/leakchecker (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/mounting (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/runtimescheduler (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/scheduler (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/telemetry (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/templateprocessor (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/textlayoutmanager (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-Fabric/uimanager + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/uimanager (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-Fabric/utils (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.0-rc.0) + - RCTTypeSafety (= 0.69.0-rc.0) + - React-graphics (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-graphics (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - React-Core/Default (= 0.69.0-rc.0) + - React-hermes (0.69.0-rc.0): + - DoubleConversion + - glog + - hermes-engine + - RCT-Folly (= 2021.06.28.00-v2) + - RCT-Folly/Futures (= 2021.06.28.00-v2) + - React-cxxreact (= 0.69.0-rc.0) + - React-jsi (= 0.69.0-rc.0) + - React-jsiexecutor (= 0.69.0-rc.0) + - React-jsinspector (= 0.69.0-rc.0) + - React-perflogger (= 0.69.0-rc.0) - React-jsi (0.69.0-rc.0): - boost (= 1.76.0) - DoubleConversion @@ -274,6 +610,11 @@ PODS: - DoubleConversion - glog - RCT-Folly (= 2021.06.28.00-v2) + - React-jsi/Fabric (0.69.0-rc.0): + - boost (= 1.76.0) + - DoubleConversion + - glog + - RCT-Folly (= 2021.06.28.00-v2) - React-jsiexecutor (0.69.0-rc.0): - DoubleConversion - glog @@ -284,6 +625,29 @@ PODS: - React-jsinspector (0.69.0-rc.0) - React-logger (0.69.0-rc.0): - glog + - react-native-safe-area-context (4.2.5): + - RCT-Folly + - RCTRequired + - RCTTypeSafety + - React + - react-native-safe-area-context/common (= 4.2.5) + - react-native-safe-area-context/fabric (= 4.2.5) + - ReactCommon/turbomodule/core + - react-native-safe-area-context/common (4.2.5): + - RCT-Folly + - RCTRequired + - RCTTypeSafety + - React + - ReactCommon/turbomodule/core + - react-native-safe-area-context/fabric (4.2.5): + - RCT-Folly + - RCTRequired + - RCTTypeSafety + - React + - React-Codegen + - react-native-safe-area-context/common + - React-RCTFabric + - ReactCommon/turbomodule/core - React-perflogger (0.69.0-rc.0) - React-RCTActionSheet (0.69.0-rc.0): - React-Core/RCTActionSheetHeaders (= 0.69.0-rc.0) @@ -302,6 +666,11 @@ PODS: - React-jsi (= 0.69.0-rc.0) - React-RCTNetwork (= 0.69.0-rc.0) - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-RCTFabric (0.69.0-rc.0): + - RCT-Folly/Fabric (= 2021.06.28.00-v2) + - React-Core (= 0.69.0-rc.0) + - React-Fabric (= 0.69.0-rc.0) + - React-RCTImage (= 0.69.0-rc.0) - React-RCTImage (0.69.0-rc.0): - RCT-Folly (= 2021.06.28.00-v2) - RCTTypeSafety (= 0.69.0-rc.0) @@ -337,6 +706,7 @@ PODS: - React-Core/RCTVibrationHeaders (= 0.69.0-rc.0) - React-jsi (= 0.69.0-rc.0) - ReactCommon/turbomodule/core (= 0.69.0-rc.0) + - React-rncore (0.69.0-rc.0) - React-runtimeexecutor (0.69.0-rc.0): - React-jsi (= 0.69.0-rc.0) - ReactCommon/turbomodule/core (0.69.0-rc.0): @@ -350,6 +720,60 @@ PODS: - React-jsi (= 0.69.0-rc.0) - React-logger (= 0.69.0-rc.0) - React-perflogger (= 0.69.0-rc.0) + - RNGestureHandler (2.4.2): + - RCT-Folly (= 2021.06.28.00-v2) + - RCTRequired + - RCTTypeSafety + - React + - React-Codegen + - React-RCTFabric + - ReactCommon/turbomodule/core + - RNReanimated (3.0.0-rc.0): + - DoubleConversion + - FBLazyVector + - FBReactNativeSpec + - glog + - RCT-Folly (= 2021.06.28.00-v2) + - RCTRequired + - RCTTypeSafety + - React-callinvoker + - React-Codegen + - React-Core + - React-Core/DevSupport + - React-Core/RCTWebSocket + - React-CoreModules + - React-cxxreact + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-RCTActionSheet + - React-RCTAnimation + - React-RCTBlob + - React-RCTFabric + - React-RCTImage + - React-RCTLinking + - React-RCTNetwork + - React-RCTSettings + - React-RCTText + - ReactCommon/turbomodule/core + - Yoga + - RNScreens (3.13.1): + - RCT-Folly (= 2021.06.28.00-v2) + - RCTRequired + - RCTTypeSafety + - React + - React-Codegen + - React-RCTFabric + - ReactCommon/turbomodule/core + - RNScreens/common (= 3.13.1) + - RNScreens/common (3.13.1): + - RCT-Folly (= 2021.06.28.00-v2) + - RCTRequired + - RCTTypeSafety + - React + - React-Codegen + - React-RCTFabric + - ReactCommon/turbomodule/core - SocketRocket (0.6.0) - Yoga (1.14.0) - YogaKit (1.18.1): @@ -382,8 +806,11 @@ DEPENDENCIES: - FlipperKit/FlipperKitUserDefaultsPlugin (= 0.125.0) - FlipperKit/SKIOSNetworkPlugin (= 0.125.0) - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) + - hermes-engine (from `../node_modules/react-native/sdks/hermes/hermes-engine.podspec`) + - libevent (~> 2.1.12) - OpenSSL-Universal (= 1.1.1100) - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) + - RCT-Folly/Fabric (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) - React (from `../node_modules/react-native/`) @@ -395,22 +822,32 @@ DEPENDENCIES: - React-Core/RCTWebSocket (from `../node_modules/react-native/`) - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) + - React-Fabric (from `../node_modules/react-native/ReactCommon`) + - React-graphics (from `../node_modules/react-native/ReactCommon/react/renderer/graphics`) + - React-hermes (from `../node_modules/react-native/ReactCommon/hermes`) - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) + - React-jsi/Fabric (from `../node_modules/react-native/ReactCommon/jsi`) - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) - React-logger (from `../node_modules/react-native/ReactCommon/logger`) + - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`) - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) + - React-RCTFabric (from `../node_modules/react-native/React`) - React-RCTImage (from `../node_modules/react-native/Libraries/Image`) - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) - React-RCTText (from `../node_modules/react-native/Libraries/Text`) - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) + - React-rncore (from `../node_modules/react-native/ReactCommon`) - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) + - RNGestureHandler (from `../node_modules/react-native-gesture-handler`) + - RNReanimated (from `../..`) + - RNScreens (from `../node_modules/react-native-screens`) - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) SPEC REPOS: @@ -442,6 +879,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/React/FBReactNativeSpec" glog: :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" + hermes-engine: + :path: "../node_modules/react-native/sdks/hermes/hermes-engine.podspec" RCT-Folly: :podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" RCTRequired: @@ -462,6 +901,12 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/React/CoreModules" React-cxxreact: :path: "../node_modules/react-native/ReactCommon/cxxreact" + React-Fabric: + :path: "../node_modules/react-native/ReactCommon" + React-graphics: + :path: "../node_modules/react-native/ReactCommon/react/renderer/graphics" + React-hermes: + :path: "../node_modules/react-native/ReactCommon/hermes" React-jsi: :path: "../node_modules/react-native/ReactCommon/jsi" React-jsiexecutor: @@ -470,6 +915,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/jsinspector" React-logger: :path: "../node_modules/react-native/ReactCommon/logger" + react-native-safe-area-context: + :path: "../node_modules/react-native-safe-area-context" React-perflogger: :path: "../node_modules/react-native/ReactCommon/reactperflogger" React-RCTActionSheet: @@ -478,6 +925,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/Libraries/NativeAnimation" React-RCTBlob: :path: "../node_modules/react-native/Libraries/Blob" + React-RCTFabric: + :path: "../node_modules/react-native/React" React-RCTImage: :path: "../node_modules/react-native/Libraries/Image" React-RCTLinking: @@ -490,10 +939,18 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/Libraries/Text" React-RCTVibration: :path: "../node_modules/react-native/Libraries/Vibration" + React-rncore: + :path: "../node_modules/react-native/ReactCommon" React-runtimeexecutor: :path: "../node_modules/react-native/ReactCommon/runtimeexecutor" ReactCommon: :path: "../node_modules/react-native/ReactCommon" + RNGestureHandler: + :path: "../node_modules/react-native-gesture-handler" + RNReanimated: + :path: "../.." + RNScreens: + :path: "../node_modules/react-native-screens" Yoga: :path: "../node_modules/react-native/ReactCommon/yoga" @@ -502,7 +959,7 @@ SPEC CHECKSUMS: CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 FBLazyVector: b99cb3346bc0db29ef3b9f26238129ae91418ea2 - FBReactNativeSpec: 2ab3e2a82e3604680219aa61f3ee8f2462384959 + FBReactNativeSpec: 3ebcd656e2db52b6f833c5b9d2ba1756fdb9b6eb Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0 Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c Flipper-DoubleConversion: 3d3d04a078d4f3a1b6c6916587f159dc11f232c4 @@ -514,6 +971,7 @@ SPEC CHECKSUMS: FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86 fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 glog: 3d02b25ca00c2d456734d0bcff864cbc62f6ae1a + hermes-engine: 231d0c9a432723593f5a87d36e76037df9a71392 libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c RCT-Folly: 4d8508a426467c48885f1151029bc15fa5d7b3b8 @@ -522,30 +980,39 @@ SPEC CHECKSUMS: React: 85323d4724a0e422e26f7bc50031852d259756d8 React-bridging: 3f19645f2594a8cf51b7f7bce7236ac1fcdb8204 React-callinvoker: 2e50e37f3b8acfef761e99e0c5d29a6ac405ab76 - React-Codegen: d9baab828d2e4edefba089a6a8ace10c46e5276c + React-Codegen: 212377e11ee3c1de83f3a4cc1da42e8a0d90d3e3 React-Core: 62261aaf0e198c9124d2968c3ccfe8eeb95b457b React-CoreModules: e5da64dc1db1eac77d956a736c9fd0d34eb60d99 React-cxxreact: c7523fc0cccb8d581b813d249f10222b9253aab5 + React-Fabric: 305be3389c4440ff3b4825ac8b3ff67bd62c43f5 + React-graphics: 951ada4d4e1588cf854e875844de593ccfef61cb + React-hermes: bfa0434453c06fbce9359a8062295d613ed0be73 React-jsi: b6b28546d9b336ba904593b1ae9df0f4655ef4b5 React-jsiexecutor: 268169e1c5fe99720ae460a46cf3ff838ae7b356 React-jsinspector: 0ccc540558e64184f46f89fb38c71eeedb5599ef React-logger: 05263294a3b1b814eabfa0262e83afc1bb671fbc + react-native-safe-area-context: a9616f1fd257ff31946b518266a62f50dbcb3d5b React-perflogger: f82caf4672545fea50f2d7bed51c8329a2167cbc React-RCTActionSheet: 7ade12a6dd0cd780938fea3d34e5335f853694c2 React-RCTAnimation: 6eb99a3c54c5ebfab4714eb34c1b2d95ae2e6027 React-RCTBlob: 8306ac052e4fc9d1cf9387081a432f68d1921ddc + React-RCTFabric: 1e1ca38bed50b6e271f209e4100ca0bbab52f761 React-RCTImage: b9ea6cd8fee6399f4fc059cf8e586bc810d97376 React-RCTLinking: f6aa965fdfd2255a4987af9d0e64dd155f1c75b5 React-RCTNetwork: 6f9d0b198adbaa417334393306b24c4d855dd396 React-RCTSettings: 3a73a69bc9cf0abdd5ebf48b21aa720408edb6fc React-RCTText: 3554d694cf2f816a652e7c671a73bbbb57e53e4c React-RCTVibration: 6f181c21dbf4f1f8b67580124ef428dba25fb682 + React-rncore: 2b6ce224b88bbb0d624291d5505372cdcc799f31 React-runtimeexecutor: 078762b7835bf03fd11109fb4b505d1f1b70fdc2 ReactCommon: 34dea1fbf479d4cfe4b40bd9310f3d08e5f90943 + RNGestureHandler: ac67226292cd5e67e7203d682a7e39f85d7b88a9 + RNReanimated: 0302eab362af3c4068c3cb5663bede53b7299881 + RNScreens: 592316e0744de3b640e90c335a45aad13088381a SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 Yoga: fbc3321a51479606cd0c676e1a79176f9b5b9ae2 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: 90b9710e84747220f959c565f70085532f535627 +PODFILE CHECKSUM: 5cc367b51a8e533adb079d4bb5d6532252436368 COCOAPODS: 1.11.3 diff --git a/FabricExample/metro.config.js b/FabricExample/metro.config.js index e91aba937cd..70cf06a4e5c 100644 --- a/FabricExample/metro.config.js +++ b/FabricExample/metro.config.js @@ -1,11 +1,32 @@ -/** - * Metro configuration for React Native - * https://github.com/facebook/react-native - * - * @format - */ +const path = require('path'); +const exclusionList = require('metro-config/src/defaults/exclusionList'); +const escape = require('escape-string-regexp'); +const pack = require('../package.json'); + +const root = path.resolve(__dirname, '..'); + +const modules = Object.keys(pack.peerDependencies); module.exports = { + projectRoot: __dirname, + watchFolders: [root], + + // We need to make sure that only one version is loaded for peerDependencies + // So we exclude them at the root, and alias them to the versions in example's node_modules + resolver: { + blacklistRE: exclusionList( + modules.map( + (m) => + new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`) + ) + ), + + extraNodeModules: modules.reduce((acc, name) => { + acc[name] = path.join(__dirname, 'node_modules', name); + return acc; + }, {}), + }, + transformer: { getTransformOptions: async () => ({ transform: { diff --git a/FabricExample/package.json b/FabricExample/package.json index 8cd70bed57d..f578c5bc2c5 100644 --- a/FabricExample/package.json +++ b/FabricExample/package.json @@ -1,5 +1,5 @@ { - "name": "fabricexample", + "name": "FabricExample", "version": "0.0.1", "private": true, "scripts": { @@ -7,21 +7,43 @@ "ios": "react-native run-ios", "start": "react-native start", "test": "jest", - "lint": "eslint ." + "lint": "eslint . --ext .js,.jsx,.ts,.tsx", + "ts-check": "yarn tsc --noEmit", + "lint:js": "yarn eslint src/ && yarn prettier --check src/", + "postinstall": "patch-package && echo 73fa47c9c033e2f1bf10ebab9ac58f02c94ffff9 > ./node_modules/react-native/sdks/.hermesversion" }, "dependencies": { + "@react-navigation/native": "^6.0.10", + "@react-navigation/native-stack": "^6.6.2", "react": "18.0.0", - "react-native": "0.69.0-rc.0" + "react-native": "0.69.0-rc.0", + "react-native-gesture-handler": "^2.4.2", + "react-native-reanimated": "link:../", + "react-native-safe-area-context": "^4.2.5", + "react-native-screens": "software-mansion/react-native-screens#568e588817538740dff23a3590748614d4c346e3" }, "devDependencies": { - "@babel/core": "^7.12.9", - "@babel/runtime": "^7.12.5", - "@react-native-community/eslint-config": "^2.0.0", + "@babel/core": "^7.17.5", + "@babel/preset-env": "^7.1.6", + "@babel/runtime": "^7.17.2", + "@react-native-community/eslint-config": "^3.0.0", + "@types/jest": "^27.4.1", + "@types/react": "^18.0.0", + "@types/react-native": "^0.67.1", + "@types/react-test-renderer": "^18.0.0", "babel-jest": "^26.6.3", - "eslint": "^7.32.0", + "eslint": "^8.12.0", "jest": "^26.6.3", "metro-react-native-babel-preset": "^0.70.1", - "react-test-renderer": "18.0.0" + "patch-package": "^6.4.7", + "prettier": "^2.6.1", + "react-test-renderer": "18.0.0", + "typescript": "^4.6.2" + }, + "resolutions": { + "@typescript-eslint/eslint-plugin": "^5.17.0", + "@typescript-eslint/parser": "^5.17.0", + "eslint-plugin-react-native": "^4.0.0" }, "jest": { "preset": "react-native" diff --git a/FabricExample/patches/react-native-gesture-handler+2.4.2.patch b/FabricExample/patches/react-native-gesture-handler+2.4.2.patch new file mode 100644 index 00000000000..a2324b2162b --- /dev/null +++ b/FabricExample/patches/react-native-gesture-handler+2.4.2.patch @@ -0,0 +1,37 @@ +diff --git a/node_modules/react-native-gesture-handler/android/src/main/jni/Android.mk b/node_modules/react-native-gesture-handler/android/src/main/jni/Android.mk +index 185709b..926b3e7 100644 +--- a/node_modules/react-native-gesture-handler/android/src/main/jni/Android.mk ++++ b/node_modules/react-native-gesture-handler/android/src/main/jni/Android.mk +@@ -28,7 +28,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni + LOCAL_SHARED_LIBRARIES := libjsi \ + libfbjni \ + libglog \ +- libfolly_json \ ++ libfolly_runtime \ + libyoga \ + libreact_nativemodule_core \ + libturbomodulejsijni \ +@@ -36,7 +36,6 @@ LOCAL_SHARED_LIBRARIES := libjsi \ + libreact_render_core \ + libreact_render_graphics \ + libfabricjni \ +- libfolly_futures \ + libreact_debug \ + libreact_render_componentregistry \ + libreact_render_debug \ +diff --git a/node_modules/react-native-gesture-handler/ios/RNGestureHandlerModule.mm b/node_modules/react-native-gesture-handler/ios/RNGestureHandlerModule.mm +index d3d0453..7d3e508 100644 +--- a/node_modules/react-native-gesture-handler/ios/RNGestureHandlerModule.mm ++++ b/node_modules/react-native-gesture-handler/ios/RNGestureHandlerModule.mm +@@ -60,7 +60,10 @@ + (BOOL)requiresMainQueueSetup + + - (void)invalidate + { +- [_manager dropAllGestureHandlers]; ++ RNGestureHandlerManager *handlerManager = _manager; ++ dispatch_async(dispatch_get_main_queue(), ^{ ++ [handlerManager dropAllGestureHandlers]; ++ }); + + _manager = nil; + diff --git a/FabricExample/patches/react-native-safe-area-context+4.2.5.patch b/FabricExample/patches/react-native-safe-area-context+4.2.5.patch new file mode 100644 index 00000000000..7eea719afbc --- /dev/null +++ b/FabricExample/patches/react-native-safe-area-context+4.2.5.patch @@ -0,0 +1,34 @@ +diff --git a/node_modules/react-native-safe-area-context/android/src/main/jni/Android.mk b/node_modules/react-native-safe-area-context/android/src/main/jni/Android.mk +index 6166527..33a7e73 100644 +--- a/node_modules/react-native-safe-area-context/android/src/main/jni/Android.mk ++++ b/node_modules/react-native-safe-area-context/android/src/main/jni/Android.mk +@@ -20,7 +20,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni + LOCAL_SHARED_LIBRARIES := libjsi \ + libfbjni \ + libglog \ +- libfolly_json \ ++ libfolly_runtime \ + libyoga \ + libreact_nativemodule_core \ + libturbomodulejsijni \ +@@ -28,7 +28,6 @@ LOCAL_SHARED_LIBRARIES := libjsi \ + libreact_render_core \ + libreact_render_graphics \ + libfabricjni \ +- libfolly_futures \ + libreact_debug \ + libreact_render_componentregistry \ + libreact_render_debug \ +diff --git a/node_modules/react-native-safe-area-context/common/cpp/Android.mk b/node_modules/react-native-safe-area-context/common/cpp/Android.mk +index a7680a6..69d86d6 100644 +--- a/node_modules/react-native-safe-area-context/common/cpp/Android.mk ++++ b/node_modules/react-native-safe-area-context/common/cpp/Android.mk +@@ -15,7 +15,7 @@ LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(LOCAL_PATH)/reac + + LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/react/renderer/components/safeareacontext + +-LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libfbjni libturbomodulejsijni libreact_codegen_rncore libreact_debug libreact_render_debug libreact_render_mapbuffer libreact_codegen_safeareacontext ++LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_runtime libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libfbjni libturbomodulejsijni libreact_codegen_rncore libreact_debug libreact_render_debug libreact_render_mapbuffer libreact_codegen_safeareacontext + + LOCAL_CFLAGS := \ + -DLOG_TAG=\"ReactNative\" diff --git a/FabricExample/patches/react-native-screens+3.13.1.patch b/FabricExample/patches/react-native-screens+3.13.1.patch new file mode 100644 index 00000000000..48f92c84565 --- /dev/null +++ b/FabricExample/patches/react-native-screens+3.13.1.patch @@ -0,0 +1,55 @@ +diff --git a/node_modules/react-native-screens/android/src/main/jni/Android.mk b/node_modules/react-native-screens/android/src/main/jni/Android.mk +index 914607f..7684d3b 100644 +--- a/node_modules/react-native-screens/android/src/main/jni/Android.mk ++++ b/node_modules/react-native-screens/android/src/main/jni/Android.mk +@@ -20,7 +20,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni + LOCAL_SHARED_LIBRARIES := libjsi \ + libfbjni \ + libglog \ +- libfolly_json \ ++ libfolly_runtime \ + libyoga \ + libreact_nativemodule_core \ + libturbomodulejsijni \ +@@ -28,7 +28,6 @@ LOCAL_SHARED_LIBRARIES := libjsi \ + libreact_render_core \ + libreact_render_graphics \ + libfabricjni \ +- libfolly_futures \ + libreact_debug \ + libreact_render_componentregistry \ + libreact_render_debug \ +diff --git a/node_modules/react-native-screens/common/cpp/Android.mk b/node_modules/react-native-screens/common/cpp/Android.mk +index 3b8afa2..454e4ff 100644 +--- a/node_modules/react-native-screens/common/cpp/Android.mk ++++ b/node_modules/react-native-screens/common/cpp/Android.mk +@@ -15,7 +15,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni + LOCAL_SHARED_LIBRARIES := libjsi \ + libfbjni \ + libglog \ +- libfolly_json \ ++ libfolly_runtime \ + libyoga \ + libreact_nativemodule_core \ + libturbomodulejsijni \ +@@ -23,7 +23,6 @@ LOCAL_SHARED_LIBRARIES := libjsi \ + libreact_render_core \ + libreact_render_graphics \ + libfabricjni \ +- libfolly_futures \ + libreact_debug \ + libreact_render_componentregistry \ + libreact_render_debug \ +diff --git a/node_modules/react-native-screens/ios/RNSScreenStack.mm b/node_modules/react-native-screens/ios/RNSScreenStack.mm +index 5a0e37d..7a5ca3b 100644 +--- a/node_modules/react-native-screens/ios/RNSScreenStack.mm ++++ b/node_modules/react-native-screens/ios/RNSScreenStack.mm +@@ -824,7 +824,7 @@ - (void)takeSnapshot + _snapshot = [_controller.topViewController.view snapshotViewAfterScreenUpdates:NO]; + } + +-- (void)mountingTransactionWillMountWithMetadata:(facebook::react::MountingTransactionMetadata const &)metadata ++- (void)mountingTransactionWillMount:(facebook::react::MountingTransaction const &)transaction + { + [self takeSnapshot]; + } diff --git a/react-native-reanimated-tests.tsx b/FabricExample/react-native-reanimated-tests.tsx similarity index 99% rename from react-native-reanimated-tests.tsx rename to FabricExample/react-native-reanimated-tests.tsx index 34de41c44b7..95703fad63f 100644 --- a/react-native-reanimated-tests.tsx +++ b/FabricExample/react-native-reanimated-tests.tsx @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/ban-ts-comment */ /* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable react-hooks/rules-of-hooks */ import React, { useState, useCallback, forwardRef } from 'react'; import { Text, @@ -54,7 +55,6 @@ import Animated, { SequenceAnimation, StyleLayoutAnimation, Animation, - // eslint-disable-next-line import/no-unresolved } from 'react-native-reanimated'; class Path extends React.Component<{ fill?: string }> { @@ -769,7 +769,7 @@ function updatePropsTest() { // test partial animated props function testPartialAnimatedProps() { const ap = useAnimatedProps(() => ({ - height: 100, + borderRadius: 100, })); const aps = useAnimatedProps(() => ({ source: { uri: 'whatever' }, diff --git a/FabricExample/src/AnimatedSensorExample.tsx b/FabricExample/src/AnimatedSensorExample.tsx new file mode 100644 index 00000000000..099b730e2fc --- /dev/null +++ b/FabricExample/src/AnimatedSensorExample.tsx @@ -0,0 +1,38 @@ +import Animated, { + useAnimatedStyle, + useAnimatedSensor, + SensorType, +} from 'react-native-reanimated'; +import { StyleSheet, View } from 'react-native'; + +import React from 'react'; + +export default function AnimatedSensorExample() { + const gravity = useAnimatedSensor(SensorType.GRAVITY, { interval: 16 }); + + const animatedStyle = useAnimatedStyle(() => { + return { + top: -gravity.sensor.value.y * 300, + left: gravity.sensor.value.x * 200, + }; + }); + + return ( + + + + ); +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + alignItems: 'center', + justifyContent: 'center', + }, + box: { + width: 150, + height: 150, + backgroundColor: 'navy', + }, +}); diff --git a/FabricExample/src/AnimatedTextInputExample.tsx b/FabricExample/src/AnimatedTextInputExample.tsx new file mode 100644 index 00000000000..8bd6903be41 --- /dev/null +++ b/FabricExample/src/AnimatedTextInputExample.tsx @@ -0,0 +1,63 @@ +import Animated, { + useAnimatedProps, + useDerivedValue, + useSharedValue, + withTiming, +} from 'react-native-reanimated'; +import { + Button, + TextInput, + TextInputProps, + StyleSheet, + View, +} from 'react-native'; + +import React from 'react'; + +Animated.addWhitelistedNativeProps({ text: true }); + +const AnimatedTextInput = Animated.createAnimatedComponent(TextInput); + +export default function AnimatedTextInputExample() { + const ref = React.useRef(0); + + const sv = useSharedValue(0); + + const text = useDerivedValue(() => { + return Math.round(sv.value * 100).toString(); + }); + + const animatedProps = useAnimatedProps(() => { + return { text: text.value } as TextInputProps; + }); + + const handleToggle = () => { + ref.current = 1 - ref.current; + sv.value = withTiming(ref.current, { duration: 1000 }); + }; + + return ( + <> + +