@kontextso/sdk-react-native 2.5.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +17 -2
- package/dist/index.mjs +18 -3
- package/package.json +2 -6
- package/src/formats/Format.tsx +19 -1
package/dist/index.js
CHANGED
|
@@ -126,6 +126,7 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
126
126
|
const modalInitTimeoutRef = (0, import_react2.useRef)(null);
|
|
127
127
|
const isModalInitRef = (0, import_react2.useRef)(false);
|
|
128
128
|
const { height: windowHeight, width: windowWidth } = (0, import_react_native.useWindowDimensions)();
|
|
129
|
+
const keyboardHeightRef = (0, import_react2.useRef)(0);
|
|
129
130
|
const isAdViewVisible = showIframe && iframeLoaded;
|
|
130
131
|
const reset = () => {
|
|
131
132
|
setHeight(0);
|
|
@@ -322,7 +323,8 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
322
323
|
containerWidth,
|
|
323
324
|
containerHeight,
|
|
324
325
|
containerX,
|
|
325
|
-
containerY
|
|
326
|
+
containerY,
|
|
327
|
+
keyboardHeight: keyboardHeightRef.current
|
|
326
328
|
});
|
|
327
329
|
});
|
|
328
330
|
};
|
|
@@ -333,6 +335,19 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
333
335
|
}, 250);
|
|
334
336
|
return () => clearInterval(interval);
|
|
335
337
|
}, [isAdViewVisible]);
|
|
338
|
+
(0, import_react2.useEffect)(() => {
|
|
339
|
+
const showSubscription = import_react_native.Keyboard.addListener("keyboardDidShow", (e) => {
|
|
340
|
+
keyboardHeightRef.current = e?.endCoordinates?.height ?? 0;
|
|
341
|
+
});
|
|
342
|
+
const hideSubscription = import_react_native.Keyboard.addListener("keyboardDidHide", () => {
|
|
343
|
+
keyboardHeightRef.current = 0;
|
|
344
|
+
});
|
|
345
|
+
return () => {
|
|
346
|
+
showSubscription.remove();
|
|
347
|
+
hideSubscription.remove();
|
|
348
|
+
keyboardHeightRef.current = 0;
|
|
349
|
+
};
|
|
350
|
+
}, []);
|
|
336
351
|
if (!context || !bid || !iframeUrl) {
|
|
337
352
|
return null;
|
|
338
353
|
}
|
|
@@ -435,7 +450,7 @@ var import_react_native2 = require("react-native");
|
|
|
435
450
|
var NativeRNKontext_default = import_react_native2.TurboModuleRegistry.getEnforcing("RNKontext");
|
|
436
451
|
|
|
437
452
|
// package.json
|
|
438
|
-
var version = "
|
|
453
|
+
var version = "3.0.0";
|
|
439
454
|
|
|
440
455
|
// src/context/AdsProvider.tsx
|
|
441
456
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
useBid,
|
|
8
8
|
useIframeUrl
|
|
9
9
|
} from "@kontextso/sdk-react";
|
|
10
|
-
import { Linking, Modal, View, useWindowDimensions } from "react-native";
|
|
10
|
+
import { Linking, Modal, View, useWindowDimensions, Keyboard } from "react-native";
|
|
11
11
|
|
|
12
12
|
// ../sdk-common/dist/index.mjs
|
|
13
13
|
function makeIframeMessage(type, opts) {
|
|
@@ -95,6 +95,7 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
95
95
|
const modalInitTimeoutRef = useRef(null);
|
|
96
96
|
const isModalInitRef = useRef(false);
|
|
97
97
|
const { height: windowHeight, width: windowWidth } = useWindowDimensions();
|
|
98
|
+
const keyboardHeightRef = useRef(0);
|
|
98
99
|
const isAdViewVisible = showIframe && iframeLoaded;
|
|
99
100
|
const reset = () => {
|
|
100
101
|
setHeight(0);
|
|
@@ -291,7 +292,8 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
291
292
|
containerWidth,
|
|
292
293
|
containerHeight,
|
|
293
294
|
containerX,
|
|
294
|
-
containerY
|
|
295
|
+
containerY,
|
|
296
|
+
keyboardHeight: keyboardHeightRef.current
|
|
295
297
|
});
|
|
296
298
|
});
|
|
297
299
|
};
|
|
@@ -302,6 +304,19 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
302
304
|
}, 250);
|
|
303
305
|
return () => clearInterval(interval);
|
|
304
306
|
}, [isAdViewVisible]);
|
|
307
|
+
useEffect(() => {
|
|
308
|
+
const showSubscription = Keyboard.addListener("keyboardDidShow", (e) => {
|
|
309
|
+
keyboardHeightRef.current = e?.endCoordinates?.height ?? 0;
|
|
310
|
+
});
|
|
311
|
+
const hideSubscription = Keyboard.addListener("keyboardDidHide", () => {
|
|
312
|
+
keyboardHeightRef.current = 0;
|
|
313
|
+
});
|
|
314
|
+
return () => {
|
|
315
|
+
showSubscription.remove();
|
|
316
|
+
hideSubscription.remove();
|
|
317
|
+
keyboardHeightRef.current = 0;
|
|
318
|
+
};
|
|
319
|
+
}, []);
|
|
305
320
|
if (!context || !bid || !iframeUrl) {
|
|
306
321
|
return null;
|
|
307
322
|
}
|
|
@@ -404,7 +419,7 @@ import { TurboModuleRegistry } from "react-native";
|
|
|
404
419
|
var NativeRNKontext_default = TurboModuleRegistry.getEnforcing("RNKontext");
|
|
405
420
|
|
|
406
421
|
// package.json
|
|
407
|
-
var version = "
|
|
422
|
+
var version = "3.0.0";
|
|
408
423
|
|
|
409
424
|
// src/context/AdsProvider.tsx
|
|
410
425
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kontextso/sdk-react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Kontext SDK for React Native",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -16,25 +16,21 @@
|
|
|
16
16
|
"build": "npm run build:js && cross-env NODE_ENV=development npm run test:run",
|
|
17
17
|
"test": "",
|
|
18
18
|
"test:run": "",
|
|
19
|
-
"pretty": "prettier --write \"./src/**/*.{js,jsx,mjs,cjs,ts,tsx,json}\"",
|
|
20
19
|
"format": "biome format --write ."
|
|
21
20
|
},
|
|
22
21
|
"devDependencies": {
|
|
23
|
-
"@kontextso/eslint-config": "*",
|
|
24
22
|
"@kontextso/sdk-common": "^0.2.0",
|
|
25
23
|
"@kontextso/typescript-config": "*",
|
|
26
24
|
"@testing-library/dom": "^10.4.0",
|
|
27
25
|
"@testing-library/jest-dom": "^6.4.6",
|
|
28
26
|
"@testing-library/react": "^16.0.0",
|
|
29
27
|
"@testing-library/react-native": "^12.9.0",
|
|
30
|
-
"@types/eslint": "^9.6.1",
|
|
31
28
|
"@types/node": "^22.7.5",
|
|
32
29
|
"@types/react": "^18.2.61",
|
|
33
30
|
"@types/react-dom": "^18.2.19",
|
|
34
31
|
"@vitejs/plugin-react": "^4.3.1",
|
|
35
32
|
"@vitest/ui": "^2.1.2",
|
|
36
33
|
"cross-env": "^7.0.3",
|
|
37
|
-
"eslint": "^8.57.0",
|
|
38
34
|
"expo": "^53.0.18",
|
|
39
35
|
"expo-av": "^15.1.7",
|
|
40
36
|
"jsdom": "^25.0.1",
|
|
@@ -55,7 +51,7 @@
|
|
|
55
51
|
"react-native-webview": "^13.10.0"
|
|
56
52
|
},
|
|
57
53
|
"dependencies": {
|
|
58
|
-
"@kontextso/sdk-react": "^
|
|
54
|
+
"@kontextso/sdk-react": "^3.0.0"
|
|
59
55
|
},
|
|
60
56
|
"files": [
|
|
61
57
|
"dist/*",
|
package/src/formats/Format.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type FormatProps,
|
|
9
9
|
} from '@kontextso/sdk-react'
|
|
10
10
|
import type { WebView, WebViewMessageEvent } from 'react-native-webview'
|
|
11
|
-
import { Linking, Modal, View, useWindowDimensions } from 'react-native'
|
|
11
|
+
import { Linking, Modal, View, useWindowDimensions, Keyboard } from 'react-native'
|
|
12
12
|
import {
|
|
13
13
|
handleIframeMessage,
|
|
14
14
|
type IframeMessageEvent,
|
|
@@ -63,6 +63,8 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
63
63
|
|
|
64
64
|
const { height: windowHeight, width: windowWidth } = useWindowDimensions()
|
|
65
65
|
|
|
66
|
+
const keyboardHeightRef = useRef(0);
|
|
67
|
+
|
|
66
68
|
const isAdViewVisible = showIframe && iframeLoaded
|
|
67
69
|
|
|
68
70
|
const reset = () => {
|
|
@@ -294,6 +296,7 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
294
296
|
containerHeight,
|
|
295
297
|
containerX,
|
|
296
298
|
containerY,
|
|
299
|
+
keyboardHeight: keyboardHeightRef.current,
|
|
297
300
|
})
|
|
298
301
|
})
|
|
299
302
|
}
|
|
@@ -308,6 +311,21 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
308
311
|
return () => clearInterval(interval)
|
|
309
312
|
}, [isAdViewVisible])
|
|
310
313
|
|
|
314
|
+
useEffect(() => {
|
|
315
|
+
const showSubscription = Keyboard.addListener('keyboardDidShow', (e) => {
|
|
316
|
+
keyboardHeightRef.current = e?.endCoordinates?.height ?? 0;
|
|
317
|
+
});
|
|
318
|
+
const hideSubscription = Keyboard.addListener('keyboardDidHide', () => {
|
|
319
|
+
keyboardHeightRef.current = 0;
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
return () => {
|
|
323
|
+
showSubscription.remove();
|
|
324
|
+
hideSubscription.remove();
|
|
325
|
+
keyboardHeightRef.current = 0;
|
|
326
|
+
};
|
|
327
|
+
}, []);
|
|
328
|
+
|
|
311
329
|
if (!context || !bid || !iframeUrl) {
|
|
312
330
|
return null
|
|
313
331
|
}
|