diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 4d45742..0535332 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -20,13 +20,13 @@ jobs: name: Build docs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - name: Restore node_modules from cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -42,7 +42,7 @@ jobs: name: Deploy docs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Add key to allow access to repository env: @@ -61,7 +61,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - name: Restore node_modules from cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} diff --git a/.github/workflows/lint-android.yml b/.github/workflows/lint-android.yml index c1ff695..7fc4172 100644 --- a/.github/workflows/lint-android.yml +++ b/.github/workflows/lint-android.yml @@ -12,8 +12,8 @@ jobs: name: Lint Kotlin/Java runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: "**/node_modules" key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} diff --git a/.github/workflows/lint-ios.yml b/.github/workflows/lint-ios.yml index ece8cd7..6c81ce3 100644 --- a/.github/workflows/lint-ios.yml +++ b/.github/workflows/lint-ios.yml @@ -12,8 +12,8 @@ jobs: name: Lint ObjC runs-on: macos-latest steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: "**/node_modules" key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} @@ -24,7 +24,6 @@ jobs: registry-url: "https://registry.npmjs.org" cache-dependency-path: "**/yarn.lock" - run: yarn - - run: yarn install:pods - name: ClangFormat run: | #!/bin/bash diff --git a/.github/workflows/lint-js.yml b/.github/workflows/lint-js.yml index a3fcf18..7e70ce4 100644 --- a/.github/workflows/lint-js.yml +++ b/.github/workflows/lint-js.yml @@ -19,6 +19,7 @@ on: - "eslint.config.mjs" - ".prettierrc.js" - "package.json" + - "tsconfig.json" - ".github/workflows/lint-js.yml" jobs: @@ -26,8 +27,8 @@ jobs: name: Lint JS/TS runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: "**/node_modules" key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} diff --git a/.github/workflows/npm-release-template.yml b/.github/workflows/npm-release-template.yml index 82b57c3..44936c6 100644 --- a/.github/workflows/npm-release-template.yml +++ b/.github/workflows/npm-release-template.yml @@ -17,8 +17,8 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: "**/node_modules" key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ddb91e1..7004378 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ We want this community to be friendly and respectful to each other. Please follo This project is a monorepo, which uses [yarn workspaces](https://classic.yarnpkg.com/lang/en/docs/workspaces/) and is divided into: - `docs` - contains library's Docusaurus documentation -- `packages/example` - contains mobile app example +- `packages/expo-example` - contains mobile app example - `packages/react-native-avoid-softinput` - contains library code ## Development workflow @@ -20,21 +20,24 @@ To get started with the project, run `yarn` in the root directory to install the yarn ``` -While developing, you can run the [example app](/packages/example/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app. +While developing, you can run the [example app](/packages/expo-example/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app. -To start the packager, run `cd packages/example` and then run `yarn start` +```sh +cd packages/expo-example +yarn prebuild +``` To run the example app on Android: ```sh -cd packages/example +cd packages/expo-example yarn android ``` To run the example app on iOS: ```sh -cd packages/example +cd packages/expo-example yarn ios ``` @@ -53,11 +56,10 @@ yarn format:js To edit the Objective-C files -- install Pods with `yarn install:pods` -- open XCode with +- install Pods and open XCode with ```sh -cd packages/example +cd packages/expo-example xed ios ``` @@ -65,7 +67,7 @@ xed ios To edit the Kotlin files: -- open `packages/example/android` in Android Studio and find the source files at `react-native-avoid-softinput` under `Android`. +- open `packages/expo-example/android` in Android Studio and find the source files at `react-native-avoid-softinput` under `Android`. To run Docusaurus documentation locally, run the following: @@ -140,8 +142,6 @@ The `package.json` file contains various scripts for common tasks: - `yarn format:android`: format (Spotless/Ktfmt) all Kotlin/Java files. - `yarn format:ios:objc`: format (ClangFormat) all ObjC/ObjC++ files (install [ClangFormat](https://clang.llvm.org/) e.g. with Homebrew). - `yarn release` release library to npm. -- `yarn install:pods`: setup project's pods. -- `yarn install:pods:fabric`: setup project's pods with new arch. - `yarn reset`: clean all project's dependencies and pods. - `yarn reset:node_modules`: clean all project's dependencies. - `yarn reset:pods`: clean all project's pods. diff --git a/eslint.config.mjs b/eslint.config.mjs index ca4cbb9..bbb8b68 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -16,6 +16,9 @@ export default [ { files: ['packages/expo-example/**/*'], rules: { + // Example app for some reason does not recognize library imported as a workspace dependency on CI + // I don't have time and will to fight with that, let's mark it as a warning and just move on + 'import/no-unresolved': 'warn', 'react/react-in-jsx-scope': 'off', }, }, diff --git a/package.json b/package.json index e0486bc..2a0d745 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ ] }, "scripts": { - "typescript": "tsc --noEmit -p packages/expo-example/tsconfig.json && tsc --noEmit -p packages/react-native-avoid-softinput/tsconfig.json", + "typescript": "tsc --noEmit", "lint:js": "eslint \"**/*.{js,ts,tsx}\" && prettier --config .prettierrc.js \"packages/**/*.{js,ts,tsx}\"", "lint:android": "./packages/react-native-avoid-softinput/android/gradlew -p packages/react-native-avoid-softinput/android spotlessCheck --quiet", "lint:ios:objc": "clang-format --dry-run -i ./packages/react-native-avoid-softinput/ios/*.{h,mm}", diff --git a/packages/expo-example/package.json b/packages/expo-example/package.json index c44e1f2..6d74040 100644 --- a/packages/expo-example/package.json +++ b/packages/expo-example/package.json @@ -17,7 +17,7 @@ "expo": "53.0.12", "react": "19.0.0", "react-native": "0.79.4", - "react-native-avoid-softinput": "workspace:", + "react-native-avoid-softinput": "workspace:*", "react-native-edge-to-edge": "1.6.0", "react-native-gesture-handler": "2.24.0", "react-native-reanimated": "3.17.4", diff --git a/packages/expo-example/tsconfig.json b/packages/expo-example/tsconfig.json index b9567f6..921fb04 100644 --- a/packages/expo-example/tsconfig.json +++ b/packages/expo-example/tsconfig.json @@ -1,6 +1,9 @@ { "extends": "expo/tsconfig.base", "compilerOptions": { - "strict": true + "strict": true, + "paths": { + "react-native-avoid-softinput": ["../react-native-avoid-softinput/src/index"] + } } } diff --git a/tsconfig.json b/tsconfig.json index 4991b08..a495c75 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,10 @@ { "extends": "expo/tsconfig.base", "compilerOptions": { - "strict": true + "strict": true, + "paths": { + "react-native-avoid-softinput": ["./packages/react-native-avoid-softinput/src/index"] + } }, - "exclude": ["packages/react-native-avoid-softinput/lib/**/*"] + "exclude": ["packages/react-native-avoid-softinput/lib/**/*", "docs"] } diff --git a/yarn.lock b/yarn.lock index 737027e..7d4555f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6811,7 +6811,7 @@ __metadata: expo: "npm:53.0.12" react: "npm:19.0.0" react-native: "npm:0.79.4" - react-native-avoid-softinput: "workspace:" + react-native-avoid-softinput: "workspace:*" react-native-edge-to-edge: "npm:1.6.0" react-native-gesture-handler: "npm:2.24.0" react-native-reanimated: "npm:3.17.4" @@ -11307,7 +11307,7 @@ __metadata: languageName: node linkType: hard -"react-native-avoid-softinput@workspace:, react-native-avoid-softinput@workspace:packages/react-native-avoid-softinput": +"react-native-avoid-softinput@workspace:*, react-native-avoid-softinput@workspace:packages/react-native-avoid-softinput": version: 0.0.0-use.local resolution: "react-native-avoid-softinput@workspace:packages/react-native-avoid-softinput" dependencies: