Xamarin.Forms NavigationPage and screen rotation - mvvm

I started Xamarin.Forms and it is great with MVVM pattern.
As main page I use NavigationPage and navigate with PushAsync and PopAsync brteen different pages. This works great if the phone stays in the same orientation. If I rotate screen, Xamarin shows always the first page after rotation.
How can I prevent this? I want to support the screen rotation and don't loose the navigation stack after rotation.

This is possible when running Android. Make sure that your MainActivity class has the ConfigurationChanges attributes. Here is an example:
[Activity(Label = "MYProject.Droid", Icon = "#drawable/icon", Theme = "#style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]

Related

Is there any way to show splashScreen when app is in the background or switching tabs. In ionic 6?

I use privacy-screen plugin to hide content when app is in the background, but it shows just gray background. I need to set splashScreen instead. Any suggestions?
I tried splashScreen plugin, but it is not working for me.
I don't know if it's the best way but I think that using Capacitor appStateChange from #capacitor/app (documentation) you could show and hide a screen with your logo when app is in background or foreground.
import { App } from '#capacitor/app';
App.addListener('appStateChange', ({ isActive }) => {
console.log('App state changed. Is active?', isActive);
if(!isActive) showLogoScreen();
else hideLogoScreen();
});
I hope it helps :)
For iOS, I did it simply in native code: just find the "applicationWillResignActive" method in AppDelegate and insert a view on top of the window.
For Android, sadly I couldn't find a better solution. The "gray background" you described is likely the implementation of Hide screen in 'Recent Apps List', but allow screenshots

Visibility animation of BottomNavigationBar(Android) is somehow not so UI Friendly

A difference in the visibility animation of StatusBar and BottomNavigationBar is perceptible.
All I did was
onTap:(){
makeItFullScreen
? SystemChrome.setEnabledSystemUIOverlays([])
: SystemChrome.setEnabledSystemUIOverlays(
[SystemUiOverlay.bottom, SystemUiOverlay.top]);
makeItFullScreen = !makeItFullScreen;
}
The flickering of that particular part(bottom) of the screen needs to be fixed I guess.
Most of us might not have noticed this because we usually use the white(default) background of our Scaffold.
P.S I tested it on Emulator and on an actual device.

iPhone issue with telerik app

When I focus on text box of hybrid telerik app in iPhone whole screen goes upsidedown. My fixed header position changes. Can anyone provide an explanation as to why this occurs?
document.body.style.overflow = 'hidden';
document.getElementById('loginView').scrolling = 'no';
$("body").addClass("not_scroll");

Smartface Android Header Logo

Can I change this logo to show slider on android? I tried
this.actionbar.logo = "img_source";
in HeaderBar script page, but it didn't change.
Correct property is icon ;
this.actionBar.icon = 'img_source';
You can read more about actionBar from http://www.smartface.io/developer/guides/controls/actionbar/

i have an issue with iScroll4 when I change the orienatation from portrait to landscape on iPhone

I have an issue with iScroll4 when I change the orienatation from portrait to landscape. It is working on AppMobi XDK, but on iPhone, it is not rendering properly. I have tried to trap the orientationchange event and called the refresh method of iScroll with different timeout values, but no luck.
please use jq.scroller.js from the link:
https://github.com/appMobi/jQ.Mobi/tree/master/plugins
It is easy to use with like this:
var options={
verticalScroll:true, //vertical scrolling
horizontalScroll:false, //horizontal scrolling
scrollBars:true //display scrollbars
vScrollCSS : "scrollBarV", //CSS class for veritcal scrollbar
hScrollCSS : "scrollBarH", //CSS class for horizontal scrollbar
refresh:true, //Adds 'Pull to refresh' at the top
refreshFunction:updateMessage //callback function to execute on pull to refresh
}
var scroller = $("#my_div").scroller(options);
Replace #my_div with your Div ID.It will work perfectly.
Thanks
This is a bug with iScroll. I'm a developer at appMobi, and lead developer of jqMobi and our scrolling library does not have this problem.