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
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
node_modules
jest-setups/jest.setup.js
jest-setups/jest.setup.windows.js
20 changes: 19 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
module.exports = {
extends: ['@react-native-community'],
root: true,
extends: ['@react-native'],
overrides: [
{
// @react-native/babel-preset parses Flow with hermes-parser, whose
// tokens @babel/eslint-parser can't convert; lint Flow files the way
// React Native itself does. hermes-eslint resolves type references on
// its own, so the ft-flow scope rules are redundant (and incompatible),
// and Flow itself reports undefined identifiers, including its builtin
// types like $ReadOnly that no-undef doesn't know about.
files: ['*.js'],
parser: 'hermes-eslint',
rules: {
'ft-flow/define-flow-type': 'off',
'ft-flow/use-flow-type': 'off',
'no-undef': 'off',
},
},
],
};
31 changes: 16 additions & 15 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*
; Native build output of the example app
<PROJECT_ROOT>/example/.*/Pods/
<PROJECT_ROOT>/example/.*/build/
<PROJECT_ROOT>/example/dist/

; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
.*/node_modules/warning/.*
; Ignore polyfills
.*/node_modules/react-native/Libraries/polyfills/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js
; Malformed fixture shipped by `resolve`
.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
Expand All @@ -29,11 +30,10 @@ node_modules/react-native/interface.js
node_modules/react-native/flow/

[options]
enums=true
casting_syntax=both
component_syntax=true
emoji=true

esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable

exact_by_default=true

module.file_ext=.js
Expand All @@ -42,15 +42,17 @@ module.file_ext=.ios.js

munge_underscores=true

module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/index.js'
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'

react.runtime=automatic

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

sharedmemory.heap_size=4000000000
suppress_type=$FlowFixMeEmpty

[lints]
sketchy-null-number=warn
Expand All @@ -61,7 +63,6 @@ nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
unnecessary-invariant=warn
signature-verification-failure=warn

[strict]
deprecated-type
Expand All @@ -73,4 +74,4 @@ untyped-import
untyped-type-import

[version]
^0.137.0
^0.275.0
94 changes: 38 additions & 56 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@ on:
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
node-version: 22
- name: Get yarn cache
id: yarn-cache
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
Expand All @@ -28,16 +25,16 @@ jobs:
run: yarn
- name: ESLint Checks
run: yarn lint
- name: Jest
run: yarn test

flow:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
node-version: 22
- name: Get yarn cache
id: yarn-cache
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
Expand All @@ -48,17 +45,15 @@ jobs:
- name: Install Dependencies
run: yarn
- name: FlowType Check
run: yarn flow
run: yarn flow check

tsc:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
node-version: 22
- name: Get yarn cache
id: yarn-cache
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
Expand All @@ -70,21 +65,22 @@ jobs:
run: yarn
- name: TypeScript type check
run: yarn type-check

android:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22]
java-version: [11]
new-arch: [true, false]
name: android (${{ matrix.new-arch && 'NewArch' || 'OldArch' }})
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
- uses: actions/setup-java@v3
node-version: 22
- uses: actions/setup-java@v5
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: ${{ matrix.java-version }}
distribution: temurin
java-version: 17
- name: Get yarn cache
id: yarn-cache
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
Expand All @@ -93,23 +89,24 @@ jobs:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: yarn
- name: Install Example Dependencies
run: cd example && yarn
- name: Build android
run: cd example && yarn build:android
run: yarn && yarn generate:android-manifest
- name: Build Android Example App and Library
run: cd example/android && ./gradlew clean assembleDebug
run: ./gradlew assembleDebug -PnewArchEnabled=${{ matrix.new-arch }}
working-directory: example/android

