Skip to content

MA-21918: add React 19 to peer dependencies #595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## v1.1.0

- Поддержка React 19 в `peerDependencies`.
- Добавлена новая асинхронная функция `runTapticImpactOccurredAsync` для корректной проверки поддержки вибрации.
- Функция `runTapticImpactOccurred` помечена как `@deprecated` и будет удалена в будущих версиях. Рекомендуется перейти на `runTapticImpactOccurredAsync`.
9 changes: 6 additions & 3 deletions packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ const App = () => {
</tr>

<tr>
<td> <code>runTapticImpactOccurred</code> </td>
<td> <code>boolean</code> </td>
<td> Function dispatches <code>VKWebAppTapticImpactOccurred</code> event if it is support (will return <code>true</code>). </td>
<td><code>runTapticImpactOccurredAsync</code></td>
<td><code>Promise&lt;boolean&gt;</code></td>
<td>
Dispatches <code>VKWebAppTapticImpactOccurred</code> event if supported.<br/>
Returns a Promise that resolves to <code>true</code> if the event was dispatched, or <code>false</code> if not supported.
</td>
</tr>

</table>
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"react": "^18.2.0"
},
"peerDependencies": {
"@types/react": "^17.0.0 || ^18.0.0",
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"@vkontakte/vk-bridge": "workspace:^",
"react": "^17.0.0 || ^18.1.0"
"react": "^17.0.0 || ^18.1.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
Expand Down
19 changes: 19 additions & 0 deletions packages/react/src/functions/runTapticImpactOccurred.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@ import vkBridge from '@vkontakte/vk-bridge';
import type { TapticVibrationPowerType } from '@vkontakte/vk-bridge';

/**
* Dispatch device vibration if supported.
*
* @param style - The strength of the vibration feedback.
* @returns A Promise that resolves to `true` if the vibration was triggered, or `false` if not supported.
*/
export async function runTapticImpactOccurredAsync(
style: TapticVibrationPowerType,
): Promise<boolean> {
const supported = await vkBridge.supportsAsync('VKWebAppTapticImpactOccurred');

if (supported) {
vkBridge.send('VKWebAppTapticImpactOccurred', { style }).catch(() => undefined);
return true;
}
return false;
}

/**
* @deprecated Use {@link runTapticImpactOccurredAsync} instead.
* Dispatch device vibration if supported.
*
* Return `false` if not supported.
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1565,9 +1565,9 @@ __metadata:
eslint-plugin-react-hooks: ^4.6.0
react: ^18.2.0
peerDependencies:
"@types/react": ^17.0.0 || ^18.0.0
"@types/react": ^17.0.0 || ^18.0.0 || ^19.0.0
"@vkontakte/vk-bridge": "workspace:^"
react: ^17.0.0 || ^18.1.0
react: ^17.0.0 || ^18.1.0 || ^19.0.0
peerDependenciesMeta:
"@types/react":
optional: true
Expand Down