Skip to content

Commit 8ac51dd

Browse files
authored
fix: 修复KeyboardControllerView注册2次重复的问题 (#11)
1 parent 16c69e8 commit 8ac51dd

27 files changed

+53
-205
lines changed

harmony/keyboard_controller.har

-69 Bytes
Binary file not shown.

harmony/keyboard_controller/.gitignore

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

harmony/keyboard_controller/BuildProfile.ets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Use these variables when you tailor your ArkTS code. They must be of the const type.
33
*/
4-
export const HAR_VERSION = '1.12.17-0.0.1';
4+
export const HAR_VERSION = '1.12.7-0.0.1';
55
export const BUILD_MODE_NAME = 'debug';
66
export const DEBUG = true;
77
export const TARGET_NAME = 'default';
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
string ReanimatedAbility_desc 0x02000001
2+
string ReanimatedAbility_label 0x02000002
3+
string WebviewAbility_desc 0x02000008
4+
string WebviewAbility_label 0x02000009
5+
string module_desc 0x02000003
6+
string page_show 0x02000000
7+
color start_window_background 0x02000004
8+
media icon 0x02000005
9+
profile main_pages 0x02000007
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
1-
{
2-
"name": "@react-native-oh-tpl/react-native-keyboard-controller",
3-
"version": "1.12.7-0.0.2",
4-
"description": " control keyboard show or hide",
5-
"main": "Index.ets",
6-
"author": "",
7-
"license": "MIT License",
8-
"dependencies": {
9-
"@rnoh/react-native-openharmony": "file:../react_native_openharmony",
10-
}
11-
}
1+
{"name":"@react-native-oh-tpl/react-native-keyboard-controller","version":"1.12.7-0.0.3","description":" control keyboard show or hide","main":"Index.ets","author":"","license":"MIT License","dependencies":{"@rnoh/react-native-openharmony":"file:../react_native_openharmony"},"metadata":{"sourceRoots":["./src/main"],"useNormalizedOHMUrl":true},"compatibleSdkVersion":12,"compatibleSdkType":"HarmonyOS","obfuscated":false}

harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
namespace facebook {
3131
namespace react {
3232

33-
inline const char KeyboardControllerViewName[] = "KeyboardControllerView";
33+
inline const char KeyboardControllerViewName[] = "RNKeyboardControllerView";
3434

3535
class KeyboardControllerViewProps : public ViewProps {
3636
public:

harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void KeyboardControllerViewComponentInstance::keyboardHeightChangeHandle() {
116116
if (rnInstancePtr != nullptr && this->enabled) {
117117
if (this->keyboardStatus == KeyboardControllerStatus::HIDE) {
118118
facebook::react::KeyboardControllerViewEventEmitter::MoveEvent start = {this->keyboardHeight, 0, 0, m_tag};
119-
facebook::react::KeyboardControllerViewEventEmitter::MoveEvent end = {0, 0, 0, m_tag};
119+
facebook::react::KeyboardControllerViewEventEmitter::MoveEvent end = {0, 1, 0, m_tag};
120120
m_eventEmitter->onKeyboardMove(end);
121121
m_eventEmitter->onKeyboardMoveEnd(end);
122122
} else {

harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
namespace facebook {
3232
namespace react {
3333

34-
inline const char KeyboardGestureAreaComponentName[] = "KeyboardGestureArea";
34+
inline const char KeyboardGestureAreaComponentName[] = "RNKeyboardGestureArea";
3535

3636
class KeyboardGestureAreaProps : public ViewProps {
3737
public:

harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ KeyboardControllerPackage::createComponentDescriptorProviders() {
1717
facebook::react::KeyboardGestureAreaComponentDescriptor>()};
1818
}
1919
ComponentJSIBinderByString KeyboardControllerPackage::createComponentJSIBinderByName() {
20-
return {{"KeyboardControllerView", std::make_shared<KeyboardControllerViewJSIBinder>()},
21-
{"KeyboardGestureArea", std::make_shared<KeyboardGestureAreaJSIBinder>()}};
20+
return {{"RNKeyboardControllerView", std::make_shared<KeyboardControllerViewJSIBinder>()},
21+
{"RNKeyboardGestureArea", std::make_shared<KeyboardGestureAreaJSIBinder>()}};
2222
}
2323

2424
std::unique_ptr<TurboModuleFactoryDelegate> KeyboardControllerPackage::createTurboModuleFactoryDelegate() {
@@ -30,10 +30,10 @@ ComponentInstanceFactoryDelegate::Shared KeyboardControllerPackage::createCompon
3030
};
3131

3232
ComponentInstance::Shared KeyboardControllerPackage::createComponentInstance(const ComponentInstance::Context &ctx) {
33-
if (ctx.componentName == "KeyboardControllerView") {
33+
if (ctx.componentName == "RNKeyboardControllerView") {
3434
return std::make_shared<KeyboardControllerViewComponentInstance>(ctx);
3535
}
36-
if (ctx.componentName == "KeyboardGestureArea") {
36+
if (ctx.componentName == "RNKeyboardGestureArea") {
3737
return std::make_shared<KeyboardGestureAreaComponentInstance>(ctx);
3838
}
3939
return nullptr;

harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ namespace rnoh {
1717
class KeyboardControllerComponentInstanceFactoryDelegate : public ComponentInstanceFactoryDelegate {
1818
public:
1919
ComponentInstance::Shared create(ComponentInstance::Context ctx) override {
20-
if (ctx.componentName == "KeyboardControllerView") {
20+
if (ctx.componentName == "RNKeyboardControllerView") {
2121
return std::make_shared<KeyboardControllerViewComponentInstance>(ctx);
2222
}
23-
if (ctx.componentName == "KeyboardGestureArea") {
23+
if (ctx.componentName == "RNKeyboardGestureArea") {
2424
return std::make_shared<KeyboardGestureAreaComponentInstance>(ctx);
2525
}
2626
return nullptr;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"app": {
3+
"bundleName": "com.rnoh.lhg.test",
4+
"debug": true,
5+
"versionCode": 1000000,
6+
"versionName": "1.0.0",
7+
"minAPIVersion": 50000012,
8+
"targetAPIVersion": 50000012,
9+
"apiReleaseType": "Beta5",
10+
"compileSdkVersion": "5.0.0.60",
11+
"compileSdkType": "HarmonyOS",
12+
"appEnvironments": [],
13+
"bundleType": "app"
14+
},
15+
"module": {
16+
"name": "keyboard_controller",
17+
"type": "har",
18+
"deviceTypes": [
19+
"default",
20+
"tablet",
21+
"2in1"
22+
],
23+
"packageName": "@react-native-oh-tpl/react-native-keyboard-controller",
24+
"installationFree": false,
25+
"virtualMachine": "ark12.0.2.0",
26+
"compileMode": "esmodule",
27+
"dependencies": []
28+
}
29+
}

harmony/keyboard_controller/src/main/module.json5

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

harmony/keyboard_controller/src/ohosTest/ets/test/Ability.test.ets

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

harmony/keyboard_controller/src/ohosTest/ets/test/List.test.ets

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

harmony/keyboard_controller/src/ohosTest/module.json5

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

harmony/keyboard_controller/src/test/List.test.ets

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

harmony/keyboard_controller/src/test/LocalUnit.test.ets

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

src/animated.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const KeyboardProvider = ({
135135
const updateSharedValues = (event: NativeEvent, platforms: string[]) => {
136136
"worklet";
137137

138-
if (platforms.includes(OS)||Platform.OS as string=='harmony') {
138+
if (platforms.includes(OS)) {
139139
// eslint-disable-next-line react-compiler/react-compiler
140140
progressSV.value = event.progress;
141141
heightSV.value = -event.height;
@@ -157,7 +157,6 @@ export const KeyboardProvider = ({
157157
},
158158
onKeyboardMoveEnd: (event: NativeEvent) => {
159159
"worklet";
160-
161160
broadcastKeyboardEvents("onEnd", event);
162161
updateSharedValues(event, ['harmony']);
163162
},
@@ -198,7 +197,6 @@ export const KeyboardProvider = ({
198197
{
199198
onFocusedInputSelectionChanged: (e) => {
200199
"worklet";
201-
202200
broadcastInputEvents("onSelectionChange", e);
203201
},
204202
},

src/components/KeyboardAwareScrollView/__tests__/scrollDistanceWithRespectToSnapPoints.spec.ts

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

src/components/KeyboardStickyView/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ const KeyboardStickyView = forwardRef<
3333
ref,
3434
) => {
3535
const { height, progress } = useReanimatedKeyboardAnimation();
36-
3736
const stickyViewStyle = useAnimatedStyle(() => {
3837
const offset = interpolate(progress.value, [0, 1], [closed, opened]);
3938

src/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const defaultContext: KeyboardAnimationContext = {
5555
export const KeyboardContext = createContext(defaultContext);
5656
export const useKeyboardContext = () => {
5757
const context = useContext(KeyboardContext);
58-
58+
console.log('###KeyboardContext',context,context.animated.height);
5959
if (__DEV__ && context === defaultContext) {
6060
console.warn(
6161
"Couldn't find real values for `KeyboardContext`. Please make sure you're inside of `KeyboardProvider` - otherwise functionality of `react-native-keyboard-controller` will not work.",

src/event-handler.d.ts

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

src/event-handler.js

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

src/event-handler.web.js

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

src/event-mappings.ts

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

src/specs/KeyboardControllerViewNativeComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ export interface NativeProps extends ViewProps {
6666
}
6767

6868
export default codegenNativeComponent<NativeProps>(
69-
"KeyboardControllerView",
69+
"RNKeyboardControllerView",
7070
) as HostComponent<NativeProps>;

src/specs/KeyboardGestureAreaNativeComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export interface NativeProps extends ViewProps {
1010
enableSwipeToDismiss?: boolean;
1111
}
1212

13-
export default codegenNativeComponent<NativeProps>("KeyboardGestureArea", {
13+
export default codegenNativeComponent<NativeProps>("RNKeyboardGestureArea", {
1414
excludedPlatforms: ["iOS"],
1515
}) as HostComponent<NativeProps>;

0 commit comments

Comments
 (0)