New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-26284] Android: Cannot add child-views to views extending TiUIFragment #10245
Conversation
Generated by 🚫 dangerJS |
|
||
public void realizeFragmentViews() | ||
{ | ||
for (TiUIView tiUIView : childrenToRealize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we rename tiUIView
into child
?
childrenToRealize.add(child); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ypbnv, we also need to override the insertAt(TiUIView, int)
and remove(TiUIView)
methods. It's an unlikely edge-case, but it should be easy to add support, no?
For example, see our TiUIScrollView
code here...
https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIScrollView.java#L1065
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I thought about insertAt()
, but what I found out took the focus at that moment. I have described it in here:
https://jira.appcelerator.org/browse/TIMOB-26283
Let me know what Gary and you think about that. If insertAt()
needs a fix it will be better to do it for the source before overriding it here.
I will override remove()
, too.
@jquick-axway I tried a few approaches about I have also updated the test case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR: Pass
FR Passed.
Studio Ver: 5.1.1.201809051655 |
@jquick-axway , @garymathews I couldn't come up with a proper unit test for that. On the JS everything looks fine so I wasn't able to write a test that is failing before these changes. Do you have any ideas? |
@ypbnv, perhaps we should keep it simple and do a unit test like the |
FWIW, I tried writing a test like the one Josh pointed out, but it doesn't fail without the changes in this PR. I couldn't come up with a great way to test this either, short of an Appium UI test in our integration suite. I think we're ok to merge as-is. |
…Fragment (tidev#10245) * Handle child-views added before the fragment transaction commit. * Fix formatting. * Override insertAt() and fix realizeViews for multiple views. * Ensure childred are removed from childrenToRealize on remove() call. * Fix formatting.
JIRA: https://jira.appcelerator.org/browse/TIMOB-26284
Optional Description:
Children added before the fragment transaction of the component are left under the fragment. These additions handle them and draws them once the fragment transaction has been committed.
Note: Currently this takes care of only
add()
method. Dealing with positions forinsertAt()
will be added once we clear if it needs reworking.Do we want any special treatment for TiUIFragment implementations?
Test case:
This requires a Ti.Map module built against a SDK with these changes merged.
app.js
I have to think a bit for a possible unit test.