Is there any way to close an overlay - react-native-navigation

I am using react-native-navigation v2 and showing an overlay,
and at some place in my code. i want to show an over lay and later disable it .
for example to show loading.
I have Read the docs and followed it as much I could understand. I can show an overlay but can not dismiss it. A warning always comes up saying - overlay with id offlineoverlay1 was not found.
async showOverLay(){
await Navigation.showOverlay({
component: {
id: "OfflineOverlay1",
name: 'Uploading',
options: {
overlay: {
interceptTouchOutside: true
}
}
}
});
}
async closeOverLay(){
await Navigation.dismissOverlay('OfflineOverlay1')
}
Expected Result- the overlay should be closed when calling closeOverLay() function

you have defined
component :{id:"OfflineOverlay1"} // the use of ""
but you have called like this,
Navigation.dismissOverlay('OfflineOverlay1') // & the use of ''

Related

How to access custom cms element config values in Shopware 6?

FYI: Products is my cms element name.
As shown in shopware 6 guides, I have created a file
DataResolver/ProductsCmsElementResolver.php
which has an enrich method which helps to extend data. In there I try to access the configs of my custom cms element with:
$config = $slot->getFieldConfig();
$productListType = $config->get('products')->getValue();
That, however always returns the default value that was set during the registration of the element:
Shopware.Service('cmsService').registerCmsElement({
name: 'products',
label: 'das.elements.customProductsElement.label',
component: 'sw-cms-el-products',
configComponent: 'sw-cms-el-config-products',
previewComponent: 'sw-cms-el-preview-products',
defaultConfig: {
products: {
source: 'static',
value: ''
}
}
});
I did it exactly as it is shown in the following guides:
https://developer.shopware.com/docs/guides/plugins/plugins/content/cms/add-cms-element
https://developer.shopware.com/docs/guides/plugins/plugins/content/cms/add-data-to-cms-elements#create-a-data-resolver
Could anyone share a sample of code where you get the value of config as a variable and not static value?
What I was doing wrong was that I forgot to write the .value in computed methods:
computed: {
products() {
return this.element.config.products.value;
}
},
However I also found such function call in shopware source codes which was not mentioned in the docs:
methods: {
createdComponent() {
this.initElementConfig('youtube-video');
this.initElementData('youtube-video'); // this line was not present in docs
}
}
I assume you haven't done any further handling of the product data in your config component, as you do not mention it.
I suggest having a look at the default cms components like for example shopware/administration/Resources/app/administration/src/module/sw-cms/elements/product-slider/config/index.js where you can see how product data is handled :)

PDFTron Trigger Editing of Annotation for annotations when added

I have added a custom annotation and listened to annotationAdded event and select the annotation using below code.
instance.docViewer
.getTool("AnnotationCreateCustomStamp")
.on('annotationAdded',
function (a) {
instance.annotManager.selectAnnotation(a);
});
How should I trigger the edit mode on the annotation?
What does your 'AnnotationCreateCustomStamp' tool look like? Does it trigger an 'annotationAdded' action and get to your callback function?
You can open the note panel and start editing with the 'focusNote' API
instance.docViewer.getTool("AnnotationCreateCustomStamp").on('annotationAdded',
function (a) {
// assuming the code get here
instance.focusNote(a.Id);
})
);
Update:
For focusing on replies of selected annotations, you can use the getSelectedAnnotations method and do something like
instance.focusNote(docViewer.annotationManager.getSelectedAnnotations()[0].Id)
Or you can use the annotationSelected event and do something like
WebViewer(
{
// your configuration
}, document.getElementById('viewer'))
.then(function(instance) {
const { annotManager } = instance;
annotManager.on('annotationSelected', (annots) => {
if(annots && annots[0]) {
instance.focusNote(annots[0].Id);
}
});
})

Navigating to detail views in SwiftUI using core data

