Skip to content

Commit

Permalink
📖 README
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunlong committed Aug 29, 2020
1 parent cedd652 commit 9852997
Showing 1 changed file with 103 additions and 2 deletions.
105 changes: 103 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ The React component allows its children to enter the browser's fullscreen viewin

* Compatible with both JavaScript and TypeScript
* Compatible with both Desktop and Mobile browsers
* No dependency
* Easy to use
* Compatible with all browsers
* No Dependency
* Easy to Use

## 🔧 Install

Expand Down Expand Up @@ -55,14 +56,114 @@ export default App;
### 🎀 Advanced

```jsx
import React, {useCallback} from 'react';
import { Fullscreen, useFullscreen } from "react-fullscreen-html";

function App() {
const screen1 = useFullscreen();
const screen2 = useFullscreen();

const reportChange = useCallback((state, handle) => {
if (handle === screen1) {
console.log('Screen 1 went to', state, handle);
}
if (handle === screen2) {
console.log('Screen 2 went to', state, handle);
}
}, [screen1, screen2]);

return (
<div>
<button onClick={screen1.enter}>
First
</button>

<button onClick={screen2.enter}>
Second
</button>

<Fullscreen handle={screen1} onChange={reportChange}>
<div className="full-screenable-node" style={{background: "red"}}>
First
<button onClick={screen1.exit}>
Exit
</button>
</div>
</Fullscreen>

<Fullscreen handle={screen2} onChange={reportChange}>
<div className="full-screenable-node" style={{background: "green"}}>
Second
<button onClick={screen2.exit}>
Exit
</button>
</div>
</Fullscreen>
</div>
);
};

export default App;
```

## 📚 Documentation

### 📖 useFullscreen

<table>
<thead>
<tr>
<th>Returned</th>
<th>Type</th>
<th>Description</th>
</tr>
<thead>
<tbody>
<tr>
<td>active</td>
<td>boolean</td>
<td>true if this element is currently full screen.</td>
</tr>
<tr>
<td>enter</td>
<td>() => void</td>
<td>Requests this element to go full screen.</td>
</tr>
<tr>
<td>exit</td>
<td>>() => void</td>
<td>Requests this element to exit full screen.</td>
</tr>
</tbody>
</table>

### 📖 Fullscreen

<table>
<thead>
<tr>
<th>Prop</th>
<th>Type</th>
<th>Require</th>
<th>Description</th>
</tr>
<thead>
<tbody>
<tr>
<td>handle</td>
<td>UseFullscreenProps</td>
<td>✔️</td>
<td>Handle that helps operate the full screen state.</td>
</tr>
<tr>
<td>onChange</td>
<td></td>
<td>❌</td>
<td>Optional callback that gets called when this screen changes state.</td>
</tr>
</tbody>
</table>

## 💖 Wrap Up

If you think any of the `react-fullscreen-html` can be improved, please do open a PR with any updates and submit any issues. Also, I will continue to improve this, so you might want to watch/star this repository to revisit.
Expand Down

0 comments on commit 9852997

Please sign in to comment.