Skip to content

feat: add rotation#53

Open
pasyukevich wants to merge 4 commits intoExpensify:mainfrom
callstack-internal:feature/rotation
Open

feat: add rotation#53
pasyukevich wants to merge 4 commits intoExpensify:mainfrom
callstack-internal:feature/rotation

Conversation

@pasyukevich
Copy link
Member

@pasyukevich pasyukevich commented Mar 17, 2026

Details

Adds a rotation prop to PDFPreviewer that rotates all pages visually at runtime without modifying the
original file.

Related Issues

Expensify/App#80043

Manual Tests

  1. Build the library
  2. Start the example app from folder
  3. Open the example File
  4. Observe rotation button
  5. Rotate with press on it

Linked PRs

image

@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@pasyukevich
Copy link
Member Author

I have read the CLA Document and I hereby sign the CLA

CLABotify added a commit to Expensify/CLA that referenced this pull request Mar 19, 2026
@pasyukevich pasyukevich marked this pull request as ready for review March 20, 2026 16:37
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d3d30c63e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

import times from 'lodash/times.js';
import React, {useCallback, useLayoutEffect, useRef, useState} from 'react';
import type {CSSProperties, ReactNode, JSX} from 'react';
import {times} from 'lodash';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore the CommonJS-safe lodash import

In the published package we emit ESM (package.json has "type": "module"), so this becomes import { times } from 'lodash'. lodash@4 is the CommonJS build, which means SSR/test environments that execute our dist files directly instead of prebundling them can fail at module load time before PDFPreviewer renders. The previous lodash/times.js default import avoided that interop problem.

Useful? React with 👍 / 👎.

PDFPreviewer.displayName = 'PDFPreviewer';

export default memo(PDFPreviewer);
export default PDFPreviewer;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Re-wrap PDFPreviewer in React.memo

Dropping memo turns every parent rerender into a rerender of Document plus all visible PageRenderer items, even when file, rotation, and sizing props are unchanged. For the attachment-viewer use case this component is optimized for, unrelated state updates now force large PDFs to repaint repeatedly. React.memo would still allow the new rotation prop to update correctly, so removing it is a performance regression rather than a requirement for the feature.

Useful? React with 👍 / 👎.

@lakchote lakchote self-requested a review March 20, 2026 19:25
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

Successfully merging this pull request may close these issues.

1 participant