Navigate from a stack to another in react native navigation - react-native-navigation

I have two stacks ( Home and Settings ) in the bottom tab bar, how to navigate using REACT NATIVE NAVIGATION from Home to Settings passing a props?

Each of the screen gets 'navigation' as a prop. You can call navigation.navigate("<SCREEN_NAME>") to move to other screen.

Related

How to inject content_script only if the devtools panel is open?

I am trying to create a Chrome extension that adds a panel to the DevTools console.
The extension will have permission to interact with all urls, so to respect my users, I want to ensure that nothing is running when the devtools panel is closed.
The only thing the DevTool panel needs from the attached page (and all of its iframes) is to listen to a custom event dispatched on the respective window (could also be a postMessage)
window.addEventListener('my-custom-event', e => console.log(e.detail))
I understand that you cannot attach listeners directly from the DevTools panel onto the page/frames and you need a content_script to shuttle the messages forward (as described here).
The issue is, the content_script is always appended to the page regardless of whether the panel is open or not. It sets a listener and basically doesn't run unless the listener transfers a port to communicate on.
I would feel irresponsible knowing that my content script runs on every page, potentially impacting the performance of that page so I'd like them to only be attached to the page when the devtools panel is open and the page reloaded.
Ideally I would like to implement a "recording" button which, only when enabled, the content_script is added to the page. This is to avoid noise when doing performance profiling.
So my question is:
Can you inject content_script only when the DevTools panel is open and
Are you able to programmatically toggle content_script injection?

Browser extension: Can I view the string I set with chrome.storage.sync.set for my extension? [duplicate]

Chrome DevTools has a handy inspector for Local Storage and Session Storage, but is there nothing to inspect chrome.storage.sync?
chrome://sync-internals/ doesn't seem to display the actual contents of the synchronized storage per extension.
Storage Area Explorer extension provides a UI for viewing, editing, clearing, importing and exporting of chrome.storage.local, chrome.storage.sync, localStorage and sessionStorage.
In the future this feature may be implemented natively: https://crbug.com/848752.
Warning for ManifestV3: since devtools for service worker doesn't show storage, you'll have to open any visible page of your extension like the popup or options, right-click the page, then click "inspect", then go to Storage Explorer. If your extension doesn't have any visible pages, you can open chrome-extension://ID/manifest.json where ID is the id of the extension as shown in chrome://extensions page. Another method is to right-click any script from your extension in devtools (when you inspect the content script or service worker), then click "Open in a new tab". You can add a bookmark for this tab to open it quickly next time.
Visit chrome://sync-internals/
Click Sync Node Browser tab and wait for it to load (may give a blank screen or in progress cursor)
Click expansion triangle in the sidebar for Extension settings
Click on individual settings in the sidebar to see their values and other metadata
A poor workaround is to call get and obtain all the stored values. Of course, this doesn't let you conveniently edit them:
chrome.storage.sync.get(null, function callback(items) { console.log(items) });

React Native Navigation view list of screens

I'm currently using the react native navigation library. I'm having trouble debugging certain issues and I want to know :
how do you view the stack of screens that are currently pushed?
when you have cascading modals, how do you view their order and do the modal instances have a unique ID?
In case your are using react navigation with redux. You can locate them in the debugger tools which also gives you the order and the unique ID.
something like this.
edit for your comment:
you can watch for state change in redux to determine the current screen. I guess there is no getCurrentScreen. React navigation provides callback for state change which you could use.
onNavigationStateChange={(prevState, newState) => {
// your code to determine screen
})

react-native-router-flux: Jump to specific scene and refresh it

Version
Tell us which versions you are using:
react-native-router-flux v3.40.1 (v3 is not supported)
react-native v0.46.4
Expected behaviour
When I press button, What I expected to go to the specific page and refresh it.
When I use Actions.home({ type: ActionConst.RESET}), it actually go to the home page, but doesn't refresh.
When I use Actions.home({ type:ActionConst.REPLACE}), it go to the home page and refresh it. But When I trigger some actions to refresh the home page again, I will send multiple requests to the backend. I found the issue, it's caused by 'REPLACE', which will keep the old home component in the stack. When I refresh it, it will make all home components refreshed.
Can you help me how to resolve it? I want to go the home page and refresh it and keep only one home component in the stack.
Thanks,
Actions.popTo('yourPage')
and add a callback function
like your props.apply();
and add a function where you have clcked that will be called when page gets apply() function.

Focus is not going inside EventHandler

I had created a simple web part with one label, and one button. I wnat that when i click the button the label content will change.
But when i debugg i found that the focus is not going inside the Button Click Event function.
When i click the button the debugger will again start with page load.
Is there any Autofocus for Button.
Please help me to resolve my problem.
Thanks :)
I think that you're confused about what happens on the client (within the browser) and what happens on the server (in your ASP.NET code).
Most events on server-side controls, like the ASP.NET button, are handled server-side, through a mechanism called postback. The generated code on the browser causes a form submit to the Web server, where the page and its controls are re-created. The form data is parsed and the button control generates (in your case) a Click event for your server-side code. This code regenerates a new HTML page which will replace the old one.
Fortunately for you in this case, the ASP.NET button has a property "OnClientClick" where you can insert JavaScript code to do whatever you want (like change the label text) directly in the browser.
See MSDN for the docs on the property and an example of using both Click and OnClientClick.
Note that this is not related to SharePoint, this is a pure ASP.NET issue.

Resources