software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.13k stars 982 forks source link

Use of undeclared identifier 'ShadowNodeWrapper'; did you mean 'shadowNodeWrapper'? #3023

Closed neeteshraj closed 3 months ago

neeteshraj commented 3 months ago

Description

I have installed 2.18.0 version of react-native-gesture-handler and i am getting this issue while building the ios app in new architecture enabled.

Use of undeclared identifier 'ShadowNodeWrapper'; did you mean 'shadowNodeWrapper'? Replace 'ShadowNodeWrapper' with 'shadowNodeWrapper' Variable 'shadowNodeWrapper' declared with deduced type 'auto' cannot appear in its own initializer

the error is pointing here.

#ifdef RCT_NEW_ARCH_ENABLED void decorateRuntime(jsi::Runtime &runtime) { auto isFormsStackingContext = jsi::Function::createFromHostFunction( runtime, jsi::PropNameID::forAscii(runtime, "isFormsStackingContext"), 1, [](jsi::Runtime &runtime, const jsi::Value &thisValue, const jsi::Value *arguments, size_t count) -> jsi::Value { if (!arguments[0].isObject()) { return jsi::Value::null(); }

    auto shadowNodeWrapper = arguments[0].asObject(runtime).getNativeState<ShadowNodeWrapper>(runtime);
    bool isFormsStackingContext =
        shadowNodeWrapper->shadowNode->getTraits().check(ShadowNodeTraits::FormsStackingContext);
    return jsi::Value(isFormsStackingContext);
  });

runtime.global().setProperty(runtime, "isFormsStackingContext", std::move(isFormsStackingContext)); }

endif // RCT_NEW_ARCH_ENABLED.

Screenshot 2024-07-31 at 11 36 55 AM

`

Steps to reproduce

  1. Create a new project
  2. Install 2.18.0 version of react-native-gesture handler

Snack or a link to a repository

private repo

Gesture Handler version

2.18.0

React Native version

0.74.4

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

iPhone 15 Pro simulator

Acknowledgements

Yes

github-actions[bot] commented 3 months ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

kbeznisko commented 3 months ago

I have the same error, but for android

> Task :react-native-gesture-handler:buildCMakeDebug[arm64-v8a] FAILED
C/C++: ninja: Entering directory `.../node_modules/react-native-gesture-handler/android/.cxx/Debug/595h5z3f/arm64-v8a'
C/C++: /.../Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android23 --sysroot=/.../Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dgesturehandler_EXPORTS -I.../node_modules/react-native/ReactCommon -isystem /.../.gradle/caches/transforms-4/416a9ce8efc944d4162c98e85215c980/transformed/jetified-react-android-0.74.4-debug/prefab/modules/react_render_core/include -isystem /.../.gradle/caches/transforms-4/416a9ce8efc944d4162c98e85215c980/transformed/jetified-react-android-0.74.4-debug/prefab/modules/react_render_uimanager/include -isystem /.../.gradle/caches/transforms-4/416a9ce8efc944d4162c98e85215c980/transformed/jetified-react-android-0.74.4-debug/prefab/modules/react_render_graphics/include -isystem /.../.gradle/caches/transforms-4/416a9ce8efc944d4162c98e85215c980/transformed/jetified-react-android-0.74.4-debug/prefab/modules/jsi/include -isystem /.../.gradle/caches/transforms-4/416a9ce8efc944d4162c98e85215c980/transformed/jetified-react-android-0.74.4-debug/prefab/modules/react_nativemodule_core/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -O2 -frtti -fexceptions -Wall -Werror -std=c++20 -DANDROID -fno-limit-debug-info  -fPIC -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1 -MD -MT CMakeFiles/gesturehandler.dir/cpp-adapter.cpp.o -MF CMakeFiles/gesturehandler.dir/cpp-adapter.cpp.o.d -o CMakeFiles/gesturehandler.dir/cpp-adapter.cpp.o -c /.../node_modules/react-native-gesture-handler/android/src/main/jni/cpp-adapter.cpp
C/C++: /.../node_modules/react-native-gesture-handler/android/src/main/jni/cpp-adapter.cpp:23:59: error: use of undeclared identifier 'ShadowNodeWrapper'; did you mean 'shadowNodeWrapper'?
C/C++:                         .asObject(runtime).getNativeState<ShadowNodeWrapper>(runtime);
C/C++:                                                           ^~~~~~~~~~~~~~~~~
C/C++:                                                           shadowNodeWrapper
C/C++: /.../node_modules/react-native-gesture-handler/android/src/main/jni/cpp-adapter.cpp:22:22: note: 'shadowNodeWrapper' declared here
C/C++:                 auto shadowNodeWrapper = arguments[0]
C/C++:                      ^
C/C++: /.../node_modules/react-native-gesture-handler/android/src/main/jni/cpp-adapter.cpp:23:59: error: variable 'shadowNodeWrapper' declared with deduced type 'auto' cannot appear in its own initializer
C/C++:                         .asObject(runtime).getNativeState<ShadowNodeWrapper>(runtime);
C/C++:                                                           ^
C/C++: 2 errors generated.
denysoleksiienko commented 3 months ago

same with 2.18.0 version

m-bert commented 3 months ago

Hi! Thanks for reporting this issue, could you please check if #3024 helps?