Skip to content
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

RTL support #22

Open
MatthewTemnohudov opened this issue Sep 26, 2021 · 3 comments
Open

RTL support #22

MatthewTemnohudov opened this issue Sep 26, 2021 · 3 comments

Comments

@MatthewTemnohudov
Copy link

Does react-pageflip support RTL ?

@rezamansourian77
Copy link

same issue

@ShahriarKh
Copy link

#26

@ShahriarKh
Copy link

You can make the book RTL by starting from the last page.

import HTMLFlipBook from "react-pageflip";
import { useRef } from "react";

export default function Book(params) {
    const book = useRef();

    return (
        <>
            <HTMLFlipBook startPage={5} width={300} height={300} ref={book}>
                <div>Page 1</div> {/* First page in LTR, last page in RTL */}
                <div>Page 2</div>
                <div>Page 3</div>
                <div>Page 4</div>
                <div>Page 5</div> {/* Last page in LTR, first page in RTL */}
            </HTMLFlipBook>
            
             {/* Use opposite directions for page turning on custom buttons. */}
             <button onClick={() => book.current.pageFlip().flipPrev()}> Next page </button>
        </>
    );
}

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants