Skip to content

Commit a8ba3a9

Browse files
MA-21918: add React 19 to peer dependencies
1 parent a37898d commit a8ba3a9

File tree

5 files changed

+34
-7
lines changed

5 files changed

+34
-7
lines changed

packages/react/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## v1.1.0
2+
3+
- Поддержка React 19 в `peerDependencies`.
4+
- Добавлена новая асинхронная функция `runTapticImpactOccurredAsync` для корректной проверки поддержки вибрации.
5+
- Функция `runTapticImpactOccurred` помечена как `@deprecated` и будет удалена в будущих версиях. Рекомендуется перейти на `runTapticImpactOccurredAsync`.

packages/react/README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,12 @@ const App = () => {
116116
</tr>
117117

118118
<tr>
119-
<td> <code>runTapticImpactOccurred</code> </td>
120-
<td> <code>boolean</code> </td>
121-
<td> Function dispatches <code>VKWebAppTapticImpactOccurred</code> event if it is support (will return <code>true</code>). </td>
119+
<td><code>runTapticImpactOccurredAsync</code></td>
120+
<td><code>Promise&lt;boolean&gt;</code></td>
121+
<td>
122+
Dispatches <code>VKWebAppTapticImpactOccurred</code> event if supported.<br/>
123+
Returns a Promise that resolves to <code>true</code> if the event was dispatched, or <code>false</code> if not supported.
124+
</td>
122125
</tr>
123126

124127
</table>

packages/react/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
"react": "^18.2.0"
3232
},
3333
"peerDependencies": {
34-
"@types/react": "^17.0.0 || ^18.0.0",
34+
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
3535
"@vkontakte/vk-bridge": "workspace:^",
36-
"react": "^17.0.0 || ^18.1.0"
36+
"react": "^17.0.0 || ^18.1.0 || ^19.0.0"
3737
},
3838
"peerDependenciesMeta": {
3939
"@types/react": {

packages/react/src/functions/runTapticImpactOccurred.ts

+19
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@ import vkBridge from '@vkontakte/vk-bridge';
22
import type { TapticVibrationPowerType } from '@vkontakte/vk-bridge';
33

44
/**
5+
* Dispatch device vibration if supported.
6+
*
7+
* @param style - The strength of the vibration feedback.
8+
* @returns A Promise that resolves to `true` if the vibration was triggered, or `false` if not supported.
9+
*/
10+
export async function runTapticImpactOccurredAsync(
11+
style: TapticVibrationPowerType,
12+
): Promise<boolean> {
13+
const supported = await vkBridge.supportsAsync('VKWebAppTapticImpactOccurred');
14+
15+
if (supported) {
16+
vkBridge.send('VKWebAppTapticImpactOccurred', { style }).catch(() => undefined);
17+
return true;
18+
}
19+
return false;
20+
}
21+
22+
/**
23+
* @deprecated Use {@link runTapticImpactOccurredAsync} instead.
524
* Dispatch device vibration if supported.
625
*
726
* Return `false` if not supported.

yarn.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1565,9 +1565,9 @@ __metadata:
15651565
eslint-plugin-react-hooks: ^4.6.0
15661566
react: ^18.2.0
15671567
peerDependencies:
1568-
"@types/react": ^17.0.0 || ^18.0.0
1568+
"@types/react": ^17.0.0 || ^18.0.0 || ^19.0.0
15691569
"@vkontakte/vk-bridge": "workspace:^"
1570-
react: ^17.0.0 || ^18.1.0
1570+
react: ^17.0.0 || ^18.1.0 || ^19.0.0
15711571
peerDependenciesMeta:
15721572
"@types/react":
15731573
optional: true

0 commit comments

Comments
 (0)