react navigation: Navigate to screen from specific screen - react-native

My navigation structure looks something like this:
TabNavigator
|
|- StackNavigator
| |
| |- ListA
| |
| |- ShowA
|
|- StackNavigator
| |
| |- ListB
| |
| |- ShowB
ListA shows, as you might expect, a list of resources (type A). Pressing on one sets the state and navigates you to ShowA where you are viewing details about that specific resource.
ListB shows a list of resources (type B), and ShowB also shows a list of resources, however the resources are of type A. When pressing on one of these resources, you should be navigated to ShowA.
If on ListA I press and navigate to ShowA, that works perfectly.
If on ShowB I press and navigate to ShowA, that also works as expected.
However, if I first go to ListA, navigate to ShowA, then (without pressing 'Back' on ShowA) use the TabNavigator and go to ListB, then to ShowB, pressing on a resource opens ShowA but it's another instance of the screen placed on top of the stack. So when I press 'Back', instead of taking me to ListA as would be expected, it takes me to the previously opened ShowA.
I'm sorry if the formatting or explanation of this is inadequate. If anyone can help or if anyone needs more information please let me know and I'll do whatever I can.

You should register two screens using the same component under different screen names. The structure should look something like this:
Tab:
Stack
"Tab1List"
"Tab1Show"
Stack
"Tab2List"
"Tab2Show"

Related

Break long word at specific point in React Native

I am relatively new to React Native and styling with flex and have been looking for a way to break a long word at a specific point. I only want an optional break in case the word gets too long.
In case 1 (see example) I don't want to break the word, since the component is big enough.
In case 2 the component is too small so the word breaks. I would like to be able to control the breaking position to get something as in case 3.
I am looking for something similar to this solution for HTML, but I cannot use <wbr> or ​ and could not find an equivalent for React Native, if something like that exists.
I have tried using \u00AD as suggested here, but it doesn't seem to insert a break.
Example:
// case1
––––––––––––––––––––––––––––––––––––––––––––––
|ReallyLongWordThatBreaksSomewhere |
| |
––––––––––––––––––––––––––––––––––––––––––––––
// case2
–––––––––––––––––––––––
|ReallyLongWordThatBre|
|aksSomewhere |
| |
–––––––––––––––––––––––
// case3
–––––––––––––––––––––––
|ReallyLongWord |
|ThatBreaks |
|Somewhere |
–––––––––––––––––––––––

Best practice to change component based on URL params in Vue

Just curious, for a route like /chart/:charttype
I want to load different type of chart components into that chart area, how to plan this in VueRouter(currently I only put /chart/:charttype there) and component( currently I put a container component there, inside which, there is a long list of v-if different type of chart components )? Any best practice?
/*
Say I have a long list of diff type of charts,
when charttype matches, it will load that component,
otherwise load 404 component there.
*/
_______________________
| _____________ |
| | | |
| | chart | |
| |___________| |
|_____________________|
I believe current long list of v-if way will be very hard for maintenance, also, in the future, that chart area will be a a group of charts which build a combo chart component(such as 4 charts as a combo chart component), so I guess there has to be a configurable way to do this.
Thanks,
You can check Dynamic Components in the docs
<component :is="componentName"></component>

Named step blocks in SpecFlow

