File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const UIKIT_DEFINITION_CALLEES = new Set([
77const UIKIT_WORKLET_CALLBACKS = new Set ( [
88 'create' ,
99 'createController' ,
10+ 'childrenView' ,
1011 'dispose' ,
1112 'mounted' ,
1213 'update' ,
Original file line number Diff line number Diff line change @@ -217,6 +217,7 @@ export type UIViewControllerDefinition<
217217 createController : (
218218 ctx : UIKitViewContext < Props & ViewProps > & Readonly < Props & ViewProps > ,
219219 ) => Controller ;
220+ childrenView ?: ( controller : Controller ) => unknown ;
220221} ;
221222
222223export function init ( metadataPath ?: string , options ?: InstallOptions ) : boolean ;
Original file line number Diff line number Diff line change @@ -184,6 +184,7 @@ export type UIViewControllerDefinition<
184184 'create'
185185> & {
186186 createController : ( ctx : UIKitCreateArgument < Props & ViewProps > ) => Controller ;
187+ childrenView ?: ( controller : Controller ) => unknown ;
187188} ;
188189
189190const nativeApiGlobalName = '__nativeScriptNativeApi' ;
@@ -2456,6 +2457,7 @@ export function defineUIViewController<
24562457 return {
24572458 hostView : controllerRecord . view ,
24582459 lifecycleValue : controller ,
2460+ childrenView : definition . childrenView ?.( controller ) ,
24592461 controller,
24602462 } ;
24612463 } ,
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ NativeScript.defineUIViewController({
2929 createController() {
3030 return UIViewController.new();
3131 },
32+ childrenView: (controller) => controller.view,
3233 mounted(controller) {
3334 controller.view.setNeedsLayout();
3435 },
@@ -44,9 +45,10 @@ defineUIKitContainer({
4445
4546const output = transform ( source ) ;
4647const workletDirectiveCount = ( output . match ( / " w o r k l e t " ; / g) || [ ] ) . length ;
47- assert . strictEqual ( workletDirectiveCount , 6 ) ;
48+ assert . strictEqual ( workletDirectiveCount , 7 ) ;
4849assert ( output . includes ( 'create() {\n "worklet";' ) ) ;
4950assert ( output . includes ( 'update: view => {\n "worklet";' ) ) ;
5051assert ( output . includes ( 'createController() {\n "worklet";' ) ) ;
52+ assert ( output . includes ( 'childrenView: controller => {\n "worklet";' ) ) ;
5153
5254console . log ( 'babel plugin tests passed' ) ;
You can’t perform that action at this time.
0 commit comments