Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 0 additions & 98 deletions .circleci/config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*.pbxproj -text
# specific for windows script files
*.bat text eol=crlf
*.bat text eol=crlf
6 changes: 3 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
- run: yarn && yarn example
node-version: 24
- run: yarn
if: steps.cache-node.outputs.cache-hit != 'true'
- run: yarn lint
- run: yarn typescript
- run: yarn typecheck
- run: yarn test --coverage
- run: yarn prepare
31 changes: 28 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,27 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
**/.xcode.env.local
project.xcworkspace
**/.xcode.env.local

# Android/IJ
#
.idea
.classpath
.cxx
.gradle
.idea
.project
.settings
local.properties
android.iml

# Cocoapods
#
example/ios/Pods

# Ruby
example/vendor/

# node.js
#
node_modules/
Expand All @@ -54,8 +61,26 @@ buck-out/
android/app/libs
android/keystores/debug.keystore

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Expo
.expo/*
.expo/

# Turborepo
.turbo/

# generated by bob
lib/

# React Native Codegen
ios/generated
android/generated

# React Native Nitro Modules
nitrogen/
3 changes: 0 additions & 3 deletions .yarnrc

This file was deleted.

1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
nmHoistingLimits: workspaces
nodeLinker: node-modules
63 changes: 47 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,30 @@ We want this community to be friendly and respectful to each other. Please follo

## Development workflow

To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages:

- The library package in the root directory.
- An example app in the `example/` directory.

To get started with the project, make sure you have the correct version of [Node.js](https://nodejs.org/) installed. See the [`.nvmrc`](./.nvmrc) file for the version used in this project.

Run `yarn` in the root directory to install the required dependencies for each package:

```sh
yarn
```

While developing, you can run the [example app](/example/) to test your changes.
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development without manually migrating.

The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.

It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.

If you want to use Android Studio or Xcode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/PdfLightExample.xcworkspace` in Xcode and find the source files at `Pods > Development Pods > react-native-pdf-light`.

To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-pdf-light` under `Android`.

You can use various commands from the root directory to work with the project.

To start the packager:

Expand All @@ -30,10 +47,23 @@ To run the example app on iOS:
yarn example ios
```

Make sure your code passes TypeScript and ESLint. Run the following to verify:
To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this:

```sh
Running "PdfLightExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1}
```

Note the `"fabric":true` and `"concurrentRoot":true` properties.

Make sure your code passes TypeScript:

```sh
yarn typecheck
```

To check for linting errors, run the following:

```sh
yarn typescript
yarn lint
```

Expand All @@ -49,9 +79,6 @@ Remember to add tests for your change if possible. Run the unit tests by:
yarn test
```

To edit the Objective-C files, open `example/ios/PdfViewerExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-pdf-viewer`.

To edit the Kotlin files, open `example/android` in Android studio and find the source files at `reactnativepdfviewer` under `Android`.

### Commit message convention

Expand All @@ -66,29 +93,33 @@ We follow the [conventional commits specification](https://www.conventionalcommi

Our pre-commit hooks verify that your commit message matches this format when committing.

### Linting and tests

[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)
### Publishing to npm

We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.

To publish new versions, run the following:

We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.
```sh
yarn release
```

Our pre-commit hooks verify that the linter and tests pass when committing.

### Scripts

The `package.json` file contains various scripts for common tasks:

- `yarn bootstrap`: setup project by installing all dependencies and pods.
- `yarn typescript`: type-check files with TypeScript.
- `yarn lint`: lint files with ESLint.
- `yarn test`: run unit tests with Jest.
- `yarn`: setup project by installing dependencies.
- `yarn typecheck`: type-check files with TypeScript.
- `yarn lint`: lint files with [ESLint](https://eslint.org/).
- `yarn test`: run unit tests with [Jest](https://jestjs.io/).
- `yarn example start`: start the Metro server for the example app.
- `yarn example android`: run the example app on Android.
- `yarn example ios`: run the example app on iOS.

### Sending a pull request

> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).

When you're sending a pull request:

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ npm install react-native-pdf-light
If iOS build fails with `Undefined symbol: __swift_FORCE_LOAD_...`, add an
empty `.swift` file to the xcode project.

### Compatibility

| React Native | react-native-pdf-light |
| ------------ | ---------------------- |
| old arch | 1.x.x, 2.x.x |
| new arch | 3.x.x |

## Usage

```js
Expand Down
6 changes: 0 additions & 6 deletions Zoom/package.json

This file was deleted.

26 changes: 26 additions & 0 deletions android/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)

file(GLOB common_SRCS CONFIGURE_DEPENDS ../cpp/*.cpp)
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS
build/generated/source/codegen/jni/*.cpp
build/generated/source/codegen/jni/react/renderer/components/PdfViewSpec/*.cpp
)

add_library(
react_codegen_PdfViewSpec
OBJECT
${common_SRCS}
${react_codegen_SRCS}
)

target_include_directories(react_codegen_PdfViewSpec PUBLIC ../cpp build/generated/source/codegen/jni)

target_link_libraries(
react_codegen_PdfViewSpec
fbjni
jsi
reactnative
)

target_compile_reactnative_options(react_codegen_PdfViewSpec PRIVATE)
Loading