mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* adds typings for react-aria-live * added typescript version * formatting * fixed lint error * updated return type of LiveMessenger children * formatting
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import * as React from 'react';
|
|
import { render } from 'react-dom';
|
|
|
|
import { LiveAnnouncer, LiveMessage, LiveMessenger } from 'react-aria-live';
|
|
|
|
render(
|
|
<LiveAnnouncer>
|
|
<LiveMessage
|
|
aria-live='polite'
|
|
message='hello'
|
|
clearOnUnmount
|
|
/>
|
|
</LiveAnnouncer>,
|
|
document.getElementById('main')
|
|
);
|
|
|
|
render(
|
|
<LiveAnnouncer>
|
|
<LiveMessenger>
|
|
{({ announcePolite, announceAssertive }) =>
|
|
<>
|
|
<button
|
|
onClick={() => {
|
|
announcePolite('Polite message');
|
|
}}>
|
|
Press me for a polite message
|
|
</button>
|
|
<button
|
|
onClick={() => {
|
|
announceAssertive('Assertive message', 'UniqueId');
|
|
}}>
|
|
Press me for an assertive message
|
|
</button>
|
|
</>
|
|
}
|
|
</LiveMessenger>
|
|
</LiveAnnouncer>,
|
|
document.getElementById('main')
|
|
);
|