js: implement keyboard related api
This commit is contained in:
1
doric-js/lib/src/native/index.native.d.ts
vendored
1
doric-js/lib/src/native/index.native.d.ts
vendored
@@ -9,3 +9,4 @@ export * from './notification';
|
||||
export * from './statusbar';
|
||||
export * from './coordinator';
|
||||
export * from './notch';
|
||||
export * from './keyboard';
|
||||
|
@@ -24,3 +24,4 @@ export * from './notification';
|
||||
export * from './statusbar';
|
||||
export * from './coordinator';
|
||||
export * from './notch';
|
||||
export * from './keyboard';
|
||||
|
7
doric-js/lib/src/native/keyboard.d.ts
vendored
Normal file
7
doric-js/lib/src/native/keyboard.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { BridgeContext } from "../runtime/global";
|
||||
export declare function keyboard(context: BridgeContext): {
|
||||
subscribe: (callback: (data: {
|
||||
height: number;
|
||||
}) => void) => Promise<string>;
|
||||
unsubscribe: (subscribeId: string) => Promise<any>;
|
||||
};
|
11
doric-js/lib/src/native/keyboard.js
Normal file
11
doric-js/lib/src/native/keyboard.js
Normal file
@@ -0,0 +1,11 @@
|
||||
export function keyboard(context) {
|
||||
return {
|
||||
subscribe: (callback) => {
|
||||
return context.callNative('keyboard', 'subscribe', context.function2Id(callback));
|
||||
},
|
||||
unsubscribe: (subscribeId) => {
|
||||
context.removeFuncById(subscribeId);
|
||||
return context.callNative('keyboard', 'unsubscribe', subscribeId);
|
||||
}
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user