nitrogen 0.35.1-beta.1 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/syntax/swift/SwiftHybridObjectBridge.js +4 -0
- package/lib/views/kotlin/KotlinHybridViewManager.js +12 -2
- package/lib/views/swift/SwiftHybridViewManager.js +6 -0
- package/package.json +2 -2
- package/src/syntax/swift/SwiftHybridObjectBridge.ts +5 -0
- package/src/views/kotlin/KotlinHybridViewManager.ts +12 -2
- package/src/views/swift/SwiftHybridViewManager.ts +6 -0
package/README.md
CHANGED
|
@@ -46,6 +46,10 @@ public final func maybePrepareForRecycle() {
|
|
|
46
46
|
guard let recyclable = __implementation as? any RecyclableView else { return }
|
|
47
47
|
recyclable.prepareForRecycle()
|
|
48
48
|
}
|
|
49
|
+
`.trim(), `
|
|
50
|
+
public final func onDropView() {
|
|
51
|
+
__implementation.onDropView()
|
|
52
|
+
}
|
|
49
53
|
`.trim());
|
|
50
54
|
}
|
|
51
55
|
const hybridObject = new HybridObjectType(spec);
|
|
@@ -53,7 +53,7 @@ public class ${manager}: SimpleViewManager<View>() {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
override fun updateState(view: View, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? {
|
|
56
|
-
val hybridView = view
|
|
56
|
+
val hybridView = getHybridView(view)
|
|
57
57
|
?: throw Error("Couldn't find view $view in local views table!")
|
|
58
58
|
|
|
59
59
|
// 1. Update each prop individually
|
|
@@ -65,9 +65,15 @@ public class ${manager}: SimpleViewManager<View>() {
|
|
|
65
65
|
return super.updateState(view, props, stateWrapper)
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
override fun onDropViewInstance(view: View) {
|
|
69
|
+
val hybridView = getHybridView(view)
|
|
70
|
+
hybridView?.onDropView()
|
|
71
|
+
return super.onDropViewInstance(view)
|
|
72
|
+
}
|
|
73
|
+
|
|
68
74
|
protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? {
|
|
69
75
|
super.prepareToRecycleView(reactContext, view)
|
|
70
|
-
val hybridView = view
|
|
76
|
+
val hybridView = getHybridView(view)
|
|
71
77
|
?: return null
|
|
72
78
|
|
|
73
79
|
@Suppress("USELESS_IS_CHECK")
|
|
@@ -81,6 +87,10 @@ public class ${manager}: SimpleViewManager<View>() {
|
|
|
81
87
|
return null
|
|
82
88
|
}
|
|
83
89
|
}
|
|
90
|
+
|
|
91
|
+
private fun getHybridView(view: View): ${viewImplementation}? {
|
|
92
|
+
return view.getTag(associated_hybrid_view_tag) as? ${viewImplementation}
|
|
93
|
+
}
|
|
84
94
|
}
|
|
85
95
|
`.trim();
|
|
86
96
|
const updaterKotlinCode = `
|
|
@@ -126,6 +126,12 @@ using namespace ${namespace}::views;
|
|
|
126
126
|
swiftPart.maybePrepareForRecycle();
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
- (void)invalidate {
|
|
130
|
+
${swiftNamespace}::${HybridTSpecCxx}& swiftPart = _hybridView->getSwiftPart();
|
|
131
|
+
swiftPart.onDropView();
|
|
132
|
+
[super invalidate];
|
|
133
|
+
}
|
|
134
|
+
|
|
129
135
|
@end
|
|
130
136
|
`;
|
|
131
137
|
return [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitrogen",
|
|
3
|
-
"version": "0.35.1
|
|
3
|
+
"version": "0.35.1",
|
|
4
4
|
"description": "The code-generator for react-native-nitro-modules.",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"chalk": "^5.3.0",
|
|
38
|
-
"react-native-nitro-modules": "^0.35.1
|
|
38
|
+
"react-native-nitro-modules": "^0.35.1",
|
|
39
39
|
"ts-morph": "^27.0.0",
|
|
40
40
|
"yargs": "^18.0.0",
|
|
41
41
|
"zod": "^4.0.5"
|
|
@@ -69,6 +69,11 @@ public final func maybePrepareForRecycle() {
|
|
|
69
69
|
guard let recyclable = __implementation as? any RecyclableView else { return }
|
|
70
70
|
recyclable.prepareForRecycle()
|
|
71
71
|
}
|
|
72
|
+
`.trim(),
|
|
73
|
+
`
|
|
74
|
+
public final func onDropView() {
|
|
75
|
+
__implementation.onDropView()
|
|
76
|
+
}
|
|
72
77
|
`.trim()
|
|
73
78
|
)
|
|
74
79
|
}
|
|
@@ -75,7 +75,7 @@ public class ${manager}: SimpleViewManager<View>() {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
override fun updateState(view: View, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? {
|
|
78
|
-
val hybridView = view
|
|
78
|
+
val hybridView = getHybridView(view)
|
|
79
79
|
?: throw Error("Couldn't find view $view in local views table!")
|
|
80
80
|
|
|
81
81
|
// 1. Update each prop individually
|
|
@@ -87,9 +87,15 @@ public class ${manager}: SimpleViewManager<View>() {
|
|
|
87
87
|
return super.updateState(view, props, stateWrapper)
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
override fun onDropViewInstance(view: View) {
|
|
91
|
+
val hybridView = getHybridView(view)
|
|
92
|
+
hybridView?.onDropView()
|
|
93
|
+
return super.onDropViewInstance(view)
|
|
94
|
+
}
|
|
95
|
+
|
|
90
96
|
protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? {
|
|
91
97
|
super.prepareToRecycleView(reactContext, view)
|
|
92
|
-
val hybridView = view
|
|
98
|
+
val hybridView = getHybridView(view)
|
|
93
99
|
?: return null
|
|
94
100
|
|
|
95
101
|
@Suppress("USELESS_IS_CHECK")
|
|
@@ -103,6 +109,10 @@ public class ${manager}: SimpleViewManager<View>() {
|
|
|
103
109
|
return null
|
|
104
110
|
}
|
|
105
111
|
}
|
|
112
|
+
|
|
113
|
+
private fun getHybridView(view: View): ${viewImplementation}? {
|
|
114
|
+
return view.getTag(associated_hybrid_view_tag) as? ${viewImplementation}
|
|
115
|
+
}
|
|
106
116
|
}
|
|
107
117
|
`.trim()
|
|
108
118
|
|
|
@@ -150,6 +150,12 @@ using namespace ${namespace}::views;
|
|
|
150
150
|
swiftPart.maybePrepareForRecycle();
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
- (void)invalidate {
|
|
154
|
+
${swiftNamespace}::${HybridTSpecCxx}& swiftPart = _hybridView->getSwiftPart();
|
|
155
|
+
swiftPart.onDropView();
|
|
156
|
+
[super invalidate];
|
|
157
|
+
}
|
|
158
|
+
|
|
153
159
|
@end
|
|
154
160
|
`
|
|
155
161
|
|