Skip to content

Commit 38fbce3

Browse files
committed
Bring back old formatting on Android
1 parent 8c445f6 commit 38fbce3

1 file changed

Lines changed: 32 additions & 32 deletions

File tree

packages/react-native-gesture-handler/android/src/main/jni/cpp-adapter.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,47 @@ using namespace facebook;
77
using namespace react;
88

99
void decorateRuntime(jsi::Runtime &runtime) {
10-
auto isViewFlatteningDisabled = jsi::Function::createFromHostFunction(
11-
runtime,
12-
jsi::PropNameID::forAscii(runtime, "isViewFlatteningDisabled"),
13-
1,
14-
[](jsi::Runtime &runtime,
15-
const jsi::Value &thisValue,
16-
const jsi::Value *arguments,
17-
size_t count) -> jsi::Value {
18-
if (!arguments[0].isObject()) {
19-
return jsi::Value::null();
20-
}
10+
auto isViewFlatteningDisabled = jsi::Function::createFromHostFunction(
11+
runtime,
12+
jsi::PropNameID::forAscii(runtime, "isViewFlatteningDisabled"),
13+
1,
14+
[](jsi::Runtime &runtime,
15+
const jsi::Value &thisValue,
16+
const jsi::Value *arguments,
17+
size_t count) -> jsi::Value {
18+
if (!arguments[0].isObject()) {
19+
return jsi::Value::null();
20+
}
2121

2222
#if REACT_NATIVE_MINOR_VERSION >= 81
23-
auto shadowNode = Bridging<std::shared_ptr<const ShadowNode>>::fromJs(
24-
runtime, arguments[0]);
23+
auto shadowNode = Bridging<std::shared_ptr<const ShadowNode>>::fromJs(
24+
runtime, arguments[0]);
2525
#else
26-
auto shadowNode = shadowNodeFromValue(runtime, arguments[0]);
26+
auto shadowNode = shadowNodeFromValue(runtime, arguments[0]);
2727
#endif
2828

29-
bool isViewFlatteningDisabled = shadowNode->getTraits().check(
30-
ShadowNodeTraits::FormsStackingContext);
29+
bool isViewFlatteningDisabled = shadowNode->getTraits().check(
30+
ShadowNodeTraits::FormsStackingContext);
3131

32-
// This is done using component names instead of type checking because
33-
// of duplicate symbols for RN types, which prevent RTTI from working.
34-
const char *componentName = shadowNode->getComponentName();
35-
bool isTextComponent = strcmp(componentName, "Paragraph") == 0 ||
36-
strcmp(componentName, "Text") == 0;
32+
// This is done using component names instead of type checking because
33+
// of duplicate symbols for RN types, which prevent RTTI from working.
34+
const char *componentName = shadowNode->getComponentName();
35+
bool isTextComponent = strcmp(componentName, "Paragraph") == 0 ||
36+
strcmp(componentName, "Text") == 0;
3737

38-
return jsi::Value(isViewFlatteningDisabled || isTextComponent);
39-
});
40-
runtime.global().setProperty(
41-
runtime, "isViewFlatteningDisabled", std::move(isViewFlatteningDisabled));
38+
return jsi::Value(isViewFlatteningDisabled || isTextComponent);
39+
});
40+
runtime.global().setProperty(
41+
runtime, "isViewFlatteningDisabled", std::move(isViewFlatteningDisabled));
4242
}
4343

4444
extern "C" JNIEXPORT void JNICALL
4545
Java_com_swmansion_gesturehandler_react_RNGestureHandlerModule_decorateRuntime(
46-
JNIEnv *env,
47-
jobject clazz,
48-
jlong jsiPtr) {
49-
jsi::Runtime *runtime = reinterpret_cast<jsi::Runtime *>(jsiPtr);
50-
if (runtime) {
51-
decorateRuntime(*runtime);
52-
}
46+
JNIEnv *env,
47+
jobject clazz,
48+
jlong jsiPtr) {
49+
jsi::Runtime *runtime = reinterpret_cast<jsi::Runtime *>(jsiPtr);
50+
if (runtime) {
51+
decorateRuntime(*runtime);
52+
}
5353
}

0 commit comments

Comments
 (0)