Skip to content

Commit afeccd1

Browse files
authored
fix: shorter codegen name (#1251)
## 📜 Description Use `keyboardcontroller` instead of `reactnativekeyboardcontroller` as c++ library name. ## 💡 Motivation and Context Using `reactnativekeyboardcontroller` produces very long pathnames, for example: `reactnativekeyboardcontroller_autolinked_build/CMakeFiles/react_codegen_reactnativekeyboardcontroller.dir/C_/Users/irust/connect/node_modules/react-native-keyboard-controller/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewShadowNode.cpp.o` -> 282 symbols (which exceeds the limit of 260 characters on Windows). With `keyboardcontroller` it will be `keyboardcontroller_autolinked_build/CMakeFiles/react_codegen_keyboardcontroller.dir/C_/Users/irust/connect/node_modules/react-native-keyboard-controller/common/cpp/react/renderer/components/keyboardcontroller/RNKCKeyboardBackgroundViewShadowNode.cpp.o` (which is only 251 symbol). This PR will not fix all problems with linking on windows, but at least if project is close to the beginning of the root of the disk (i. e. `C_/Users/irust/connect`) the project will be assembled without errors 🤷‍♂️ > [!IMPORTANT] > I had to remove `FabricExample/android/build/generated/autolinking/autolinking.json` so that the file can be re-assembled again to avoid compilation errors. Closes #1147 #1247 ## 📢 Changelog <!-- High level overview of important changes --> <!-- For example: fixed status bar manipulation; added new types declarations; --> <!-- If your changes don't affect one of platform/language below - then remove this platform/language --> ### JS - change `reactnativekeyboardcontroller` -> `keyboardcontroller` ### iOS - change `reactnativekeyboardcontroller` -> `keyboardcontroller` ### Android - change `reactnativekeyboardcontroller` -> `keyboardcontroller` ### C++ - change `reactnativekeyboardcontroller` -> `keyboardcontroller` ## 🤔 How Has This Been Tested? Tested manually via this PR + locally run fabric build on iOS/Android. ## 📸 Screenshots (if appropriate): <img width="250" height="516" alt="image" src="https://github.com/user-attachments/assets/7bd374cb-2b39-4474-808c-654d918698dd" /> ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
1 parent cca8cc2 commit afeccd1

33 files changed

Lines changed: 64 additions & 64 deletions

FabricExample/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3117,7 +3117,7 @@ SPEC CHECKSUMS:
31173117
React-microtasksnativemodule: 44b44a4d3cd6ffb85d928abf741acdc26722de2e
31183118
react-native-advanced-input-mask: 7e8cb58287774c4447485387661abe946d0e0bb2
31193119
react-native-blur: ba0e9ad6274783c8d45f42da82acae02e25784ad
3120-
react-native-keyboard-controller: 81aa9e5784da51c8855759b6d17d5d897ccaa0e4
3120+
react-native-keyboard-controller: 59e99eb52537287dfc11621263d75b0645120264
31213121
react-native-safe-area-context: 6d8a7b750e496e37bda47c938320bf2c734d441f
31223122
React-NativeModulesApple: b5d18bc109c45c9a1c6b71664991b5cc3adc4e48
31233123
React-oscompat: 93b5535ea7f7dff46aaee4f78309a70979bdde9d

android/src/main/jni/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.13)
22
set(CMAKE_VERBOSE_MAKEFILE ON)
33

4-
set(LIB_LITERAL reactnativekeyboardcontroller)
4+
set(LIB_LITERAL keyboardcontroller)
55
set(LIB_TARGET_NAME react_codegen_${LIB_LITERAL})
66

77
set(LIB_ANDROID_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#pragma once
2+
3+
#include <ReactCommon/JavaTurboModule.h>
4+
#include <ReactCommon/TurboModule.h>
5+
#include <jsi/jsi.h>
6+
7+
/**
8+
* Note this import and that it is not present in autogenerated header file
9+
* under android/build/generated/source/codegen/jni/keyboardcontroller.h
10+
*
11+
* Here we are overriding autogenerated component descriptors by prioritizing our custom headers via include path setup.
12+
*/
13+
#include <react/renderer/components/keyboardcontroller/RNKCKeyboardControllerViewComponentDescriptor.h>
14+
#include <react/renderer/components/keyboardcontroller/RNKCKeyboardGestureAreaComponentDescriptor.h>
15+
#include <react/renderer/components/keyboardcontroller/RNKCOverKeyboardViewComponentDescriptor.h>
16+
#include <react/renderer/components/keyboardcontroller/RNKCKeyboardBackgroundViewComponentDescriptor.h>
17+
18+
#include <memory>
19+
#include <string>
20+
21+
namespace facebook::react {
22+
JSI_EXPORT
23+
std::shared_ptr<TurboModule> keyboardcontroller_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
24+
} // namespace facebook::react

android/src/main/jni/reactnativekeyboardcontroller.h

Lines changed: 0 additions & 24 deletions
This file was deleted.

common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewComponentDescriptor.h renamed to common/cpp/react/renderer/components/keyboardcontroller/RNKCKeyboardBackgroundViewComponentDescriptor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "RNKCKeyboardBackgroundViewShadowNode.h"
1111

1212
#include <react/debug/react_native_assert.h>
13-
#include <react/renderer/components/reactnativekeyboardcontroller/Props.h>
13+
#include <react/renderer/components/keyboardcontroller/Props.h>
1414
#include <react/renderer/core/ConcreteComponentDescriptor.h>
1515

1616
namespace facebook::react {

common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewShadowNode.cpp renamed to common/cpp/react/renderer/components/keyboardcontroller/RNKCKeyboardBackgroundViewShadowNode.cpp

File renamed without changes.

common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewShadowNode.h renamed to common/cpp/react/renderer/components/keyboardcontroller/RNKCKeyboardBackgroundViewShadowNode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
#include "RNKCKeyboardBackgroundViewState.h"
1111

12-
#include <react/renderer/components/reactnativekeyboardcontroller/EventEmitters.h>
13-
#include <react/renderer/components/reactnativekeyboardcontroller/Props.h>
12+
#include <react/renderer/components/keyboardcontroller/EventEmitters.h>
13+
#include <react/renderer/components/keyboardcontroller/Props.h>
1414
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
1515
#include <jsi/jsi.h>
1616

common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewState.h renamed to common/cpp/react/renderer/components/keyboardcontroller/RNKCKeyboardBackgroundViewState.h

File renamed without changes.

common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardControllerViewComponentDescriptor.h renamed to common/cpp/react/renderer/components/keyboardcontroller/RNKCKeyboardControllerViewComponentDescriptor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "RNKCKeyboardControllerViewShadowNode.h"
44

55
#include <react/debug/react_native_assert.h>
6-
#include <react/renderer/components/reactnativekeyboardcontroller/Props.h>
6+
#include <react/renderer/components/keyboardcontroller/Props.h>
77
#include <react/renderer/core/ConcreteComponentDescriptor.h>
88

99
namespace facebook::react {

common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardControllerViewShadowNode.cpp renamed to common/cpp/react/renderer/components/keyboardcontroller/RNKCKeyboardControllerViewShadowNode.cpp

File renamed without changes.

0 commit comments

Comments
 (0)