diff --git a/ROADMAP.md b/ROADMAP.md index 4be9f8ac..1019f9cb 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -129,7 +129,7 @@ Reducing per-op cost in tgfx's GL backend is where the remaining gap to - 🟡 **Optional reanimated, for real.** Metro statically bundles the lazily required driver, so consumers without reanimated fail to bundle. Use the Skia-style `Proxy`/optional-require or a separate entry point. -- 🟡 RN-version compatibility matrix (currently pinned to RN 0.85 / Nitro 0.35.9). +- 🟡 RN-version compatibility matrix (currently pinned to RN 0.85 / Nitro 0.37.2). ## Rendering engine (features + perf) diff --git a/apps/benchmark/package.json b/apps/benchmark/package.json index 1198b1f7..f6b2a0b5 100644 --- a/apps/benchmark/package.json +++ b/apps/benchmark/package.json @@ -15,7 +15,7 @@ "@react-native/new-app-screen": "0.85.3", "react-native-safe-area-context": "^5.5.2", "react-native-tgfx": "workspace:*", - "react-native-nitro-modules": "0.36.5", + "react-native-nitro-modules": "0.37.2", "react-native-reanimated": "4.5.3", "react-native-worklets": "0.11.3", "react-native-gesture-handler": "^3.0.2", diff --git a/apps/example/ios/Podfile.lock b/apps/example/ios/Podfile.lock index 1b753cb3..4490b844 100644 --- a/apps/example/ios/Podfile.lock +++ b/apps/example/ios/Podfile.lock @@ -49,7 +49,7 @@ PODS: - ReactCommon/turbomodule/core - ReactNativeDependencies - Yoga - - NitroModules (0.36.5): + - NitroModules (0.37.2): - hermes-engine - RCTRequired - RCTTypeSafety @@ -2486,7 +2486,7 @@ SPEC CHECKSUMS: HarnessUI: f439596aec93ff76765451f834c93f966d54e53e hermes-engine: 58f4822764f3a9815044f59cfb5686c16a84754d NitroImage: 2f592086cbdecbbaa1c10dd97e0cdd43b1bb0817 - NitroModules: 452230d9b63c6c3f59dd97eeaa27ec3449271d4a + NitroModules: 5cd4cd681ddfbf7023b720bb042ff06345acce76 NitroTgfx: c75630aa991b4a7b16fceb0720c65da640960fd9 NitroTgfxCamera: 4829584fec253c1f7c23fdd2b13219ea47870b77 RCTDeprecation: a4c521821fab57cbb125b36effe84d897d0dfa12 diff --git a/apps/example/package.json b/apps/example/package.json index c0629146..a65d0b35 100644 --- a/apps/example/package.json +++ b/apps/example/package.json @@ -16,7 +16,7 @@ "react-native": "0.85.3", "react-native-gesture-handler": "^3.0.2", "react-native-nitro-image": "^0.15.1", - "react-native-nitro-modules": "0.36.5", + "react-native-nitro-modules": "0.37.2", "react-native-reanimated": "4.5.3", "react-native-safe-area-context": "^5.5.2", "react-native-tgfx": "workspace:*", diff --git a/bun.lock b/bun.lock index ca918078..1d080c21 100644 --- a/bun.lock +++ b/bun.lock @@ -19,7 +19,7 @@ "react": "19.2.3", "react-native": "0.85.3", "react-native-gesture-handler": "^3.0.2", - "react-native-nitro-modules": "0.36.5", + "react-native-nitro-modules": "0.37.2", "react-native-reanimated": "4.5.3", "react-native-safe-area-context": "^5.5.2", "react-native-skia": "3.8.1", @@ -57,7 +57,7 @@ "react-native": "0.85.3", "react-native-gesture-handler": "^3.0.2", "react-native-nitro-image": "^0.15.1", - "react-native-nitro-modules": "0.36.5", + "react-native-nitro-modules": "0.37.2", "react-native-reanimated": "4.5.3", "react-native-safe-area-context": "^5.5.2", "react-native-tgfx": "workspace:*", @@ -147,7 +147,7 @@ "peerDependencies": { "react": "*", "react-native": "*", - "react-native-nitro-modules": ">=0.36.5", + "react-native-nitro-modules": ">=0.37.2", "react-native-reanimated": "*", "react-native-worklets": "*", }, @@ -1540,6 +1540,8 @@ "eslint-plugin-jest": ["eslint-plugin-jest@29.15.2", "", { "dependencies": { "@typescript-eslint/utils": "^8.0.0" }, "peerDependencies": { "@typescript-eslint/eslint-plugin": "^8.0.0", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "jest": "*", "typescript": ">=4.8.4 <7.0.0" }, "optionalPeers": ["@typescript-eslint/eslint-plugin", "jest", "typescript"] }, "sha512-kEN4r9RZl1xcsb4arGq89LrcVdOUFII/JSCwtTPJyv16mDwmPrcuEQwpxqZHeINvcsd7oK5O/rhdGlxFRaZwvQ=="], + "eslint-plugin-prettier": ["eslint-plugin-prettier@5.5.6", "", { "dependencies": { "prettier-linter-helpers": "^1.0.1", "synckit": "^0.11.13" }, "peerDependencies": { "@types/eslint": ">=8.0.0", "eslint": ">=8.0.0", "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", "prettier": ">=3.0.0" }, "optionalPeers": ["@types/eslint", "eslint-config-prettier"] }, "sha512-ifetmTcxWfz+4qRW3pH/ujdTq2jQIj59AxJMIN26K5avYgU8dxycUETQonWiW+wPrYXA0j3Try0l1CnwVQtDqQ=="], + "eslint-plugin-react": ["eslint-plugin-react@7.37.5", "", { "dependencies": { "array-includes": "^3.1.8", "array.prototype.findlast": "^1.2.5", "array.prototype.flatmap": "^1.3.3", "array.prototype.tosorted": "^1.1.4", "doctrine": "^2.1.0", "es-iterator-helpers": "^1.2.1", "estraverse": "^5.3.0", "hasown": "^2.0.2", "jsx-ast-utils": "^2.4.1 || ^3.0.0", "minimatch": "^3.1.2", "object.entries": "^1.1.9", "object.fromentries": "^2.0.8", "object.values": "^1.2.1", "prop-types": "^15.8.1", "resolve": "^2.0.0-next.5", "semver": "^6.3.1", "string.prototype.matchall": "^4.0.12", "string.prototype.repeat": "^1.0.0" }, "peerDependencies": { "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" } }, "sha512-Qteup0SqU15kdocexFNAJMvCJEfa2xUKNV4CC1xsVMrIIqEy3SQ/rqyxCWNzfrd3/ldy6HMlD2e0JDVpDg2qIA=="], "eslint-plugin-react-hooks": ["eslint-plugin-react-hooks@7.1.1", "", { "dependencies": { "@babel/core": "^7.24.4", "@babel/parser": "^7.24.4", "hermes-parser": "^0.25.1", "zod": "^3.25.0 || ^4.0.0", "zod-validation-error": "^3.5.0 || ^4.0.0" }, "peerDependencies": { "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0" } }, "sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g=="], @@ -2250,7 +2252,9 @@ "next-themes": ["next-themes@0.4.6", "", { "peerDependencies": { "react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc", "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc" } }, "sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA=="], - "nitrogen": ["nitrogen@0.35.9", "", { "dependencies": { "chalk": "^5.3.0", "react-native-nitro-modules": "^0.35.9", "ts-morph": "^28.0.0", "yargs": "^18.0.0", "zod": "^4.0.5" }, "bin": { "nitrogen": "lib/index.js" } }, "sha512-Qbs45N/9VXYFg4u/nUF4EKw7qmbaVD0vABh5Rq6e3YT1MQP672/EBneMfNXvwOaTf8KW3pIxM01IlEdKS3f8JQ=="], + "nitro-core": ["nitro-core@0.37.2", "", {}, "sha512-dhagikz9VXXzfidRH/vPNJfYWPmTBArDOo9wE/wEqeERU9C8uRWz9YccOyNUOvADccPAZq319yzhDMoJ9excSQ=="], + + "nitrogen": ["nitrogen@0.37.2", "", { "dependencies": { "chalk": "^5.3.0", "nitro-core": "0.37.2", "ts-morph": "^28.0.0", "yargs": "^18.0.0", "zod": "^4.4.3" }, "bin": { "nitrogen": "lib/index.js" } }, "sha512-dqQIrtU9EmFgUa+FLnUeITQRjQGsq3K1rH+fvgRflA64Xmy04oJGXl6arerzsKIocg8nZoWZiq7z803iw+4gNg=="], "nocache": ["nocache@3.0.4", "", {}, "sha512-WDD0bdg9mbq6F4mRxEYcPWwfA1vxd0mrvKOyxI7Xj/atfRHVeutzuWByG//jfm4uPzp0y4Kj051EORCBSQMycw=="], @@ -2440,7 +2444,7 @@ "react-native-nitro-image": ["react-native-nitro-image@0.15.1", "", { "peerDependencies": { "react": "*", "react-native": "*", "react-native-nitro-modules": "*" } }, "sha512-slrImfUgasAdzylTiNWuTkawE0R4t7LGh+7N2VFa/D9+SxlQbkKYp1J6hA3XkkEnTnUCKaea39ZVg+1xx665MQ=="], - "react-native-nitro-modules": ["react-native-nitro-modules@0.36.5", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-SJby84+hovD70JmQ1fq+56tw3oapJeChehUqXA4Gqjm+ktJhMAcj8LGwoAjStSOUwRaK7czbzBPB0Widj+EDoQ=="], + "react-native-nitro-modules": ["react-native-nitro-modules@0.37.2", "", { "dependencies": { "nitro-core": "0.37.2" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-Odnrq/p6/q0R01qZlkqeXu9VHHMuGEnZZmyxMvehEu6QiACNHhBCmAHgyBDqOSo9Lb3G0TscFAT+HG0uxsR/GA=="], "react-native-reanimated": ["react-native-reanimated@4.5.3", "", { "dependencies": { "react-native-is-edge-to-edge": "^1.3.1", "semver": "^7.7.3" }, "peerDependencies": { "react": "*", "react-native": "0.83 - 0.86", "react-native-worklets": "0.10.x - 0.11.x" } }, "sha512-+owIckpD4sA13XKHaLrr8V1RP4paqoxKvz/jy2wl/ULjMsfcRlfIJdKJxR1kcQr4McBZ6hAoPo01NyLnmy2ycQ=="], @@ -3074,6 +3078,8 @@ "eslint-plugin-eslint-comments/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="], + "eslint-plugin-prettier/prettier": ["prettier@3.8.4", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-N2MylSdi48+5N/6S5j+maeHbUSIzzZ5uOcX5Hm4QpV8Dkb1HFjfAKTKX6yNPJQD9AhcT3ifHNB66tWTTJDi11Q=="], + "eslint-plugin-react/doctrine": ["doctrine@2.1.0", "", { "dependencies": { "esutils": "^2.0.2" } }, "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw=="], "eslint-plugin-react/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], @@ -3162,8 +3168,6 @@ "nitrogen/chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="], - "nitrogen/react-native-nitro-modules": ["react-native-nitro-modules@0.35.9", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-yCO6eJ85SPPUo4a4an7H5oj6wPCSIT72fbjr5WZ/20n6zswaJ2gNNpnWtg2We0AZwkAOjSqkOJ0Vjc05p6kGiA=="], - "nitrogen/yargs": ["yargs@18.0.0", "", { "dependencies": { "cliui": "^9.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "string-width": "^7.2.0", "y18n": "^5.0.5", "yargs-parser": "^22.0.0" } }, "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg=="], "node-exports-info/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], @@ -3186,8 +3190,6 @@ "react-native-tgfx/eslint": ["eslint@9.39.4", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.2", "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.5", "@eslint/js": "9.39.4", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.14.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ=="], - "react-native-tgfx/eslint-plugin-prettier": ["eslint-plugin-prettier@5.5.6", "", { "dependencies": { "prettier-linter-helpers": "^1.0.1", "synckit": "^0.11.13" }, "peerDependencies": { "@types/eslint": ">=8.0.0", "eslint": ">=8.0.0", "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", "prettier": ">=3.0.0" }, "optionalPeers": ["@types/eslint", "eslint-config-prettier"] }, "sha512-ifetmTcxWfz+4qRW3pH/ujdTq2jQIj59AxJMIN26K5avYgU8dxycUETQonWiW+wPrYXA0j3Try0l1CnwVQtDqQ=="], - "react-native-tgfx/prettier": ["prettier@3.8.4", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-N2MylSdi48+5N/6S5j+maeHbUSIzzZ5uOcX5Hm4QpV8Dkb1HFjfAKTKX6yNPJQD9AhcT3ifHNB66tWTTJDi11Q=="], "react-native-tgfx-vision-camera/eslint": ["eslint@9.39.4", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.2", "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.5", "@eslint/js": "9.39.4", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.14.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ=="], diff --git a/docs/content/docs/installation.mdx b/docs/content/docs/installation.mdx index 24c490a7..e9256888 100644 --- a/docs/content/docs/installation.mdx +++ b/docs/content/docs/installation.mdx @@ -10,6 +10,8 @@ icon: Download npm install react-native-tgfx@alpha react-native-nitro-modules ``` +`react-native-nitro-modules` must be 0.37.2 or later. + Animation, camera and video also need `react-native-reanimated` and `react-native-worklets`. diff --git a/packages/react-native-tgfx/ios/HybridTgfxView.swift b/packages/react-native-tgfx/ios/HybridTgfxView.swift index 525b939a..0fd01690 100644 --- a/packages/react-native-tgfx/ios/HybridTgfxView.swift +++ b/packages/react-native-tgfx/ios/HybridTgfxView.swift @@ -8,6 +8,8 @@ final class HybridTgfxView: HybridTgfxViewSpec, RecyclableView { private var boundValues: ArrayBuffer? // A JS-thread push and the UI-thread driver both bind, so the pointer and its buffer change together. private let bindLock = NSLock() + // Nitro drops a view right before prepareForRecycle when it pools it, so only a drop without one releases. + private var dropPending = false var view: UIView { metalView } @@ -26,6 +28,7 @@ final class HybridTgfxView: HybridTgfxViewSpec, RecyclableView { } func prepareForRecycle() { + dropPending = false metalView.clearScene() } @@ -131,6 +134,13 @@ final class HybridTgfxView: HybridTgfxViewSpec, RecyclableView { } func onDropView() { - metalView.releaseRenderer() + dropPending = true + let metalView = metalView + DispatchQueue.main.async { [weak self] in + // A freed view was never pooled, so it releases too. + if self?.dropPending ?? true { + metalView.releaseRenderer() + } + } } } diff --git a/packages/react-native-tgfx/ios/TgfxMetalView.mm b/packages/react-native-tgfx/ios/TgfxMetalView.mm index 7d9799f9..ffbca217 100644 --- a/packages/react-native-tgfx/ios/TgfxMetalView.mm +++ b/packages/react-native-tgfx/ios/TgfxMetalView.mm @@ -102,7 +102,10 @@ - (void)commonInit { _layerConfigPending = false; _pendingRecycleClear = false; layer.contentsScale = self.contentScaleFactor; + [self startDisplayLink]; +} +- (void)startDisplayLink { _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(render)]; [_displayLink addToRunLoop:NSRunLoop.mainRunLoop @@ -257,6 +260,12 @@ - (void)didMoveToWindow { if (self.window == nil && _pendingRecycleClear) { [self clearSceneNow]; } + // A released view that gets a window again restarts its display link. + if (self.window != nil && _released) { + _released = false; + [self startDisplayLink]; + [self wakeUp]; + } } - (void)setValues:(const double*)values count:(int32_t)count { @@ -376,6 +385,8 @@ - (void)releaseRenderer { } dispatch_sync(_renderQueue, ^{ self->_renderer->releaseWindow(); + // A draw queued before the drop can bind a window again, and a reused view must rebind. + self->_windowBound = false; }); } diff --git a/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfx+autolinking.cmake b/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfx+autolinking.cmake index 638c81a6..2e28b401 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfx+autolinking.cmake +++ b/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfx+autolinking.cmake @@ -1,7 +1,7 @@ # # NitroTgfx+autolinking.cmake # This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -# https://github.com/mrousavy/nitro +# https://github.com/margelo/nitro # Copyright © Marc Rousavy @ Margelo # diff --git a/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfx+autolinking.gradle b/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfx+autolinking.gradle index 5d23f5da..823016b4 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfx+autolinking.gradle +++ b/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfx+autolinking.gradle @@ -1,7 +1,7 @@ /// /// NitroTgfx+autolinking.gradle /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfxOnLoad.cpp b/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfxOnLoad.cpp index 8692b632..49304692 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfxOnLoad.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfxOnLoad.cpp @@ -1,7 +1,7 @@ /// /// NitroTgfxOnLoad.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfxOnLoad.hpp b/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfxOnLoad.hpp index 98a77d60..2ee06b66 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfxOnLoad.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/android/NitroTgfxOnLoad.hpp @@ -1,7 +1,7 @@ /// /// NitroTgfxOnLoad.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoFactorySpec.cpp b/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoFactorySpec.cpp index 500cf787..63d4f903 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoFactorySpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoFactorySpec.cpp @@ -1,7 +1,7 @@ /// /// JHybridTgfxVideoFactorySpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoFactorySpec.hpp b/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoFactorySpec.hpp index d615bf06..53a3d521 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoFactorySpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoFactorySpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoFactorySpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoSpec.cpp b/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoSpec.cpp index aa2922ca..ba2a329b 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoSpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoSpec.cpp @@ -1,7 +1,7 @@ /// /// JHybridTgfxVideoSpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoSpec.hpp b/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoSpec.hpp index bfd7315a..09ff17ea 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoSpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxVideoSpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoSpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxViewSpec.cpp b/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxViewSpec.cpp index d6b8a5dd..18443983 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxViewSpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxViewSpec.cpp @@ -1,7 +1,7 @@ /// /// JHybridTgfxViewSpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxViewSpec.hpp b/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxViewSpec.hpp index 966f84f9..b39c988c 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxViewSpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/android/c++/JHybridTgfxViewSpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxViewSpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/android/c++/JNativeSnapshot.hpp b/packages/react-native-tgfx/nitrogen/generated/android/c++/JNativeSnapshot.hpp index ea792230..286cdd5d 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/c++/JNativeSnapshot.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/android/c++/JNativeSnapshot.hpp @@ -1,7 +1,7 @@ /// /// JNativeSnapshot.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -19,7 +19,7 @@ namespace margelo::nitro::tgfx { using namespace facebook; /** - * The C++ JNI bridge between the C++ struct "NativeSnapshot" and the the Kotlin data class "NativeSnapshot". + * The C++ JNI bridge between the C++ struct "NativeSnapshot" and the Kotlin data class "NativeSnapshot". */ struct JNativeSnapshot final: public jni::JavaClass { public: diff --git a/packages/react-native-tgfx/nitrogen/generated/android/c++/JNativeSnapshotOptions.hpp b/packages/react-native-tgfx/nitrogen/generated/android/c++/JNativeSnapshotOptions.hpp index b71389c4..dd42e372 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/c++/JNativeSnapshotOptions.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/android/c++/JNativeSnapshotOptions.hpp @@ -1,7 +1,7 @@ /// /// JNativeSnapshotOptions.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -17,7 +17,7 @@ namespace margelo::nitro::tgfx { using namespace facebook; /** - * The C++ JNI bridge between the C++ struct "NativeSnapshotOptions" and the the Kotlin data class "NativeSnapshotOptions". + * The C++ JNI bridge between the C++ struct "NativeSnapshotOptions" and the Kotlin data class "NativeSnapshotOptions". */ struct JNativeSnapshotOptions final: public jni::JavaClass { public: diff --git a/packages/react-native-tgfx/nitrogen/generated/android/c++/views/JHybridTgfxViewStateUpdater.cpp b/packages/react-native-tgfx/nitrogen/generated/android/c++/views/JHybridTgfxViewStateUpdater.cpp index 085a7391..ca692b51 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/c++/views/JHybridTgfxViewStateUpdater.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/android/c++/views/JHybridTgfxViewStateUpdater.cpp @@ -1,7 +1,7 @@ /// /// JHybridTgfxViewStateUpdater.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -15,45 +15,64 @@ namespace margelo::nitro::tgfx::views { using namespace facebook; using ConcreteStateData = react::ConcreteState; -void JHybridTgfxViewStateUpdater::updateViewProps(jni::alias_ref /* class */, - jni::alias_ref javaView, - jni::alias_ref stateWrapperInterface) { - std::shared_ptr hybridView = javaView->getJHybridTgfxViewSpec(); - +std::shared_ptr JHybridTgfxViewStateUpdater::getPropsFromStateWrapper( + jni::alias_ref stateWrapper) { + if (stateWrapper.get() == nullptr) { + return nullptr; + } // Get concrete StateWrapperImpl from passed StateWrapper interface object - jobject rawStateWrapper = stateWrapperInterface.get(); - if (!stateWrapperInterface->isInstanceOf(react::StateWrapperImpl::javaClassStatic())) [[unlikely]] { - throw std::runtime_error("StateWrapper is not a StateWrapperImpl"); + jobject rawStateWrapper = stateWrapper.get(); + if (!stateWrapper->isInstanceOf(react::StateWrapperImpl::javaClassStatic())) [[unlikely]] { + throw std::runtime_error("StateWrapper is not a StateWrapperImpl"); + } + auto stateWrapperImpl = jni::alias_ref{ + static_cast(rawStateWrapper) + }; + std::shared_ptr state = stateWrapperImpl->cthis()->getState(); + if (state == nullptr) { + return nullptr; } - auto stateWrapper = jni::alias_ref{ - static_cast(rawStateWrapper)}; - std::shared_ptr state = stateWrapper->cthis()->getState(); auto concreteState = std::static_pointer_cast(state); const HybridTgfxViewState& data = concreteState->getData(); - const std::shared_ptr& props = data.getProps(); + const std::shared_ptr& props = data.getProps(); if (props == nullptr) [[unlikely]] { - // Props aren't set yet! throw std::runtime_error("HybridTgfxViewState's data doesn't contain any props!"); } + return props; +} + +void JHybridTgfxViewStateUpdater::updateViewProps(jni::alias_ref /* class */, + jni::alias_ref javaView, + jni::alias_ref newState, + jni::alias_ref oldState) { + std::shared_ptr hybridView = javaView->getJHybridTgfxViewSpec(); + std::shared_ptr newProps = getPropsFromStateWrapper(newState); + std::shared_ptr oldProps = getPropsFromStateWrapper(oldState); + if (newProps == nullptr) [[unlikely]] { + throw std::runtime_error("Current StateWrapper doesn't contain any props!"); + } - // Update all props if they are dirty - if (props->inHierarchy.isDirty) { - hybridView->setInHierarchy(props->inHierarchy.value); - props->inHierarchy.isDirty = false; + // Update only props that differ from the previous State snapshot. + if (oldProps == nullptr + ? newProps->inHierarchy.isProvided() + : !newProps->inHierarchy.hasSameValue(oldProps->inHierarchy)) { + hybridView->setInHierarchy(newProps->inHierarchy.get()); } - if (props->opaque.isDirty) { - hybridView->setOpaque(props->opaque.value); - props->opaque.isDirty = false; + if (oldProps == nullptr + ? newProps->opaque.isProvided() + : !newProps->opaque.hasSameValue(oldProps->opaque)) { + hybridView->setOpaque(newProps->opaque.get()); } // Update hybridRef if it changed - if (props->hybridRef.isDirty) { + if (oldProps == nullptr + ? newProps->hybridRef.isProvided() + : !newProps->hybridRef.hasSameValue(oldProps->hybridRef)) { // hybridRef changed - call it with new this - const auto& maybeFunc = props->hybridRef.value; + const auto& maybeFunc = newProps->hybridRef.get(); if (maybeFunc.has_value()) { maybeFunc.value()(hybridView); } - props->hybridRef.isDirty = false; } } diff --git a/packages/react-native-tgfx/nitrogen/generated/android/c++/views/JHybridTgfxViewStateUpdater.hpp b/packages/react-native-tgfx/nitrogen/generated/android/c++/views/JHybridTgfxViewStateUpdater.hpp index a0f9c16a..e222c8f5 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/c++/views/JHybridTgfxViewStateUpdater.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/android/c++/views/JHybridTgfxViewStateUpdater.hpp @@ -1,7 +1,7 @@ /// /// JHybridTgfxViewStateUpdater.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -31,7 +31,12 @@ class JHybridTgfxViewStateUpdater final: public jni::JavaClass /* class */, jni::alias_ref view, - jni::alias_ref stateWrapperInterface); + jni::alias_ref newState, + jni::alias_ref oldState); + +private: + static std::shared_ptr getPropsFromStateWrapper( + jni::alias_ref stateWrapper); public: static void registerNatives() { diff --git a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/HybridTgfxVideoFactorySpec.kt b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/HybridTgfxVideoFactorySpec.kt index 78fcacc8..323c62ad 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/HybridTgfxVideoFactorySpec.kt +++ b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/HybridTgfxVideoFactorySpec.kt @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoFactorySpec.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -10,6 +10,7 @@ package com.margelo.nitro.tgfx import androidx.annotation.Keep import com.facebook.jni.HybridData import com.facebook.proguard.annotations.DoNotStrip +import dalvik.annotation.optimization.FastNative import com.margelo.nitro.core.Promise import com.margelo.nitro.core.HybridObject @@ -43,6 +44,7 @@ abstract class HybridTgfxVideoFactorySpec: HybridObject() { @Keep protected open class CxxPart(javaPart: HybridTgfxVideoFactorySpec): HybridObject.CxxPart(javaPart) { // C++ JHybridTgfxVideoFactorySpec::CxxPart::initHybrid(...) + @FastNative external override fun initHybrid(): HybridData } override fun createCxxPart(): CxxPart { diff --git a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/HybridTgfxVideoSpec.kt b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/HybridTgfxVideoSpec.kt index d3367d69..0514619b 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/HybridTgfxVideoSpec.kt +++ b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/HybridTgfxVideoSpec.kt @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoSpec.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -10,6 +10,7 @@ package com.margelo.nitro.tgfx import androidx.annotation.Keep import com.facebook.jni.HybridData import com.facebook.proguard.annotations.DoNotStrip +import dalvik.annotation.optimization.FastNative import com.margelo.nitro.core.HybridObject /** @@ -90,6 +91,7 @@ abstract class HybridTgfxVideoSpec: HybridObject() { @Keep protected open class CxxPart(javaPart: HybridTgfxVideoSpec): HybridObject.CxxPart(javaPart) { // C++ JHybridTgfxVideoSpec::CxxPart::initHybrid(...) + @FastNative external override fun initHybrid(): HybridData } override fun createCxxPart(): CxxPart { diff --git a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/HybridTgfxViewSpec.kt b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/HybridTgfxViewSpec.kt index eddef428..ec222ff9 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/HybridTgfxViewSpec.kt +++ b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/HybridTgfxViewSpec.kt @@ -1,7 +1,7 @@ /// /// HybridTgfxViewSpec.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -10,6 +10,7 @@ package com.margelo.nitro.tgfx import androidx.annotation.Keep import com.facebook.jni.HybridData import com.facebook.proguard.annotations.DoNotStrip +import dalvik.annotation.optimization.FastNative import com.margelo.nitro.core.ArrayBuffer import com.margelo.nitro.core.Promise import com.margelo.nitro.core.HybridObject @@ -95,6 +96,7 @@ abstract class HybridTgfxViewSpec: HybridView() { @Keep protected open class CxxPart(javaPart: HybridTgfxViewSpec): HybridObject.CxxPart(javaPart) { // C++ JHybridTgfxViewSpec::CxxPart::initHybrid(...) + @FastNative external override fun initHybrid(): HybridData } override fun createCxxPart(): CxxPart { diff --git a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NativeSnapshot.kt b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NativeSnapshot.kt index 12ad67bb..4c4e1a9d 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NativeSnapshot.kt +++ b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NativeSnapshot.kt @@ -1,7 +1,7 @@ /// /// NativeSnapshot.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NativeSnapshotOptions.kt b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NativeSnapshotOptions.kt index 6cde5c76..46ce25b4 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NativeSnapshotOptions.kt +++ b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NativeSnapshotOptions.kt @@ -1,7 +1,7 @@ /// /// NativeSnapshotOptions.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NitroTgfxOnLoad.kt b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NitroTgfxOnLoad.kt index 7239eee1..4e954fca 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NitroTgfxOnLoad.kt +++ b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/NitroTgfxOnLoad.kt @@ -1,7 +1,7 @@ /// /// NitroTgfxOnLoad.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/views/HybridTgfxViewManager.kt b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/views/HybridTgfxViewManager.kt index cd0d5b06..e4c0630d 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/views/HybridTgfxViewManager.kt +++ b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/views/HybridTgfxViewManager.kt @@ -1,7 +1,7 @@ /// /// HybridTgfxViewManager.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -20,6 +20,14 @@ import com.margelo.nitro.tgfx.* * Represents the React Native `ViewManager` for the "TgfxView" Nitro HybridView. */ public class HybridTgfxViewManager: SimpleViewManager() { + /** + * Represents the View and its last state snapshot (mutable) + */ + private class HybridViewHolder( + val hybridView: HybridTgfxView, + var lastState: StateWrapper? = null, + ) + init { if (RecyclableView::class.java.isAssignableFrom(HybridTgfxView::class.java)) { // Enable view recycling @@ -34,38 +42,46 @@ public class HybridTgfxViewManager: SimpleViewManager() { override fun createViewInstance(reactContext: ThemedReactContext): View { val hybridView = HybridTgfxView(reactContext) val view = hybridView.view - view.setTag(associated_hybrid_view_tag, hybridView) + view.setTag(associated_hybrid_view_tag, HybridViewHolder(hybridView)) return view } override fun updateState(view: View, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? { - val hybridView = getHybridView(view) + val holder = getHybridViewHolder(view) ?: throw Error("Couldn't find view $view in local views table!") + val hybridView = holder.hybridView + val oldState = holder.lastState + val newState = stateWrapper // 1. Update each prop individually hybridView.beforeUpdate() - HybridTgfxViewStateUpdater.updateViewProps(hybridView, stateWrapper) + HybridTgfxViewStateUpdater.updateViewProps(hybridView, newState, oldState) hybridView.afterUpdate() + holder.lastState = newState // 2. Continue in base View props - return super.updateState(view, props, stateWrapper) + return super.updateState(view, props, newState) } override fun onDropViewInstance(view: View) { - val hybridView = getHybridView(view) - hybridView?.onDropView() + val holder = getHybridViewHolder(view) + holder?.lastState = null + holder?.hybridView?.onDropView() return super.onDropViewInstance(view) } protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? { - super.prepareToRecycleView(reactContext, view) - val hybridView = getHybridView(view) + val preparedView = super.prepareToRecycleView(reactContext, view) + ?: return null + val holder = getHybridViewHolder(preparedView) ?: return null + val hybridView = holder.hybridView + holder.lastState = null - @Suppress("USELESS_IS_CHECK") - if (hybridView is RecyclableView) { + val recyclableView = (hybridView as Any) as? RecyclableView + if (recyclableView != null) { // Recycle in it's implementation - hybridView.prepareForRecycle() + recyclableView.prepareForRecycle() // Maybe update the view if it changed return hybridView.view @@ -74,7 +90,7 @@ public class HybridTgfxViewManager: SimpleViewManager() { } } - private fun getHybridView(view: View): HybridTgfxView? { - return view.getTag(associated_hybrid_view_tag) as? HybridTgfxView + private fun getHybridViewHolder(view: View): HybridViewHolder? { + return view.getTag(associated_hybrid_view_tag) as? HybridViewHolder } } diff --git a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/views/HybridTgfxViewStateUpdater.kt b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/views/HybridTgfxViewStateUpdater.kt index 618df595..2f1be13e 100644 --- a/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/views/HybridTgfxViewStateUpdater.kt +++ b/packages/react-native-tgfx/nitrogen/generated/android/kotlin/com/margelo/nitro/tgfx/views/HybridTgfxViewStateUpdater.kt @@ -1,7 +1,7 @@ /// /// HybridTgfxViewStateUpdater.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -14,10 +14,10 @@ internal class HybridTgfxViewStateUpdater { companion object { /** * Updates the props for [view] through C++. - * The [state] prop is expected to contain [view]'s props as wrapped Fabric state. + * The [newState] prop is expected to contain [view]'s props as wrapped Fabric state. */ @Suppress("KotlinJniMissingFunction") @JvmStatic - external fun updateViewProps(view: HybridTgfxViewSpec, state: StateWrapper) + external fun updateViewProps(view: HybridTgfxViewSpec, newState: StateWrapper, oldState: StateWrapper?) } } diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx+autolinking.rb b/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx+autolinking.rb index 90c9a038..cb7388b0 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx+autolinking.rb +++ b/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx+autolinking.rb @@ -1,7 +1,7 @@ # # NitroTgfx+autolinking.rb # This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -# https://github.com/mrousavy/nitro +# https://github.com/margelo/nitro # Copyright © Marc Rousavy @ Margelo # diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Bridge.cpp b/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Bridge.cpp index e72ba629..f8ca75ac 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Bridge.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Bridge.cpp @@ -1,7 +1,7 @@ /// /// NitroTgfx-Swift-Cxx-Bridge.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Bridge.hpp b/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Bridge.hpp index d22fc0e2..8b649a9c 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Bridge.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Bridge.hpp @@ -1,7 +1,7 @@ /// /// NitroTgfx-Swift-Cxx-Bridge.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Umbrella.hpp b/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Umbrella.hpp index 48d9cc18..d06a5eff 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Umbrella.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfx-Swift-Cxx-Umbrella.hpp @@ -1,7 +1,7 @@ /// /// NitroTgfx-Swift-Cxx-Umbrella.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfxAutolinking.mm b/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfxAutolinking.mm index fadb70e3..bcad0872 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfxAutolinking.mm +++ b/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfxAutolinking.mm @@ -1,7 +1,7 @@ /// /// NitroTgfxAutolinking.mm /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfxAutolinking.swift b/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfxAutolinking.swift index 5e090974..86b006e1 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfxAutolinking.swift +++ b/packages/react-native-tgfx/nitrogen/generated/ios/NitroTgfxAutolinking.swift @@ -1,7 +1,7 @@ /// /// NitroTgfxAutolinking.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -31,8 +31,4 @@ public final class NitroTgfxAutolinking { return __cxxWrapped.getCxxPart() }() } - - public static func isTgfxVideoFactoryRecyclable() -> Bool { - return HybridTgfxVideoFactory.self is any RecyclableView.Type - } } diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoFactorySpecSwift.cpp b/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoFactorySpecSwift.cpp index ef883def..237a8ad2 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoFactorySpecSwift.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoFactorySpecSwift.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoFactorySpecSwift.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoFactorySpecSwift.hpp b/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoFactorySpecSwift.hpp index 023d58b7..c9179439 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoFactorySpecSwift.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoFactorySpecSwift.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoFactorySpecSwift.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoSpecSwift.cpp b/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoSpecSwift.cpp index 9c5b68a9..158364c0 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoSpecSwift.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoSpecSwift.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoSpecSwift.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoSpecSwift.hpp b/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoSpecSwift.hpp index bb3c4bb9..a8857284 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoSpecSwift.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxVideoSpecSwift.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoSpecSwift.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxViewSpecSwift.cpp b/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxViewSpecSwift.cpp index d2d8c53a..5271f7d1 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxViewSpecSwift.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxViewSpecSwift.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxViewSpecSwift.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxViewSpecSwift.hpp b/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxViewSpecSwift.hpp index 1f3c519b..0d5e5c63 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxViewSpecSwift.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/ios/c++/HybridTgfxViewSpecSwift.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxViewSpecSwift.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/c++/views/HybridTgfxViewComponent.mm b/packages/react-native-tgfx/nitrogen/generated/ios/c++/views/HybridTgfxViewComponent.mm index e18a52a3..d6bb9f97 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/c++/views/HybridTgfxViewComponent.mm +++ b/packages/react-native-tgfx/nitrogen/generated/ios/c++/views/HybridTgfxViewComponent.mm @@ -1,7 +1,7 @@ /// /// HybridTgfxViewComponent.mm /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -37,6 +37,7 @@ + (BOOL)shouldBeRecycled; @implementation HybridTgfxViewComponent { std::shared_ptr _hybridView; + BOOL _didDropView; } + (void) load { @@ -50,6 +51,7 @@ + (void) load { - (instancetype) init { if (self = [super init]) { + _props = HybridTgfxViewShadowNode::defaultSharedProps(); std::shared_ptr hybridView = NitroTgfx::NitroTgfxAutolinking::createTgfxView(); _hybridView = std::dynamic_pointer_cast(hybridView); [self updateView]; @@ -69,40 +71,61 @@ - (void) updateView { [self setContentView:view]; } +- (void) notifyOnDropView { + // A recycled component can later be invalidated. Notify only once per mount. + if (_didDropView) { + return; + } + NitroTgfx::HybridTgfxViewSpec_cxx& swiftPart = _hybridView->getSwiftPart(); + swiftPart.onDropView(); + _didDropView = YES; +} + - (void) updateProps:(const std::shared_ptr&)props oldProps:(const std::shared_ptr&)oldProps { + // A props update marks a newly mounted or still-active component. + _didDropView = NO; + // 1. Downcast props - const auto& newViewPropsConst = *std::static_pointer_cast(props); - auto& newViewProps = const_cast(newViewPropsConst); + const auto& newViewProps = *std::static_pointer_cast(props); + const auto* oldViewProps = static_cast(oldProps.get()); NitroTgfx::HybridTgfxViewSpec_cxx& swiftPart = _hybridView->getSwiftPart(); - // 2. Update each prop individually - swiftPart.beforeUpdate(); - - // inHierarchy: boolean - if (newViewProps.inHierarchy.isDirty) { - swiftPart.setInHierarchy(newViewProps.inHierarchy.value); - newViewProps.inHierarchy.isDirty = false; - } - // opaque: boolean - if (newViewProps.opaque.isDirty) { - swiftPart.setOpaque(newViewProps.opaque.value); - newViewProps.opaque.isDirty = false; - } - - swiftPart.afterUpdate(); + // 2. Update only props that differ from the previous Props snapshot. + const bool hasTransactionPropChanges = oldViewProps == nullptr + ? newViewProps.hasAnyProvidedProps() + : !newViewProps.hasSameProps(*oldViewProps); + if (hasTransactionPropChanges) { + swiftPart.beforeUpdate(); + + // inHierarchy: boolean + if (oldViewProps == nullptr + ? newViewProps.inHierarchy.isProvided() + : !newViewProps.inHierarchy.hasSameValue(oldViewProps->inHierarchy)) { + swiftPart.setInHierarchy(newViewProps.inHierarchy.get()); + } + // opaque: boolean + if (oldViewProps == nullptr + ? newViewProps.opaque.isProvided() + : !newViewProps.opaque.hasSameValue(oldViewProps->opaque)) { + swiftPart.setOpaque(newViewProps.opaque.get()); + } - // 3. Update hybridRef if it changed - if (newViewProps.hybridRef.isDirty) { - // hybridRef changed - call it with new this - const auto& maybeFunc = newViewProps.hybridRef.value; - if (maybeFunc.has_value()) { - maybeFunc.value()(_hybridView); + // Update hybridRef if it changed + if (oldViewProps == nullptr + ? newViewProps.hybridRef.isProvided() + : !newViewProps.hybridRef.hasSameValue(oldViewProps->hybridRef)) { + // hybridRef changed - call it with new this + const auto& maybeFunc = newViewProps.hybridRef.get(); + if (maybeFunc.has_value()) { + maybeFunc.value()(_hybridView); + } } - newViewProps.hybridRef.isDirty = false; + + swiftPart.afterUpdate(); } - // 4. Continue in base class + // 3. Continue in base class [super updateProps:props oldProps:oldProps]; } @@ -111,6 +134,7 @@ + (BOOL)shouldBeRecycled { } - (void)prepareForRecycle { + [self notifyOnDropView]; [super prepareForRecycle]; NitroTgfx::HybridTgfxViewSpec_cxx& swiftPart = _hybridView->getSwiftPart(); swiftPart.maybePrepareForRecycle(); @@ -118,8 +142,7 @@ - (void)prepareForRecycle { #ifdef ENABLE_RCT_COMPONENT_VIEW_INVALIDATE - (void)invalidate { - NitroTgfx::HybridTgfxViewSpec_cxx& swiftPart = _hybridView->getSwiftPart(); - swiftPart.onDropView(); + [self notifyOnDropView]; [super invalidate]; } #endif diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void.swift b/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void.swift index 24c6ed12..37a561a4 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void.swift +++ b/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void.swift @@ -1,7 +1,7 @@ /// /// Func_void.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void_NativeSnapshot.swift b/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void_NativeSnapshot.swift index 0159ff7e..8d98835a 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void_NativeSnapshot.swift +++ b/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void_NativeSnapshot.swift @@ -1,7 +1,7 @@ /// /// Func_void_NativeSnapshot.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift b/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift index 72aba4d9..c66aab80 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +++ b/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift @@ -1,7 +1,7 @@ /// /// Func_void_std__exception_ptr.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_HybridTgfxVideoSpec_.swift b/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_HybridTgfxVideoSpec_.swift index 5084b1c1..60b5b3a0 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_HybridTgfxVideoSpec_.swift +++ b/packages/react-native-tgfx/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_HybridTgfxVideoSpec_.swift @@ -1,7 +1,7 @@ /// /// Func_void_std__shared_ptr_HybridTgfxVideoSpec_.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoFactorySpec.swift b/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoFactorySpec.swift index ef067113..7dcd3d8a 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoFactorySpec.swift +++ b/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoFactorySpec.swift @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoFactorySpec.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoFactorySpec_cxx.swift b/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoFactorySpec_cxx.swift index 7eb12433..e14274e5 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoFactorySpec_cxx.swift +++ b/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoFactorySpec_cxx.swift @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoFactorySpec_cxx.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -27,7 +27,7 @@ open class HybridTgfxVideoFactorySpec_cxx { /** * Holds an instance of the `HybridTgfxVideoFactorySpec` Swift protocol. */ - private var __implementation: any HybridTgfxVideoFactorySpec + private let __implementation: any HybridTgfxVideoFactorySpec /** * Holds a weak pointer to the C++ class that wraps the Swift class. @@ -75,7 +75,7 @@ open class HybridTgfxVideoFactorySpec_cxx { */ public func getCxxPart() -> bridge.std__shared_ptr_HybridTgfxVideoFactorySpec_ { let cachedCxxPart = self.__cxxPart.lock() - if Bool(fromCxx: cachedCxxPart) { + if cachedCxxPart.use_count() > 0 { return cachedCxxPart } else { let newCxxPart = bridge.create_std__shared_ptr_HybridTgfxVideoFactorySpec_(self.toUnsafe()) diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoSpec.swift b/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoSpec.swift index cf52c467..cc086a51 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoSpec.swift +++ b/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoSpec.swift @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoSpec.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoSpec_cxx.swift b/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoSpec_cxx.swift index 4c3324fa..d4e810c1 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoSpec_cxx.swift +++ b/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxVideoSpec_cxx.swift @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoSpec_cxx.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -27,7 +27,7 @@ open class HybridTgfxVideoSpec_cxx { /** * Holds an instance of the `HybridTgfxVideoSpec` Swift protocol. */ - private var __implementation: any HybridTgfxVideoSpec + private let __implementation: any HybridTgfxVideoSpec /** * Holds a weak pointer to the C++ class that wraps the Swift class. @@ -75,7 +75,7 @@ open class HybridTgfxVideoSpec_cxx { */ public func getCxxPart() -> bridge.std__shared_ptr_HybridTgfxVideoSpec_ { let cachedCxxPart = self.__cxxPart.lock() - if Bool(fromCxx: cachedCxxPart) { + if cachedCxxPart.use_count() > 0 { return cachedCxxPart } else { let newCxxPart = bridge.create_std__shared_ptr_HybridTgfxVideoSpec_(self.toUnsafe()) diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxViewSpec.swift b/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxViewSpec.swift index 2f1d78d9..ac4ca9e8 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxViewSpec.swift +++ b/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxViewSpec.swift @@ -1,7 +1,7 @@ /// /// HybridTgfxViewSpec.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxViewSpec_cxx.swift b/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxViewSpec_cxx.swift index ea5f37a5..bf091037 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxViewSpec_cxx.swift +++ b/packages/react-native-tgfx/nitrogen/generated/ios/swift/HybridTgfxViewSpec_cxx.swift @@ -1,7 +1,7 @@ /// /// HybridTgfxViewSpec_cxx.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// @@ -27,7 +27,7 @@ open class HybridTgfxViewSpec_cxx { /** * Holds an instance of the `HybridTgfxViewSpec` Swift protocol. */ - private var __implementation: any HybridTgfxViewSpec + private let __implementation: any HybridTgfxViewSpec /** * Holds a weak pointer to the C++ class that wraps the Swift class. @@ -75,7 +75,7 @@ open class HybridTgfxViewSpec_cxx { */ public func getCxxPart() -> bridge.std__shared_ptr_HybridTgfxViewSpec_ { let cachedCxxPart = self.__cxxPart.lock() - if Bool(fromCxx: cachedCxxPart) { + if cachedCxxPart.use_count() > 0 { return cachedCxxPart } else { let newCxxPart = bridge.create_std__shared_ptr_HybridTgfxViewSpec_(self.toUnsafe()) diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/swift/NativeSnapshot.swift b/packages/react-native-tgfx/nitrogen/generated/ios/swift/NativeSnapshot.swift index 1a322e7c..4a132a5f 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/swift/NativeSnapshot.swift +++ b/packages/react-native-tgfx/nitrogen/generated/ios/swift/NativeSnapshot.swift @@ -1,7 +1,7 @@ /// /// NativeSnapshot.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/ios/swift/NativeSnapshotOptions.swift b/packages/react-native-tgfx/nitrogen/generated/ios/swift/NativeSnapshotOptions.swift index 58f6eca5..2bb17d0f 100644 --- a/packages/react-native-tgfx/nitrogen/generated/ios/swift/NativeSnapshotOptions.swift +++ b/packages/react-native-tgfx/nitrogen/generated/ios/swift/NativeSnapshotOptions.swift @@ -1,7 +1,7 @@ /// /// NativeSnapshotOptions.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/CacheInfo.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/CacheInfo.hpp index 6b3dd4ad..a42fa2ce 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/CacheInfo.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/CacheInfo.hpp @@ -1,7 +1,7 @@ /// /// CacheInfo.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/GlyphPosition.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/GlyphPosition.hpp index e475122d..4ea6075f 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/GlyphPosition.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/GlyphPosition.hpp @@ -1,7 +1,7 @@ /// /// GlyphPosition.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferFactorySpec.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferFactorySpec.cpp index 82824643..348e6a40 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferFactorySpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferFactorySpec.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxBufferFactorySpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferFactorySpec.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferFactorySpec.hpp index 0593733c..b84be204 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferFactorySpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferFactorySpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxBufferFactorySpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferSpec.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferSpec.cpp index 663f2626..5307b90f 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferSpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferSpec.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxBufferSpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferSpec.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferSpec.hpp index 54d76f14..f54091ac 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferSpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxBufferSpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxBufferSpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxFontsSpec.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxFontsSpec.cpp index 49583531..ac904418 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxFontsSpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxFontsSpec.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxFontsSpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxFontsSpec.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxFontsSpec.hpp index dde57b8c..a68014a1 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxFontsSpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxFontsSpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxFontsSpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageFactorySpec.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageFactorySpec.cpp index 1a0df2d8..cd335e60 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageFactorySpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageFactorySpec.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxImageFactorySpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageFactorySpec.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageFactorySpec.hpp index a3d97a7d..596bceb1 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageFactorySpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageFactorySpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxImageFactorySpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageSpec.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageSpec.cpp index 75ae55d2..e8ec162f 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageSpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageSpec.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxImageSpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageSpec.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageSpec.hpp index 63eae7c6..e6f246d2 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageSpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxImageSpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxImageSpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceFactorySpec.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceFactorySpec.cpp index f79f31c5..a09c25ef 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceFactorySpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceFactorySpec.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxOffscreenSurfaceFactorySpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceFactorySpec.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceFactorySpec.hpp index d1edaaa5..b081bde5 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceFactorySpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceFactorySpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxOffscreenSurfaceFactorySpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceSpec.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceSpec.cpp index 0b7a0d84..1daf5354 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceSpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceSpec.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxOffscreenSurfaceSpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceSpec.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceSpec.hpp index b20b014f..67dd14aa 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceSpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxOffscreenSurfaceSpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxOffscreenSurfaceSpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxPathSpec.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxPathSpec.cpp index 6581cc35..47de1f78 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxPathSpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxPathSpec.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxPathSpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxPathSpec.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxPathSpec.hpp index 79bccca6..7990db83 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxPathSpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxPathSpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxPathSpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsFactorySpec.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsFactorySpec.cpp index 3ba9011f..81da3cdd 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsFactorySpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsFactorySpec.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxSlotsFactorySpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsFactorySpec.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsFactorySpec.hpp index 438063db..c759c3a2 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsFactorySpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsFactorySpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxSlotsFactorySpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsSpec.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsSpec.cpp index 0c3be164..f8c4553e 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsSpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsSpec.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxSlotsSpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsSpec.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsSpec.hpp index 99729a9f..6fccfea8 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsSpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxSlotsSpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxSlotsSpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoFactorySpec.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoFactorySpec.cpp index 703ce03f..4a9a5cd8 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoFactorySpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoFactorySpec.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoFactorySpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoFactorySpec.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoFactorySpec.hpp index f3e57ad4..283c35b4 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoFactorySpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoFactorySpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoFactorySpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoSpec.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoSpec.cpp index 1d042e06..2d5d6c60 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoSpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoSpec.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoSpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoSpec.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoSpec.hpp index 36173e67..80ec6d97 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoSpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxVideoSpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxVideoSpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxViewSpec.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxViewSpec.cpp index 8d4b63a8..2ac85f7d 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxViewSpec.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxViewSpec.cpp @@ -1,7 +1,7 @@ /// /// HybridTgfxViewSpec.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxViewSpec.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxViewSpec.hpp index 45a09686..f8b09543 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxViewSpec.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/HybridTgfxViewSpec.hpp @@ -1,7 +1,7 @@ /// /// HybridTgfxViewSpec.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/ImageSampling.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/ImageSampling.hpp index 6643539e..a2ae1c24 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/ImageSampling.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/ImageSampling.hpp @@ -1,7 +1,7 @@ /// /// ImageSampling.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/LineMeasurement.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/LineMeasurement.hpp index 5ca70285..c845f7f1 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/LineMeasurement.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/LineMeasurement.hpp @@ -1,7 +1,7 @@ /// /// LineMeasurement.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/NativeSnapshot.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/NativeSnapshot.hpp index d2179e0d..886b22d8 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/NativeSnapshot.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/NativeSnapshot.hpp @@ -1,7 +1,7 @@ /// /// NativeSnapshot.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/NativeSnapshotOptions.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/NativeSnapshotOptions.hpp index 639a3af4..9f2f02ab 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/NativeSnapshotOptions.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/NativeSnapshotOptions.hpp @@ -1,7 +1,7 @@ /// /// NativeSnapshotOptions.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/Orientation.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/Orientation.hpp index d55ee35f..021cdadb 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/Orientation.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/Orientation.hpp @@ -1,7 +1,7 @@ /// /// Orientation.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/PathBounds.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/PathBounds.hpp index ce40c9da..8c1527aa 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/PathBounds.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/PathBounds.hpp @@ -1,7 +1,7 @@ /// /// PathBounds.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/PathPoint.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/PathPoint.hpp index f07ee71d..e338c53e 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/PathPoint.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/PathPoint.hpp @@ -1,7 +1,7 @@ /// /// PathPoint.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/PixelFormat.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/PixelFormat.hpp index 50e58694..b4f9d56d 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/PixelFormat.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/PixelFormat.hpp @@ -1,7 +1,7 @@ /// /// PixelFormat.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/TextBox.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/TextBox.hpp index 1b4a0d12..90f45099 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/TextBox.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/TextBox.hpp @@ -1,7 +1,7 @@ /// /// TextBox.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/TextLayoutStyle.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/TextLayoutStyle.hpp index 14e08c05..ffa5e33a 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/TextLayoutStyle.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/TextLayoutStyle.hpp @@ -1,7 +1,7 @@ /// /// TextLayoutStyle.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/TextMeasurement.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/TextMeasurement.hpp index 5ad5ced0..d8314aa9 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/TextMeasurement.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/TextMeasurement.hpp @@ -1,7 +1,7 @@ /// /// TextMeasurement.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/views/HybridTgfxViewComponent.cpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/views/HybridTgfxViewComponent.cpp index 4cec90f7..47390e5e 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/views/HybridTgfxViewComponent.cpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/views/HybridTgfxViewComponent.cpp @@ -1,61 +1,33 @@ /// /// HybridTgfxViewComponent.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// #include "HybridTgfxViewComponent.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include namespace margelo::nitro::tgfx::views { + using namespace facebook; + extern const char HybridTgfxViewComponentName[] = "TgfxView"; HybridTgfxViewProps::HybridTgfxViewProps(const react::PropsParserContext& context, const HybridTgfxViewProps& sourceProps, const react::RawProps& rawProps): react::ViewProps(context, sourceProps, rawProps, filterObjectKeys), - inHierarchy([&]() -> CachedProp { - try { - const react::RawValue* rawValue = rawProps.at("inHierarchy", nullptr, nullptr); - if (rawValue == nullptr) return sourceProps.inHierarchy; - const auto& [runtime, value] = (std::pair)*rawValue; - return CachedProp::fromRawValue(*runtime, value, sourceProps.inHierarchy); - } catch (const std::exception& exc) { - throw std::runtime_error(std::string("TgfxView.inHierarchy: ") + exc.what()); - } - }()), - opaque([&]() -> CachedProp { - try { - const react::RawValue* rawValue = rawProps.at("opaque", nullptr, nullptr); - if (rawValue == nullptr) return sourceProps.opaque; - const auto& [runtime, value] = (std::pair)*rawValue; - return CachedProp::fromRawValue(*runtime, value, sourceProps.opaque); - } catch (const std::exception& exc) { - throw std::runtime_error(std::string("TgfxView.opaque: ") + exc.what()); - } - }()), - hybridRef([&]() -> CachedProp& /* ref */)>>> { - try { - const react::RawValue* rawValue = rawProps.at("hybridRef", nullptr, nullptr); - if (rawValue == nullptr) return sourceProps.hybridRef; - const auto& [runtime, value] = (std::pair)*rawValue; - return CachedProp& /* ref */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, PropNameIDCache::get(*runtime, "f")), sourceProps.hybridRef); - } catch (const std::exception& exc) { - throw std::runtime_error(std::string("TgfxView.hybridRef: ") + exc.what()); - } - }()) { } + inHierarchy(nitro::ReactProp::fromRawValue("TgfxView", "inHierarchy", rawProps, sourceProps.inHierarchy)), + opaque(nitro::ReactProp::fromRawValue("TgfxView", "opaque", rawProps, sourceProps.opaque)), + hybridRef(nitro::ReactProp& /* ref */)>>>::fromRawValue("TgfxView", "hybridRef", rawProps, sourceProps.hybridRef)) { +#ifdef ANDROID + nitro::RawPropsCompat::initializeDynamicProps(*this, sourceProps, rawProps, filterObjectKeys); +#endif + } bool HybridTgfxViewProps::filterObjectKeys(const std::string& propName) { switch (hashString(propName)) { @@ -66,29 +38,4 @@ namespace margelo::nitro::tgfx::views { } } - HybridTgfxViewComponentDescriptor::HybridTgfxViewComponentDescriptor(const react::ComponentDescriptorParameters& parameters) - : ConcreteComponentDescriptor(parameters, - react::RawPropsParser(/* enableJsiParser */ true)) {} - - std::shared_ptr HybridTgfxViewComponentDescriptor::cloneProps(const react::PropsParserContext& context, - const std::shared_ptr& props, - react::RawProps rawProps) const { - // 1. Prepare raw props parser - rawProps.parse(rawPropsParser_); - // 2. Copy props with Nitro's cached copy constructor - return HybridTgfxViewShadowNode::Props(context, /* & */ rawProps, props); - } - -#ifdef ANDROID - void HybridTgfxViewComponentDescriptor::adopt(react::ShadowNode& shadowNode) const { - // This is called immediately after `ShadowNode` is created, cloned or in progress. - // On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++. - auto& concreteShadowNode = static_cast(shadowNode); - const std::shared_ptr& constProps = concreteShadowNode.getConcreteSharedProps(); - const std::shared_ptr& props = std::const_pointer_cast(constProps); - HybridTgfxViewState state{props}; - concreteShadowNode.setStateData(std::move(state)); - } -#endif - } // namespace margelo::nitro::tgfx::views diff --git a/packages/react-native-tgfx/nitrogen/generated/shared/c++/views/HybridTgfxViewComponent.hpp b/packages/react-native-tgfx/nitrogen/generated/shared/c++/views/HybridTgfxViewComponent.hpp index b6de20f2..68ecb537 100644 --- a/packages/react-native-tgfx/nitrogen/generated/shared/c++/views/HybridTgfxViewComponent.hpp +++ b/packages/react-native-tgfx/nitrogen/generated/shared/c++/views/HybridTgfxViewComponent.hpp @@ -1,20 +1,21 @@ /// /// HybridTgfxViewComponent.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. -/// https://github.com/mrousavy/nitro +/// https://github.com/margelo/nitro /// Copyright © Marc Rousavy @ Margelo /// #pragma once -#include -#include -#include -#include -#include -#include +#include +#include +#include #include #include +#include +#include + +#include #include #include "HybridTgfxViewSpec.hpp" @@ -41,9 +42,23 @@ namespace margelo::nitro::tgfx::views { const react::RawProps& rawProps); public: - CachedProp inHierarchy; - CachedProp opaque; - CachedProp& /* ref */)>>> hybridRef; + nitro::ReactProp inHierarchy; + nitro::ReactProp opaque; + nitro::ReactProp& /* ref */)>>> hybridRef; + + [[nodiscard]] + bool hasSameProps(const HybridTgfxViewProps& other) const noexcept { + return inHierarchy.hasSameValue(other.inHierarchy) && + opaque.hasSameValue(other.opaque) && + hybridRef.hasSameValue(other.hybridRef); + } + + [[nodiscard]] + bool hasAnyProvidedProps() const noexcept { + return inHierarchy.isProvided() || + opaque.isProvided() || + hybridRef.isProvided(); + } private: static bool filterObjectKeys(const std::string& propName); @@ -52,32 +67,7 @@ namespace margelo::nitro::tgfx::views { /** * State for the "TgfxView" View. */ - class HybridTgfxViewState final { - public: - HybridTgfxViewState() = default; - explicit HybridTgfxViewState(const std::shared_ptr& props): - _props(props) {} - - public: - [[nodiscard]] - const std::shared_ptr& getProps() const { - return _props; - } - - public: -#ifdef ANDROID - HybridTgfxViewState(const HybridTgfxViewState& /* previousState */, folly::dynamic /* data */) {} - folly::dynamic getDynamic() const { - throw std::runtime_error("HybridTgfxViewState does not support folly!"); - } - react::MapBuffer getMapBuffer() const { - throw std::runtime_error("HybridTgfxViewState does not support MapBuffer!"); - }; -#endif - - private: - std::shared_ptr _props; - }; + using HybridTgfxViewState = nitro::ViewPropsHolderState; /** * The Shadow Node for the "TgfxView" View. @@ -90,21 +80,7 @@ namespace margelo::nitro::tgfx::views { /** * The Component Descriptor for the "TgfxView" View. */ - class HybridTgfxViewComponentDescriptor final: public react::ConcreteComponentDescriptor { - public: - explicit HybridTgfxViewComponentDescriptor(const react::ComponentDescriptorParameters& parameters); - - public: - /** - * A faster path for cloning props - reuses the caching logic from `HybridTgfxViewProps`. - */ - std::shared_ptr cloneProps(const react::PropsParserContext& context, - const std::shared_ptr& props, - react::RawProps rawProps) const override; -#ifdef ANDROID - void adopt(react::ShadowNode& shadowNode) const override; -#endif - }; + using HybridTgfxViewComponentDescriptor = nitro::ViewComponentDescriptor; /* The actual view for "TgfxView" needs to be implemented in platform-specific code. */ diff --git a/packages/react-native-tgfx/package.json b/packages/react-native-tgfx/package.json index 6cdc0205..bc5d42b4 100644 --- a/packages/react-native-tgfx/package.json +++ b/packages/react-native-tgfx/package.json @@ -117,7 +117,7 @@ "peerDependencies": { "react": "*", "react-native": "*", - "react-native-nitro-modules": ">=0.36.5", + "react-native-nitro-modules": ">=0.37.2", "react-native-reanimated": "*", "react-native-worklets": "*" },