Skip to content

Commit b3ff691

Browse files
authored
feat: Add RESIZE events
1 parent f449e95 commit b3ff691

File tree

10 files changed

+246
-234
lines changed

10 files changed

+246
-234
lines changed

docs/Hero.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import cx from 'classnames'
2-
import NextLink from 'next/link'
32
import { forwardRef, useEffect, useRef, useState } from 'react'
43
import { animated, config, useSpring } from 'react-spring'
54
import styles from './Hero.module.css'
@@ -27,13 +26,15 @@ const Link: React.FC<{
2726

2827
const Links = ({ className }: { className?: string }) => (
2928
<>
30-
<NextLink href="/docs" passHref>
31-
<Link className={className}>Get started</Link>
32-
</NextLink>
29+
<Link
30+
className={className}
31+
href="https://github.com/stipsan/react-spring-bottom-sheet/blob/main/GET_STARTED.md#get-started"
32+
>
33+
Get started
34+
</Link>
3335
<Link
3436
className={className}
3537
href="https://github.com/stipsan/react-spring-bottom-sheet"
36-
target="_blank"
3738
>
3839
GitHub
3940
</Link>

pages/fixtures/experiments.tsx

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ function Two() {
8888
Dismiss
8989
</Button>
9090
}
91-
defaultSnap={({ headerHeight, footerHeight }) =>
92-
headerHeight + footerHeight
91+
defaultSnap={({ headerHeight, footerHeight, minHeight }) =>
92+
//headerHeight + footerHeight
93+
minHeight
9394
}
9495
snapPoints={({ minHeight, headerHeight, footerHeight }) => [
9596
headerHeight + footerHeight,
@@ -185,9 +186,6 @@ function Five() {
185186
open={open}
186187
footer={<strong>Sticky footer</strong>}
187188
onDismiss={onDismiss}
188-
onSpringStart={(event) => console.warn('onSpringStart', event)}
189-
onSpringCancel={(event) => console.error('onSpringCancel', event)}
190-
onSpringEnd={(event) => console.warn('onSpringEnd', event)}
191189
defaultSnap={({ lastSnap }) => lastSnap}
192190
snapPoints={({ minHeight, headerHeight, footerHeight }) => [
193191
headerHeight,
@@ -256,7 +254,7 @@ function Seven() {
256254
if (open) {
257255
setShift((shift) => !shift)
258256
}
259-
}, 3000)
257+
}, 1000)
260258

261259
return (
262260
<>
@@ -326,6 +324,49 @@ function Eight() {
326324
)
327325
}
328326

327+
function Nine() {
328+
const [open, setOpen] = useState(false)
329+
const [expandHeader, setExpandHeader] = useState(false)
330+
const [expandContent, setExpandContent] = useState(false)
331+
const [expandFooter, setExpandFooter] = useState(false)
332+
333+
return (
334+
<>
335+
<Button onClick={() => setOpen(true)}>9</Button>
336+
<BottomSheet
337+
open={open}
338+
onDismiss={() => setOpen(false)}
339+
header={
340+
<div>
341+
<Button onClick={() => setExpandHeader(true)}>Expand</Button>
342+
<br />
343+
{expandHeader && (
344+
<Button onClick={() => setExpandHeader(false)}>No!</Button>
345+
)}
346+
</div>
347+
}
348+
footer={
349+
<>
350+
<Button onClick={() => setExpandFooter(true)}>Expand</Button>
351+
<br />
352+
{expandFooter && (
353+
<Button onClick={() => setExpandFooter(false)}>No!</Button>
354+
)}
355+
</>
356+
}
357+
>
358+
<SheetContent>
359+
<Button onClick={() => setExpandContent(true)}>Expand</Button>
360+
<br />
361+
{expandContent && (
362+
<Button onClick={() => setExpandContent(false)}>No!</Button>
363+
)}
364+
</SheetContent>
365+
</BottomSheet>
366+
</>
367+
)
368+
}
369+
329370
export default function ExperimentsFixturePage() {
330371
return (
331372
<Container
@@ -342,6 +383,7 @@ export default function ExperimentsFixturePage() {
342383
<Six />
343384
<Seven />
344385
<Eight />
386+
<Nine />
345387
</Container>
346388
)
347389
}

0 commit comments

Comments
 (0)