ios:
runs-on: macos-latest
strategy:
matrix:
node-version: [22]
new-arch: [1, 0]
name: ios (${{ matrix.new-arch == 1 && 'NewArch' || 'OldArch' }})
env:
RCT_NEW_ARCH_ENABLED: ${{ matrix.new-arch }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
node-version: 22
- name: Get yarn cache
id: yarn-cache
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
Expand All @@ -119,24 +116,9 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: yarn
- name: Install Example Dependencies
run: cd example && yarn
- name: Build ios
run: cd example && yarn build:ios
# boostorg.jfrog.io no longer serves the tarball referenced by RN 0.68's
# boost.podspec; archives.boost.io hosts the identical file (same sha256).
- name: Patch boost podspec URL
run: sed -i '' 's|https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2|https://archives.boost.io/release/1.76.0/source/boost_1_76_0.tar.bz2|' example/node_modules/react-native/third-party-podspecs/boost.podspec
# RN 0.68's Yoga builds with -Werror, and newer clang (Xcode 26) adds
# warnings it trips (-Wdeprecated-literal-operator, -Wbitwise-instead-of-logical).
- name: Drop -Werror from Yoga podspec
run: sed -i '' "/'-Werror',/d" example/node_modules/react-native/ReactCommon/yoga/Yoga.podspec
- name: Install Podfiles
run: cd example && pod install --project-directory=ios
# The CLI defaults to an "iPhone 13" simulator, which current runner
# images no longer ship; pick whichever iPhone simulator is available.
run: RCT_USE_PREBUILT_RNCORE=1 RCT_USE_RN_DEP=1 pod install
working-directory: example/ios
- name: Build example app
run: |
UDID=$(xcrun simctl list devices available -j | jq -r '[.devices[][] | select(.name | startswith("iPhone"))][0].udid')
echo "Using simulator $UDID"
cd example && npx react-native run-ios --udid "$UDID"
run: xcodebuild -scheme ReactTestApp -workspace ProgressViewExample.xcworkspace ONLY_ACTIVE_ARCH=NO -sdk iphonesimulator -configuration Debug
working-directory: example/ios
45 changes: 9 additions & 36 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,28 @@ jobs:
run-windows-tests:
name: Build & run tests
runs-on: windows-2022
strategy:
matrix:
node-version: [22]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
name: Checkout Code

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
node-version: 22

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
with:
vs-version: "[17.0,18.0)"

- name: Setup NuGet
uses: NuGet/setup-nuget@v2

- name: Check node modules cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ./node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: Install node modules
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable

# Not covered by the cache above, which is keyed on the root lockfile only.
- name: Install example node modules
run: cd example && yarn
- name: Bundle example app for Windows
run: npx react-native bundle --entry-file index.js --platform windows --dev true --bundle-output example/dist/main.windows.bundle --assets-dest example/dist/assets

- name: Build Windows
run: cd example && yarn build:windows

# react-native-test-app 2.x spawns npx.cmd without `shell: true`, which
# Node >= 18.20.2 rejects with EINVAL (CVE-2024-27980), so autolink separately.
# Generates example/windows/ProgressViewExample.sln and autolinks it.
# Building the solution is tracked in #66.
- name: Generate Windows App
run: cd example && npx install-windows-test-app --use-nuget --no-autolink

- name: Autolink Windows App
run: cd example && npx react-native autolink-windows --proj node_modules/.generated/windows/ReactTestApp/ReactTestApp.vcxproj

# - name: Start Appium server
# shell: powershell
# run: Start-Process PowerShell -ArgumentList "yarn appium"

# - name: Run tests
# run: yarn test:windows
run: npx install-windows-test-app --project-directory example/windows
15 changes: 6 additions & 9 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@ This is `@react-native-community/progress-view`, a React Native library providin
### Essential Commands
- `yarn lint` - Run ESLint on the codebase
- `yarn test` - Run Jest tests for JavaScript components
- `yarn test:windows` - Run Windows-specific tests
- `yarn type-check` - Run TypeScript type checking
- `yarn flow` - Run Flow type checking

### Platform-Specific Development
- `yarn ios` - Run iOS example app
- `yarn android` - Run Android example app
- `yarn windows` - Run Windows example app
- `yarn start` - Start Metro bundler
- `yarn start:macos` - Start Metro for macOS
- `yarn start:windows` - Start Metro for Windows
- `yarn start` - Start Metro bundler (all platforms, via `@rnx-kit/metro-config`)
- `yarn ios` - Run iOS example app (after `pod install` in `example/ios`)
- `yarn android` - Run Android example app (after `yarn generate:android-manifest`)
- `yarn macos` - Run macOS example app (after `pod install` in `example/macos`)
- `yarn windows` - Run Windows example app (after `npx install-windows-test-app --project-directory example/windows`)

### Testing Individual Components
- `yarn test js/__tests__/*` - Run specific test files
Expand Down Expand Up @@ -88,5 +86,4 @@ Each platform has slightly different prop support:

### Testing Strategy
- Unit tests focus on component rendering and prop validation
- Platform-specific test setups in `jest-setups/`
- Example apps in `example/` and `fabric-example/` for manual testing
- A single example app in `example/` (react-native-test-app, same layout as react-native-menu/menu). It has no package.json of its own: its dependencies are the root devDependencies, and the root `react-native.config.js` / `metro.config.js` point at it. Old vs new architecture is chosen at build time (`RCT_NEW_ARCH_ENABLED` for iOS pods, `-PnewArchEnabled` for Android); CI builds both.
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,23 @@ Add ProgressView like this

### Running Example App

#### Windows
1. Clone branch
2. cd into progress_view and run `yarn install`
3. Start metro server with `yarn start:windows`
4. Open Visual Studios and open `example/windows/ProgressViewExample.sln`
5. Set to Debug x64 and start solution
The example app in `example/` is a [react-native-test-app](https://github.com/microsoft/react-native-test-app) project that uses the dependencies of the repository root. Run `yarn` in the repository root first, and `yarn start` to start Metro.

#### IOS
1. Clone branch
2. cd into progress-view and run `yarn install`
2. cd into example/ios and run `pod install`
4. cd back into progress-view and run `yarn ios`
#### iOS
1. `cd example/ios && pod install` (set `RCT_NEW_ARCH_ENABLED=0` for the old architecture)
2. From the repository root, run `yarn ios`

#### Android
1. `yarn generate:android-manifest`
2. Run `yarn android` (pass `-PnewArchEnabled=false` to Gradle for the old architecture)

#### macOS
1. Clone branch
2. cd into progress-view and run `yarn install`
2. cd into example/macos/example/macos and run `pod install`
4. Open the newly created example.xcworkspace in Xcode, build, and run
1. `cd example/macos && pod install`
2. Open `example/macos/ProgressViewExample.xcworkspace` in Xcode, build, and run

#### Windows
1. `npx install-windows-test-app --project-directory example/windows`
2. Run `yarn windows`, or open `example/windows/ProgressViewExample.sln` in Visual Studio, set Debug x64 and start the solution

## Reference

Expand Down
Loading
Loading