I'm trying to build an example BBQ app to learn SwiftUI (XCode 11 beta 5), and have been unable to figure out how to navigate to an object's detail view from a list view of objects coming from Core Data. Xcode is unhelpful, mostly popping unrelated errors depending on what I try.
I've tried applying state, bindings, observable objects etc to the best of my logical ability but haven't been able to crack it.
Here is my list view, which builds just fine, and allows me to navigate to destination (which is just a view containing the id property as a string):
struct CookListView: View {
#ObservedObject var cookListVM: CookListViewModel
#State var cookCreatorVM = CookCreatorViewModel()
init() {
cookListVM = CookListViewModel()
}
var body: some View {
NavigationView {
List {
ForEach(cookListVM.cooks, id: \.id) { cook in
NavigationLink(destination: Text("\(cook.id)")) {
VStack {
Text(cook.protein)
}
}
}
}.navigationBarTitle("BBQ")
}
}
}
But if I change my NavigationLink destination like so:
NavigationView {
List {
ForEach(cookListVM.cooks, id: \.id) { cook in
NavigationLink(destination: CookDetailView(cook: cook)) {
VStack {
Text(cook.protein)
}
}
}
}
}
Xcode will no longer build the project. The errors it gives me seem somewhat unrelated, such as Type '_' has no member 'id' on the ForEach line, or if I remove , id: \.id from the ForEach (which I don't really need thanks to Identifiable), I'll get Type of expression is ambiguous without more context on the Text(cook.protein) line.
If I use a hard-coded array it builds and can navigate perfectly well. The issue only arises when I'm trying to use Core Data.
My CookDetailView looks like this:
struct CookDetailView: View {
var cook: Cook
var body: some View {
VStack {
Text("\(cook.protein!)")
}
}
}
And the model for the Cook object itself looks like this:
class CookViewModel: ObservableObject, Identifiable {
var protein: String = ""
var type: String = ""
var id: UUID = UUID()
init(cook: Cook){
self.protein = cook.protein!
self.type = cook.type!
self.id = UUID()
}
}
It's also been set up thru the .xcdatamodeld file.
I'm more than happy to add in any additional/omitted code, such as how I'm writing to/reading from core data, if that would be helpful.
I can totally identify with your frustration with Xcode's error messages. The actual error is often nowhere near the error message. [Sug: use source control and commit after each clean compile ;-) ] The error that you are getting in your List view is because you specified a wrong type in your detail view's argument list. Try the following:
struct CookDetailView: View {
var cook: CookViewModel
var body: some View {
VStack {
Text("\(cook.name)")
}
}
}
By the way, since you are fetching into an array, you will not observe changes in that array unless you manually publish them. I gave up on trying to get my NSManagedObject subclasses to publish their own changes. There are two ways to workaround that. You can call objectWillChange from NSFetchedResultsController's controllerDidChangeContent delegate or you can do the same while observing NSManagedObjectContextDidSave notifications when not using a fetched results controller.
This answer is applicable to Beta 5. Things will certainly change in future betas.

Setting the Group Bypass property of a Node

I can't seem to find an answer from the documentation http://origen-sdk.org/origen/guides/program/flowapi/
From SmartTest 7.1.3 and later of Advantest, we have the option to set “Group Bypass” property of the Group node testflow component.
{
run_and_branch(TestA)
then
{
}
else
{
if #Alarm then
{
binout;
}
else
{
}
}
run_and_branch(TestB)
then
{
}
else
{
if #Alarm then
{
binout;
}
else
{
}
}
}, groupbypass, open,"DataCollectionTests", ""
I tried using if_flag:, continue: and if_enable properties in my group definition but I’m getting an
if #GROUPBYPASS == 1 then
{
.
.
.
}, open,"DataCollectionTests", ""
in the flow instead.
What is the correct way of hooking up into this property?
This property is not currently supported, if you want it added please open a ticket describing it here: https://github.com/Origen-SDK/origen_testers/issues
In the meantime, you could generate it by using the render method which allows you to explicitly define code to be injected into the flow.
For example:
render '{'
# Your existing code to be wrapped in the group here, e.g.
test :testA
render '}, groupbypass, open,"DataCollectionTests", ""'
You could create your own helper method for that within your interface:
def group_bypass(name)
render '{'
yield
render "}, groupbypass, open,\"#{name}\", \"\""
end
Then in your flow:
group_bypass "DataCollectionTests" do
# Your existing code to be wrapped in the group here, e.g.
test :testA
end

nodejs+selenium-driver NoSuchElementError & StaleElementReferenceError

I am doing a test based mocha. node v8.2.1, selenium-webdriver: ^3.5.0.
test.it('demoClass', () => {
driver.classes[0].findElement(By.css('.class-avatar')).click();
driver.wait(until.elementIsVisible(driver.findElement(By.css('.anticon.anticon-plus'))));
//driver.sleep(2000);
driver.findElement(By.css('.anticon.anticon-plus')).click();
})
I am getting two different types of errors, either its NoSuchElementError: no such element: Unable to locate element: or StaleElementReferenceError: stale element reference: element is not attached to the page document
But whichever error, its refer to line:
driver.findElement(By.css('.anticon.anticon-plus')).click();
When I use driver.sleep(2000), its getting resolved. In my opinion, It's the question of animation. I can get the element(.anticon.ancicon-plus) only at the time, the page's animation is completed.
what I am confused is that I use driver.wait(until.elementIsVisible()) without an error, It's obvious that I got the element. but at the next line, I can't use it. Or NoSuchElementError, or StaleElementReferenceError.
I find some answer like http://www.seleniumhq.org/exceptions/stale_element_reference.jsp,https://stackoverflow.com/questions/18225997/stale-element-reference-element-is-not-attached-to-the-page-document. But It can't help me.
when use driver.findElement, something terrible will be triggered. use javascript instead it.
driver.executeScript(function() {
while(true) {
if(!document.querySelector('.anticon.anticon-plus')){}
else {
document.querySelector('.anticon.anticon-plus').click();
break;
}
}
return true; // not neccessary
})

Resources