Skip to content

Commit 7ad892b

Browse files
committed
[DRAFT] fix: new arch measurements
1 parent 166ec7f commit 7ad892b

File tree

12 files changed

+223
-12
lines changed

12 files changed

+223
-12
lines changed

package/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ android {
5555
sourceSets {
5656
main {
5757
if (isNewArchitectureEnabled()) {
58-
java.srcDirs += ['src/newarch']
58+
java.srcDirs += ['src/newarch', "${project.buildDir}/generated/source/codegen/java"]
5959
} else {
6060
java.srcDirs += ['src/oldarch']
6161
}
@@ -76,7 +76,7 @@ dependencies {
7676
if (isNewArchitectureEnabled()) {
7777
react {
7878
jsRootDir = file("../src")
79-
libraryName = "ReactSlider"
79+
libraryName = "RNCSlider"
8080
codegenJavaPackageName = "com.reactnativecommunity.slider"
8181
}
8282
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
set(CMAKE_VERBOSE_MAKEFILE ON)
3+
4+
set(LIB_LITERAL RNCSlider)
5+
set(LIB_TARGET_NAME react_codegen_${LIB_LITERAL})
6+
7+
set(LIB_ANDROID_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
8+
set(LIB_COMMON_DIR ${LIB_ANDROID_DIR}/../common/cpp)
9+
set(LIB_ANDROID_GENERATED_JNI_DIR ${LIB_ANDROID_DIR}/build/generated/source/codegen/jni)
10+
set(LIB_ANDROID_GENERATED_COMPONENTS_DIR ${LIB_ANDROID_GENERATED_JNI_DIR}/react/renderer/components/${LIB_LITERAL})
11+
12+
add_compile_options(
13+
-fexceptions
14+
-frtti
15+
-std=c++20
16+
-Wall
17+
-Wpedantic
18+
-Wno-gnu-zero-variadic-macro-arguments
19+
)
20+
21+
file(GLOB LIB_CUSTOM_SRCS CONFIGURE_DEPENDS *.cpp ${LIB_COMMON_DIR}/react/renderer/components/${LIB_LITERAL}/*.cpp)
22+
file(GLOB LIB_CODEGEN_SRCS CONFIGURE_DEPENDS ${LIB_ANDROID_GENERATED_JNI_DIR}/*.cpp ${LIB_ANDROID_GENERATED_COMPONENTS_DIR}/*.cpp)
23+
24+
add_library(
25+
${LIB_TARGET_NAME}
26+
SHARED
27+
${LIB_CUSTOM_SRCS}
28+
${LIB_CODEGEN_SRCS}
29+
)
30+
31+
target_include_directories(
32+
${LIB_TARGET_NAME}
33+
PUBLIC
34+
.
35+
${LIB_COMMON_DIR}
36+
${LIB_ANDROID_GENERATED_JNI_DIR}
37+
${LIB_ANDROID_GENERATED_COMPONENTS_DIR}
38+
)
39+
40+
target_link_libraries(
41+
${LIB_TARGET_NAME}
42+
fbjni
43+
folly_runtime
44+
glog
45+
jsi
46+
react_codegen_rncore
47+
react_debug
48+
react_render_componentregistry
49+
react_render_core
50+
react_render_debug
51+
react_render_graphics
52+
react_render_imagemanager
53+
react_render_mapbuffer
54+
react_render_textlayoutmanager
55+
react_utils
56+
react_nativemodule_core
57+
rrc_image
58+
turbomodulejsijni
59+
rrc_text
60+
rrc_textinput
61+
rrc_view
62+
yoga
63+
)
64+
65+
target_compile_options(
66+
${LIB_TARGET_NAME}
67+
PRIVATE
68+
-DLOG_TAG=\"ReactNative\"
69+
-fexceptions
70+
-frtti
71+
-std=c++20
72+
-Wall
73+
)
74+
75+
target_include_directories(
76+
${CMAKE_PROJECT_NAME}
77+
PUBLIC
78+
${CMAKE_CURRENT_SOURCE_DIR}
79+
)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#pragma once
2+
3+
#include <ReactCommon/JavaTurboModule.h>
4+
#include <ReactCommon/TurboModule.h>
5+
#include <jsi/jsi.h>
6+
#include <react/renderer/components/RNCSlider/ComponentDescriptors.h>
7+
8+
namespace facebook {
9+
namespace react {
10+
11+
JSI_EXPORT
12+
std::shared_ptr<TurboModule> RNCSlider_ModuleProvider(
13+
const std::string &moduleName,
14+
const JavaTurboModule::InitParams &params);
15+
16+
} // namespace react
17+
} // namespace facebook
18+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#pragma once
2+
3+
#include <react/renderer/components/RNCSlider/RNCSliderShadowNode.h>
4+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
5+
6+
namespace facebook {
7+
namespace react {
8+
9+
using RNCSliderComponentDescriptor = ConcreteComponentDescriptor<RNCSliderShadowNode>;
10+
11+
} // namespace react
12+
} // namespace facebook
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "RNCSliderShadowNode.h"
2+
3+
namespace facebook {
4+
namespace react {
5+
6+
extern const char RNCSliderComponentName[] = "RNCSlider";
7+
8+
} // namespace react
9+
} // namespace facebook
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
3+
#include <jsi/jsi.h>
4+
#include <react/renderer/components/rncore/EventEmitters.h>
5+
#include <react/renderer/components/RNCSlider/RNCSliderState.h>
6+
#include <react/renderer/components/RNCSlider/Props.h>
7+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
8+
9+
namespace facebook {
10+
namespace react {
11+
12+
JSI_EXPORT extern const char RNCSliderComponentName[];
13+
14+
/*
15+
* `ShadowNode` for <RNCSlider> component.
16+
*/
17+
class JSI_EXPORT RNCSliderShadowNode final
18+
: public ConcreteViewShadowNode<
19+
RNCSliderComponentName,
20+
RNCSliderProps,
21+
ViewEventEmitter,
22+
RNCSliderState> {
23+
using ConcreteViewShadowNode::ConcreteViewShadowNode;
24+
};
25+
26+
} // namespace react
27+
} // namespace facebook
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "RNCSliderState.h"
2+
3+
namespace facebook {
4+
namespace react {
5+
6+
7+
8+
} // namespace react
9+
} // namespace facebook
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#pragma once
2+
3+
#ifdef ANDROID
4+
#include <folly/dynamic.h>
5+
#include <react/renderer/mapbuffer/MapBuffer.h>
6+
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
7+
#endif
8+
9+
namespace facebook {
10+
namespace react {
11+
12+
class RNCSliderState {
13+
public:
14+
RNCSliderState() = default;
15+
16+
#ifdef ANDROID
17+
RNCSliderState(RNCSliderState const &previousState, folly::dynamic data){};
18+
folly::dynamic getDynamic() const {
19+
return {};
20+
};
21+
MapBuffer getMapBuffer() const {
22+
return MapBufferBuilder::EMPTY();
23+
};
24+
#endif
25+
};
26+
27+
} // namespace react
28+
} // namespace facebook

package/package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,11 @@
6464
"jsxBracketSameLine": true
6565
},
6666
"codegenConfig": {
67-
"libraries": [
68-
{
69-
"name": "RNCSlider",
70-
"type": "components",
71-
"jsSrcsDir": "src"
72-
}
73-
]
67+
"name": "RNCSlider",
68+
"type": "components",
69+
"jsSrcsDir": "src",
70+
"android": {
71+
"javaPackageName": "com.reactnativecommunity.slider"
72+
}
7473
}
7574
}

package/react-native-slider.podspec

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ Pod::Spec.new do |s|
1616

1717
s.source = { :git => "https://github.com/callstack/react-native-slider.git", :tag => "v#{s.version}" }
1818
s.source_files = "ios/**/*.{h,m,mm}"
19+
20+
s.subspec "common" do |ss|
21+
ss.source_files = "common/cpp/**/*.{cpp,h}"
22+
ss.header_dir = "RNCSlider"
23+
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/common/cpp\"" }
24+
end
25+
1926
if defined?(install_modules_dependencies)
2027
install_modules_dependencies(s)
2128
else

0 commit comments

Comments
 (0)