Making sure the route specified in initialRouteName is always added as the first screen in the stack - react-navigation

Our app have multiple tabs, each tab contains a stack.
We need to be able to navigate from a screen in a stack belonging to one tab to a specific screen in a stack belonging to another tab. This can be done like so navigation.navigate("tab2", {screen:"screen2"}).
We are using react-navigation version 5
Current Behavior
The problem is that if I have not navigated to the initial route for the destination stack(route) before, screen2 is now the only screen in the stack. I need somehow to always make sure that the screen specified in the initialRouteName is added to the stack first.
Expected Behavior
If you specify initialRouteName that route is always added as the first route in the stack, even if you navigate to a specific route defined in the stack.
Setting lazy=false, would solve the issue, but it's important to not initialise the "initial route screen" before actual navigating to a screen in the stack.
It might be that this is work as designed, but are there any way to achieve the behavior I expect then?
How to reproduce
The issue/problem can be reproduced in this snack
Click the "Navigate to Screen2 on Tab 2" button on "tab1". Make sure you have not clicked on Tab2 before doing this.
You are now navigated to Screen2 on Tab2 with no option to navigation to the screen specified in initialRouteName.
This is more of less a copy of this issue

Found that you actual can navigate to a nested navigator and make sure the route specified in initialRouteName is the initial route. It can be done by specifying initial:false like so:
navigation.navigate("tab2", {screen:"screen2", initial: false})
Documentation can be found here

Related

Managing fixed header with anchor/section points

I've read many posts about this, but never found something satisfying and I wonder if perhaps new techniques have been developed since those posts.
Basically, I have a fixed navigation header on my site, and a search bar that will get nested and fixed just under it as users start scrolling down.
Most of my anchor/section links are located on different pages than where the user is getting re-directed to when clicking them (so, no "smooth scroll" is happening).
I cannot add padding or a class manually to each of these points because most of them are generated automatically...
Is there perhaps some jquery I could apply that would automatically show these anchor/sections point lower in the screen?
Help :)

is it possible to scroll to specific position in browsing?

