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
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"",
Expand Down
40 changes: 40 additions & 0 deletions scripts/verify-nitrogen-scroll-edge-bar.js
Original file line number Diff line number Diff line change
@@ -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<RCTComponentViewProtocol> *)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.');
Loading