If someone knows, how to use repeating bunches of steps in Specflow, i.e. I need to check several pages, which contain some portion of same elements.
Something like this:
When I open page Page1
Then <do_something>
And I check button 3
When I open page Page2
Then <do_something>
And I check Textfield1
When I open page Page3
Then <do_something>
And I check button 4
<do_something>:
And I check button 1
And I check button 2
As if I have buttons 1 and 2 on each page, and something else in addition, but I dont want to write steps for buttons 1 and 2 for each page.
Maybe something like this?
Scenario Outline: Pages
Given I am on page <page>
When I click on "button 1"
And I click on "button 2"
Then something will happen
Examples:
| page |
| page1 |
| page2 |
| page3 |
Note that anything you place in the Examples table, in the same row as your example, will be used in the context of that example. So say, you want to do specific actions on every page, add this to the row of that page. (#marcel, sorry for copying your code, but I couldn't post this as a commend and format it a.f.a.i.k.)
Scenario Outline: Pages
Given I am on page <page>
When I click on "button 1"
And I do "<action1>"
And I do "<action2>"
Then something will happen
Examples:
| page | action1 | action 2 |
| page1 | action | action |
| page2 | action | action |
| page3 | action | action |

Sharepoint 2010 GlobalNavigationNodes

Good day, I am looking for solution to make custom top navigation menu.
I got site collection and 3-4 nested sites. Builtin top navigation menu shows link like this:
| SiteCollectionLink | NestedSite1 | NestedSite2 | etc.
when i use:
myWeb = SPContext.Current.Web.Site.RootWeb;
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(myWeb);
SPNavigationNodeCollection nodeColl = publishingWeb.Navigation.GlobalNavigationNodes;
foreach (SPNavigationNode node in nodeColl)
{
//node processing
}
i got only NestedSite1 and NestedSite2 as nodes with no main node as it's not in there.
So i wonder how can i take first node?
(builtin navigation menu sohws it as well)
Found out myself, if anyone futher will face it, try this:
SPContext.Current.Site.RootWeb

Clicking on several links part dynamically generated

I'm new in Selenium and testing matters.
I'm trying to capture the id of an hyperlink element that is dynamically part generated.
The click action is recorded like as below when i make click on in selenium, the part in bold are dynamically generated, there are many of them on my page and can differ from one site to another(I'm testing cms). I'd like to capture and click on any one.
This is what I've tried to do since:
storeAttribute | //button#class onclick="setLocation(javascript{baseUrlSelection()}['/checkout/cart/add/uenc/(a-zA-Z0-9)/product/(0-9)]'')" | myid
echo | ${myid} |
clickAndWait | ${myid[0]}
It doesn't work
My links looks like this when click action is recorded in selenium:
buton[#onclick="setLocation('http://localhost/mydomaine/index.php/checkout/cart/add/uenc/aHR0cDovL2xvY2FsaG9zdC9NYWdlbnRvSGls
YWlyZURlbW9WMi9tYWdlbnRvZGVtb0hpbGFpcmVWMi9pbmRleC5waHAvY2F0ZWdvcmllMS5odG1sP19fX1NJRD1V/product/1/')">
Please Help.
Are you using the Selenium IDE? It would probably be much easier to do something using the other development environments, however if you really want to do looping:
Get the looping user-extension from this page
and run a script like this.
store | 0 | myCurrent
storeEval | var pattern=new RegExp("\\w*http://localhost/mydomaine/index.php/checkout/cart/add\\w*");var i=0;var total=0;while(i<window.document.getElementsByTagName('input').length){if (window.document.getElementsByTagName('input')[i].id.match(pattern)){window.document.getElementsByTagName('input')[i].id = 'testID_' + total;total=total+1;}i=i+1;}total; | myTotal
while | storedVars.myCurrent < storedVars.myTotal
storeAttribute | //input[contains(#id,'testID_${myCurrent}')]#class | myid
echo | ${myid}
clickAndWait | //input[contains(#id,'testID_${myCurrent}')]
store | javascript{storedVars.myCurrent++}
endWhile
What does the click on these buttons do? Does it postback the page or anything like that? If so, you'll need to move the storeEval | var pattern.... inside the while loop. What the javascript does is rename all of the inputs on the page that match the RegEx pattern (which you'll probably need to change to match your button ID's) to a sequential ID so you can loop through them easily. If there is a different pattern you can exploit, feel free to do that.
Javascript adapted from here
You can use the xpath contains() function to locate the items:
storeAttribute | //input[contains(#onclick,"setLocation('http://localhost/mydomaine/index.php/checkout/cart/add/uenc/")]#class | myid
echo | ${myid}
clickAndWait | //input[contains(#onclick,"setLocation('http://localhost/mydomaine/index.php/checkout/cart/add/uenc/")]#class
It is also a good idea to reference the elements by something other than their onclick attribute. Id or name would be good choices.