I am no programmar nor tech savvy person myself.
I just wanna know if it's possible to achieve this goal:
The default behavior of the browser(e.g. chrome) is it sends one page up or page down depending on where I click(above or below scroll thumb).
But when clicking somewhere on the scroll track, I wish it navigates right through the target position in the web page.
for better understanding, here's the screenshot of cnn.com main page for reference:
(In first screnshot, I highlighted where I will click.
Second screenshot is the default behavior of the browser as a result.
Third screenshot is what I want realize for my own convenience. it's useful when navigating through long articles.)
I think it is almost impossible to do this on my part because maybe it's hardcoded in browser's engine level or something, but I wanted to make sure it really is.
or any workaround like making autohotkey script or something?
thank you so much!
There seems to exist a trick with Shift, but it doesn't work in browsers.
However, you are manipulating a browser, and browsers have a built-in scripting language — JavaScript. Here's the setup you need to do:
Go to the place on the page you want to scroll to.
Open the developer console (Ctrl+Shift+I and then click on the "Console" tab). This shouldn't interfere with the scroll position.
Type window.scrollY and press Enter.
After that, the console will output the amount of vertical scrolling. In the following AutoHotkey code I'll use 12345 as an example; replace it with the value you have. Note that it also scrolls to the left margin.
Send {F6}javascript:window.scrollTo(0,12345)`%3Bvoid`%200{Enter}
It appears that, due to a bug, this doesn't work in Firefox.
I know your problem, I think chrome must have this config, you can type in the address bar "chrome://chrome-urls" for searching

Finding all available activities/fragments for an app that's not yours

When decompiling an app, I find lately, that a few apps' manifests do not seem to have designated activities for the view I want. For example, if com.example.app is on the view I want and I run the following command:
dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
the resultant output will be something like:
mCurrentFocus=Window{9280f2a u0 com.example.app/com.example.app.MainSubMenu}
mFocusedApp=AppWindowToken{da37759 token=Token{9d56fa0 ActivityRecord{5c490a3 u0 com.example.app/.MainSubMenu t98}}}
This is fine, but when the screen I am on is obviously a subactivity/subview/fragment, dumpsys nor logcat will show me the full path to this view. In short, I would like to find the name of the fragment/view and launch directly to it. This syntax looks promising for achieving a fragment view launch (perhaps with some variation):
am start -n com.example.app/.MainSubMenu -e :android:show_fragment com.example.app.somefragmentview
but I am unsure of how to find all fragment names for each activity of the app.
I ended up using AutoInput in combination with MacroDroid to select specific elements of the app's main (launch) screen, based on text. This gets me to any screen of an app without having to rely on touch event coordinates, since developers of these apps typically switch up menu item locations with subsequent updates.
Here is the AutoInput process in detail (which I imagine can be integrated with Tasker as well):
Install both aforementioned apps.
When selecting an Action for MacroDroid, choose the 'Locale/Tasker Plugin' option. This will list AutoInput's options, and any other options for different plugins you've downloaded, I suppose.
Choose the 'AutoInput Action' option from the list.
Select 'Action' from the next screen, then 'Click'.
For 'Field Type' choose 'Text', or any other piece of information you know about the menu/button/element that you would ordinarily select to get to the screen you want. We are talking about a menu/button/element that exists on the main (launch) screen of your app.
Fill in 'Field Text' with the menu/button/element's text.
Hit the checkmark at the top right when you are finished, and it will return you to MacroDroid.
A few notes:
The menu/button/element MUST be visible on the main (launch) screen for AutoInput to identify and select it. The initial menu item I was attempting to open could only be reached by scrolling down first. To remedy this, I told MacroDroid to run a script with an 'input swipe' command first to make the menu item visible.
If your target menu/button/element is not on the main (launch) screen, you will have to follow up your initial AutoInput Action with subsequent AutoInput Actions until you reach the menu/button/element/screen you want. The screen I wanted was twice removed from the main (launch) screen.
Maybe it goes without saying, but I separated each AutoInput Action with an appropriate pause (in MacroDroid, Actions-->'Wait Before Next Action') to select each menu/button/element while accounting for screen load time.
This is all a bit obtuse, I realize, but without knowing how to extract the (has extras) information from Logcat, this was the only available solution that didn't force me to rely on coordinates for touch events. Hopefully this offers a viable alternative until someone finds/offers a way to pull raw extra data from activities.

show NSUserNotification additionalActions on click

In the image above you can see two notifications on OS X. The first one is from my app and the second is from Apple's Reminders.app. In the image you can see the otherButtonTitle 'Complete' and the actionButtonTitle 'Later'.
The second notification, i.e. the one from Reminders.app behaves quite differently. It gets this little arrow pointing downwards on mouse over indicating that there are more actions when clicked. And indeed, you just need to click once on 'Later' and it will give you a couple more options to choose from.
However, I can't get the same behavior to work for my notification. I don't get the little arrow on mouse over and I don't get more options displayed from a single click on 'Later' (notification just gets dismissed). More options only get displayed when holding down the mouse button on 'Later' which is not obvious.
Am I missing something obvious here? How can I get my notification to have exactly the same as the ones from the Reminders.app?
While trying to find a solution for the same problem I found this nice explanation for the NSUserNotificationPrivate class that explains how the Reminders app does it.
https://github.com/indragiek/NSUserNotificationPrivate
If the notification type is set to "Alert", the alternateActionButtonTitles property lets you set an array of additional menu item titles to be shown in an action menu that can be accessed by hovering on the Action button and clicking on the arrow.
Once a notification is handled, the index of the action can be retrieved using the _alternateActionIndex property.
So they are using a private API. As the site's disclaimer say using any of this will result in your app being rejected from the MAS and potentially breaking if the APIs change.

Inno Setup jump to specified wizard page

Is there a way to jump to the specified wizard page? Backward and forward?
For example, I would add "Configure again" button in the wpReady, and when the button is clicked, I want to jump to wpInfoBefore.
You can't, at least not sanely. It's possible to fake mouseclicks on the Back/Next buttons, and use ShouldSkipPage, which would get you the desired effect, but it's very bad practice and potentially fragile.
If the user has made a mistake in the previous pages, then they should just go back however many pages are actually required (which might not be the full complement) and fix it. This is especially important when the contents of one page are dependent on the selections made on an earlier page, as jumping back too far would typically result in some of the user's choices being discarded.

Resources