From 99db831175d953b265c38cff39946967fa495b16 Mon Sep 17 00:00:00 2001 From: jensvansteen Date: Wed, 8 Apr 2026 11:30:41 +0700 Subject: [PATCH] fix: small doc updates --- CONTRIBUTING.md | 6 ++++ package.json | 1 + scripts/verify-nitrogen-scroll-edge-bar.js | 40 ++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 scripts/verify-nitrogen-scroll-edge-bar.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e80515a..8df7476 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,6 +48,12 @@ Do not run `nitrogen` directly unless you also rerun: yarn nitrogen:patch ``` +To verify that the generated iOS component still contains the required Fabric lifecycle hooks, run: + +```sh +yarn nitrogen:verify +``` + 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. diff --git a/package.json b/package.json index 61eb72c..cbd886f 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "prepare": "bob build", "nitrogen:generate": "nitrogen", "nitrogen:patch": "node scripts/patch-nitrogen-scroll-edge-bar.js", + "nitrogen:verify": "node scripts/verify-nitrogen-scroll-edge-bar.js", "nitrogen": "yarn nitrogen:generate ./src && yarn nitrogen:patch", "typecheck": "tsc", "lint": "eslint \"**/*.{js,ts,tsx}\"", diff --git a/scripts/verify-nitrogen-scroll-edge-bar.js b/scripts/verify-nitrogen-scroll-edge-bar.js new file mode 100644 index 0000000..36ea5ee --- /dev/null +++ b/scripts/verify-nitrogen-scroll-edge-bar.js @@ -0,0 +1,40 @@ +const fs = require('fs'); +const path = require('path'); + +const file = path.join( + __dirname, + '..', + 'nitrogen', + 'generated', + 'ios', + 'c++', + 'views', + 'HybridRNScrollEdgeBarComponent.mm' +); + +if (!fs.existsSync(file)) { + console.error(`Missing generated file: ${file}`); + process.exit(1); +} + +const source = fs.readFileSync(file, 'utf8'); +const checks = [ + '+ (BOOL)shouldBeRecycled {', + 'return NO;', + '- (void)invalidate', + 'prepareForFabricUnmount', + '- (void)unmountChildComponentView:(UIView *)childComponentView', + '[super unmountChildComponentView:childComponentView index:index];', +]; + +const missing = checks.filter((needle) => !source.includes(needle)); + +if (missing.length > 0) { + console.error('Nitrogen patch verification failed. Missing markers:'); + for (const item of missing) { + console.error(`- ${item}`); + } + process.exit(1); +} + +console.log('Nitrogen patch verification passed.');