From a464f3e1d5d7f46f3269a410e2c08991dc9f5f98 Mon Sep 17 00:00:00 2001 From: Shahriar <31452340+ShahriarKh@users.noreply.github.com> Date: Sun, 8 May 2022 14:56:00 +0430 Subject: [PATCH 1/3] Add 'startPage' & RTL example startPage was undocumented --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 9efa974..db29b04 100644 --- a/README.md +++ b/README.md @@ -77,12 +77,35 @@ function MyBook(props) { } ``` +### RTL +You can make the book RTL by starting from the last page. + +```jsx +import HTMLFlipBook from "react-pageflip"; +import { useRef } from "react"; + +export default function Book(params) { + const book = useRef(); + + return ( + +
Page 1
{/* First page in LTR, last page in RTL */} +
Page 2
+
Page 3
+
Page 4
+
Page 5
{/* Last page in LTR, first page in RTL */} +
+ ); +} +``` + ### Props To set configuration use these props: - `width: number` - required - `height: number` - required +- `startPage: number` - `size: ("fixed", "stretch")` - default: `"fixed"` Whether the book will be stretched under the parent element or not - `minWidth, maxWidth, minHeight, maxHeight: number` You must set threshold values ​​with size: `"stretch"` - `drawShadow: bool` - default: `true` Draw shadows or not when page flipping From 81bbb3f09dd4e0234158f597db57aa5cc04226eb Mon Sep 17 00:00:00 2001 From: Shahriar <31452340+ShahriarKh@users.noreply.github.com> Date: Sun, 8 May 2022 15:23:50 +0430 Subject: [PATCH 2/3] Update README.md --- README.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index db29b04..2752d67 100644 --- a/README.md +++ b/README.md @@ -88,16 +88,24 @@ export default function Book(params) { const book = useRef(); return ( - -
Page 1
{/* First page in LTR, last page in RTL */} -
Page 2
-
Page 3
-
Page 4
-
Page 5
{/* Last page in LTR, first page in RTL */} -
+ <> + +
Page 1
{/* First page in LTR, last page in RTL */} +
Page 2
+
Page 3
+
Page 4
+
Page 5
{/* Last page in LTR, first page in RTL */} +
+ + {/* Use opposite directions for page turning on custom buttons. */} + + ); } ``` +If the output is not desirable, try these: +- if the number of pages is odd, try an even number. (Example: 5 pages => `startPage={4}`). +- disable/enable `showCover`. ### Props From a1f8955a6cf70bd06fdc146a88504b8033577cb0 Mon Sep 17 00:00:00 2001 From: Shahriar <31452340+ShahriarKh@users.noreply.github.com> Date: Sun, 8 May 2022 15:25:43 +0430 Subject: [PATCH 3/3] Update README.md removed rtl form docs for now. --- README.md | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/README.md b/README.md index 2752d67..2e1ac49 100644 --- a/README.md +++ b/README.md @@ -79,33 +79,7 @@ function MyBook(props) { ### RTL You can make the book RTL by starting from the last page. - -```jsx -import HTMLFlipBook from "react-pageflip"; -import { useRef } from "react"; - -export default function Book(params) { - const book = useRef(); - - return ( - <> - -
Page 1
{/* First page in LTR, last page in RTL */} -
Page 2
-
Page 3
-
Page 4
-
Page 5
{/* Last page in LTR, first page in RTL */} -
- - {/* Use opposite directions for page turning on custom buttons. */} - - - ); -} -``` -If the output is not desirable, try these: -- if the number of pages is odd, try an even number. (Example: 5 pages => `startPage={4}`). -- disable/enable `showCover`. +See this issue: https://github.com/Nodlik/react-pageflip/issues/22#issuecomment-1120395659 ### Props