NativeScript RTL support - nativescript

My app can have only one language, and it should be aligned RTL.
Currently when I run my app with tns preview the ActionBar labels appears in the left (instead of the right) and so on with any other widget.
I have found some localization plugins but not sure I need them for my case - since I have only one language and text direction.
I have been through all GitHub issues related to RTL but I'm still not sure how to work it out. Any idea how I can force my app and change the layout for RTL language?

You may set the layout direction to RTL at runtime, this would not only update ActionBar but any layout in app will be forced for RTL.
import * as app from 'tns-core-modules/application';
app.android.addEventListener(app.AndroidApplication.activityCreatedEvent, (event: app.AndroidActivityEventData) => {
event.activity.getWindow().getDecorView().setLayoutDirection(android.view.View.LAYOUT_DIRECTION_RTL);
});
Playground Sample

Related

SwiftUI Can't Change the Master Pane Width iPad Landscape

I have a SwiftUI app in full SwiftUI lifecycle that includes a basic Master/Detail style
of data presentation. For the iPad, I need a wider left (Master) pane and don't need the
Detail pane to be as wide as the default.
Apparently I'm not phrasing my searches well enough because I have not found any
articles that discuss this. I have tried setting a frame on the NavigationView, changing
the NavigationViewStyle and a few other wild shots but have not gotten anywhere.
Ideally, I'd like to code it so the user could adjust the width, but I'd settle for
simply being able to make it wider by default.
Here's the idea:
Any guidance would be appreciated. Xcode 12.3 iOS/iPad 14.3

Xamarin.Forms default navigation bar font

In Xamarin.Forms I have created a custom Navigation bar using a StackLayout and Labels for one of my pages. The other pages however are using the default navigation bar. I've tried to make the titles of the custom and default navigation bars look exactly the same but can't quite get it to match.
Is there a way to find out the font size and family of the default navigation bar in Xamarin.Forms?
Yes, there is! Xamarin.Forms is fully open-source, so you can inspect anything the code is doing on GitHub. The magic most likely happens inside the NavigationPage renderers, so check out Xamarin.Forms.Platform.[Target Platform]/Renderers/NavigationPageRenderer.cs.
But in your case this might be overkill, and you might be able to get the information you are interested in using the Xamarin Inspector while your app is running in debug mode.

Is the social boo theme dead in codenameone?

I've been struggling with app dialog and toolbar appearances in the social boo theme for some time. I recently discovered that my struggles are less with my code and more with the theme. In the GUI Builder switching the Native Themes from IOS6, IOS7, and Android (Gingerbread I believe) all create very different dialogs ranging from matching to illegible to ok. Also I found this demo:
https://www.codenameone.com/demos-SocialBoo.html
and ran it on my Android (S6) phone. The below image illustrates the problems:
Social Boo visualizations
Note the Dialog's appearances as they change in the first 3 images. Please note in the 3rd Android picture I'm clicking on the Cancel button to show how differently it paints with the pointer pressed. The 4th image is again from my phone, note the toolbar button on the top right with a square image placed oddly over a rectangular button. Ah finally, all the problems I'm seeing in my app happening elsewhere!
Hopefully my title question now makes more sense. Is the social boo theme being updated with CodenameOne releases or is it dead? Should I abandon using it as it'll have quite varied appearances on devices especially iOS? I'd love to have the theme maintain the IOS6 appearance on all devices - how can I achieve that goal? Thank you in advance for your help!
It's a bit out of date. Most developers just cut a PSD design from scratch which works best when based on a native theme.
You can easily fix these things if you want to work with that theme though. When we implement a theme we don't aim to implement every feature that might be needed as those are hard to predict and will increase the theme size. The original theme didn't include design for dialogs so some behaviors leaked out.
You can use theme constants and UIID's like the theme constant dlgButtonCommandUIID to determine the UIID of the buttons within the dialog.

Implementing a 'toast' feature that's cross platform

I was thinking of a small layout that slides up from the bottom of the
page and disappears after sometime.
There is this plugin I've worked on for the Material Design Snackbar: https://github.com/bradmartin/nativescript-snackbar
There is also the Toast plugin: https://github.com/TobiasHennig/nativescript-toast at one time the plugin dropped iOS support but it looks like a recent contribution was made to fix the iOS version. Since there is not a native toast for iOS from apple, this plugin uses a cocoapod for that platform it looks like.
If you wanted to use your own visuals you could always create a layout that's positioned off the screen using the translate (x) or (y) and then animate it into the view when you want and out after a set time. The possibilites are limitless really.

Difficulty while writing custom renderer for navigation drawer(MasterDetailPage) xamarin.forms

I am using xamarin.forms mvvm light architecture and targeting Android & iOS.
I am currently writing custom renderer for navigation drawer(MasterDetailPage).
I am currently writing custom renderer for Android and i have tried many things.
Currently my MasterDetail Page renders according to OS's default behaviour i.e. in Android master page starts below the app bar but i wanted my master page to popover app bar or start above the app bar like gmail,stack exchange android app etc
use this theme Theme.AppCompat.Light.NoActionBar for the expected behaviour
There exists one already, as of this writing it is out of date though (not targeting Xamarin Forms 2): https://github.com/nativecode-dev/oss-xamarin. Perhaps you can use that?

Resources