Welcome to your tape…
Hi guys, I truly believe in native fuse integration so I just want to share the reasons why my team has to go fully native for the last project (:
Workflow feels broken
- Test view using Fuse Studio in a common UX
- When is ready, compile but first change the UX :S
<FilesView ux:Template="FilesView" />
- So is compiled!! yay!.. BUT now copy the aar file to native project, clean and rebuild. (This is automated using a shell script).
As you can see it’s a pain to make a simple change, the good thing is that the workflow could improve a lot just by using common UX to export the Fuse.View
As far as I know Fuse.Views wraps the content in a NativeViewHost to get a native feeling, that’s great!
And here is when I say “but” … but NativeViewHost isn’t production ready. For example in Android doesn’t show images and the Element Alignment works differently. I’m working with Fuse 1.5(build 15046) idk if this is fixed in fuselibs-master. Later I’ll post a minimal reproduction.
Invoke a JS function from native
Actually Fuse.Views has 3 methods to Interop between native and fuse,
setCallback. How can I trigger a JS function from native?
Cheers! And thanks for a great tool.
TL;DR Broken workflow, buggy NativeViewHost and missing interop method between JS and native.
EDIT: Not fully markdown emoji support
Thanks for the detailed feedback!
We definitely agree that the workflow with Fuse Views would benefit from some improvements - especially around how it’s integrated into the native app. However, let’s dive into your points for some more detail.
You actually don’t need to change your UX between the design/testing and export phases.
<!-- I use this to flag my exports -->
<!-- And here I test my stuff at dev / design-time -->
<ExportedViews> and any templates it contains will be ignored during normal preview and build.
Of course, the manual copying of files and so on is still not ideal (we’d like to automate it at some point and perhaps even give you real-time preview after the component has been integrated into your app) but as you mentioned it can to some extent be scripted for now.
- In general Images should work on Android. However, there are some combinations of stretch modes and layout that might bug. It’d be good to see some UX markup for the cases that don’t work for you.
- We use the same layout engine inside NativeViewHost as everywhere else so Element alignment should be the same. If you can provide some example of where it isn’t then that’d be great!
But yes, as you’ve noticed there are definitely areas where the NativeViewHost experience isn’t good enough. We’re working to improve that so any hints and bug reports are helpful.
If it works for your use case then you can of course also build your custom components using
<GraphicsView>. In that case you’ll get the normal Fuse cross-platform UI even when exporting Fuse Views. (There might be some performance penalties when using this on Android though, but it’s definitely worth testing out).
Yes, Fuse Views are explicitly designed so that the components you build can receive data from and call back to native code.
Can you provide some more info on the use case you want to solve by calling “into” the Fuse components JS? Hopefully we can work out some other way of handling it.
Thanks Remi for your kind answer.
That workaround it’s super useful, thanks!
The problem with android images happens when I used them inside any trigger. Doesn’t show the image.
<Image File="Assets/empty_state.png" Opacity="0.7"/>
About the alignment issue, I’m seeing that it’s actually a custom font problem, here is a minimal reproduction.
<Circle Fill="#EF4836" Width="40" Height="40" Alignment="Center">
<!--Image File="../Assets/icon_delete.png" Width="14" Color="#fff" Alignment="Center" /-->
<Text Value="X" Alignment="TopCenter" TextColor="#fff" FontSize="20" Font="Comfortaa" />
3, The problem I try to solve it’s to push an element to an Observable List from native.
This can be accomplished using the current native methods but it feels a little bit wrong dealing with the same data in both native and Fuse.
Thank you for your feedback, its very helpful.
<Image /> inside a trigger issue sounds like a bug. I will look into that.
I dont think there are any easy ways to fix the text alignment issue, as you said yourself its due to the font. And when using
<Text /> inside a
<NativeViewHost /> you get android’s native text view which does the measuring of the string. Maybe an alternative is creating this with shapes or make png assets.