| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…ated operations. This is to separate layout operations from text operations
|
test |
Sorry, something went wrong.
|
@SvetoslavTsenov what does that mean? Also I can't see the details log of ci/jenkins/core-modules-tests — FAILed. So I can't see what to fix |
Sorry, something went wrong.
|
Hey @farfromrefug, I have executed some integration tests on our CI (which is internal). The result so far is that unit tests are failing for both platform and uitests app crashes on start up(you can find it in app folder). Could you please rebase your branch again and run unit tests on you side. To do that you can simple do: Let me know if you need some further information. |
Sorry, something went wrong.
|
@SvetoslavTsenov I realised the issue now. On iOS createNativeView is not used. DO you want me to expand that PR to do that? I am willing to but it would be more changes for iOS. |
Sorry, something went wrong.
|
@SvetoslavTsenov still can't see what tests are failing with ci/jenkins/core-modules-tests — FAILed.. Details page brings fail to open page As for the tests app. It succeeds now on iOS but I keep getting waitUntilReady Timeout., Stack: Error: waitUntilReady Timeout. errors on android. Any idea? So not sure how to know what makes the cli fail |
Sorry, something went wrong.
|
Hi @farfromrefug, thanks for the PR and thumbs up for the material components plugin. Just a heads up - the repo you linked to the plugin appears to be private, so we can't take a look. I reviewed the PR, discussed it with the team and we agree with the changes.
That being said, here are some comments on how to improve the PR:
|
Sorry, something went wrong.
|
@MartoYankov Thanks. |
Sorry, something went wrong.
|
@MartoYankov great comments. I will look at all that ! Thanks |
Sorry, something went wrong.
|
@MartoYankov Made changes based on your comments. Should I update all iOS classes or do we do that in another work package? |
Sorry, something went wrong.
|
@farfromrefug I think the two weak references to this are fine and also, updating the other iOS and Android classes can happen in separate PRs, so that they are more manageable. Now, seeing that implemented I have some doubts about the new initNativeViewDelegates method that has a parameter any. It's a bit confusing having both initNativeViewDelegates and initNativeView. What do you think about moving the contents of the initNativeViewDelegates to initNativeView? Will it work for your case? It will have the added benefit that during initNativeView we already have nativeViewProtected, so you won't have to pass parameters. I'm thinking about making a PR to your fork if you are okay with the change. Let me know what you think. |
Sorry, something went wrong.
|
@MartoYankov a PR is fine ! |
Sorry, something went wrong.
|
@farfromrefug That way you would avoid repeating the listeners, but there is still some custom code in initNativeView like assigning the listener owner. Wouldn't it be better if in your inheritor class you call the super.initNativeView() which would initialize the listeners of the base NativeScript core class and then put your custom initNativeView logic there? |
Sorry, something went wrong.
|
@MartoYankov sorry I think I misplaced initNativeView and createNativeView ... Also isn't initNativeView called multiple times? I mean it's called from setNativeView which is called from nativeView setter which could be called often? And there is no check to see if new nativeView is equal to current one. So if called again with same view, initNativeView will be called again and thus all listener created again. BTW I am thinking about upgrading all ui components from that PR. Any issue with that? |
Sorry, something went wrong.
|
@farfromrefug Regarding your first question - yes, the current state of affairs is that iOS components are using their constructors to create and init, while Android components are using createNativeView and initNativeView. As I previously commented, we consider this technical debt and should move the code from all iOS constructors to createNativeView and initNativeView. Regarding your second question - the nativeView setter shouldn't be called often. I'm not sure about the scenario where it was needed, but there is a check if the new value is equal to the current one. The first check in setNativeView should account for that. I'm okay with making the changes to all components in this PR. We have to change the title though. |
Sorry, something went wrong.
| this._ios = new iOSFrame(this); | ||
| this.viewController = this._ios.controller; | ||
| this.nativeViewProtected = this._ios.controller.view; | ||
| this.nativeViewProtected = this.viewController.view; |
There was a problem hiding this comment.
I think you should remove this line. If it stays, there is no need for createNativeView.
Sorry, something went wrong.
There was a problem hiding this comment.
Actually I am not sure. The reason I did that is for nativeViewProtected to be available as soon as the constructor is called. I think it's important from the frame.
Will test this
Sorry, something went wrong.
There was a problem hiding this comment.
I ran the tests and they worked. I'm also conflicted. I think for non UI components (Page, Frame), it might be better to keep the nativeViewProtected in constructor and omit createNativeView.
Sorry, something went wrong.
There was a problem hiding this comment.
Well I have both because if _tearDownUI is called you loose it without being able to get it back.Let me know what you prefer
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, the idea of _tearDownUI is to destroy the components, so that the garbage collection can release them. We are currently not recycling native views. I think for now you can remove this line and keep the one in createNativeView().
Sorry, something went wrong.
|
|
||
| public createNativeView() { | ||
| const view = UIScrollView.new(); | ||
| if (this.orientation === "horizontal") { |
There was a problem hiding this comment.
I think this should be called in initNativeView(). The bonus is we can call updateScrollBarVisibility() method there.
Sorry, something went wrong.
| this.nativeViewProtected = UIScrollView.new(); | ||
| initNativeView() { | ||
| super.initNativeView(); | ||
| if (this.orientation === "horizontal") { |
There was a problem hiding this comment.
We can now remove this if and call this.updateScrollBarVisibility(this.scrollBarIndicatorVisibile) for better code reuse.
Sorry, something went wrong.
|
test |
Sorry, something went wrong.
|
test |
Sorry, something went wrong.
|
test |
Sorry, something went wrong.
|
@farfromrefug Some dialogs and modals UI tests are failing. I know you can't see them, so I'll take care of them. |
Sorry, something went wrong.
|
@MartoYankov ok let me know If I can help in any way |
Sorry, something went wrong.
|
test |
Sorry, something went wrong.
|
test --ignore branch_ns_ui_sidedrawer_demo ios11 api23 |
Sorry, something went wrong.
|
@farfromrefug Thanks for the awesome PR. I hope the material components will come out nicely now. |
Sorry, something went wrong.
|
@MartoYankov Thanks! Yes will update my plugin right now with this. Need some changes on the runtime though (might already be in right now) for that plugin to be published. |
Sorry, something went wrong.
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR propose a simple refactoring to make life easier for plugin developers.
I am writing a plugin which brings material components for iOS and Android.
in material-components, Google simply inherited native components to create material ones (UIButton, UITextField, ...)
So creating a nativescript component was pretty straight forward as I simply had to subclass the corresponding tns components and replace the createNativeView
Except that It was not working for some reasons:
All those are really just refactoring which does not impact Nativescript performances. However they do make plugins more performant because the prevent redefining already defined Nativescript delegate/listener classes. But also because they prevent unused native widget creations for plugins subclassing some Nativescript widget classes like Label.
The only thing I am not sure about if is if createDelegate which I call in createNativeView could be called in initNativeView instead. I am waiting for some feedback from you on this.
PR Checklist
What is the current behavior?
normal
What is the new behavior?
unchanged