How to use stack method in ava

Best JavaScript code snippet using ava

bootstrap.js

Source:bootstrap.js Github

copy

Full Screen

1function Word(vocab, name, source, func) {2 this.vocab = vocab;3 this.name = name;4 this.source = source;5 this.func = func;6}7Word.prototype.execute = function(next) {8 this.func(next);9}10Word.prototype.toString = function() {11 var html = [];12 html.push("<a href='/responder/browser/browse?vocab=")13 html.push(this.vocab);14 html.push("&amp;word=")15 html.push(this.name);16 html.push("'>")17 html.push(this.name);18 html.push("</a>");19 return html.join("");20}21function Hashtable() {22 this.table = { }23}24Hashtable.prototype.fromAlist = function(alist) {25 var obj = { }26 for(var i=0;i<alist.length;++i) { 27 var item = alist[i];28 obj[item[0]] = item[1];29 }30 this.table = obj;31 return this;32}33Hashtable.prototype.toAlist = function() {34 var table = this.table;35 var alist = [ ];36 for(k in table) {37 var v = table[k];38 alist.push([k,v]);39 }40 return alist;41}42Hashtable.prototype.get = function(key) {43 var table = this.table;44 if(table.hasOwnProperty(key)) {45 return table[key];46 }47 return false;48}49Hashtable.prototype.set = function(key, value) {50 this.table[key] = value;51}52Hashtable.prototype.toString = function() {53 var table = this.table;54 var result = [];55 result.push("H{")56 for(k in table) {57 var v = table[k];58 result.push(" { ");59 result.push(k);60 result.push(" ");61 result.push(v);62 result.push(" }");63 }64 result.push("}");65 return result.join(""); 66}67function Continuation() {68 this.data_stack = [ ];69 this.retain_stack = [ ];70 this.name_stack = [ ];71 this.next = false;72 this.nesting = 0;73}74Continuation.prototype.clone = function() {75 var c = new Continuation();76 c.data_stack = this.data_stack.slice(0);77 c.retain_stack = this.retain_stack.slice(0);78 c.name_stack = this.name_stack.slice(0);79 c.nesting = this.nesting;80 c.next = this.next;81 return c;82}83function Factor() {84 this.vocabs = { scratchpad: { }, io: { } };85 this.in_vocab = "scratchpad";86 this.using_vocabs = [ "scratchpad", "kernel","math","sequences","parser","alien","browser-dom", "words", "io", "hashtables" ];87 this.cont = new Continuation();88}89var factor = new Factor();90Factor.prototype.call_next = function(next) {91 if(next) {92 if(this.cont.nesting++ > 150) {93 this.cont.nesting = 0;94 setTimeout(next, 0);95 }96 else {97 next();98 }99 }100}101Factor.prototype.push_data = function(v, next) {102 factor.cont.data_stack.push(v);103 factor.call_next(next);104}105Factor.prototype.use = function(v, next) {106 factor.cont.data_stack.push(v);107 factor.get_word("kernel", "use+").execute(next);108}109Factor.prototype.using = function(v, next) {110 factor.cont.data_stack.push(v);111 factor.get_word("kernel", "using").execute(next);112}113var fjsc_repl = false;114Factor.prototype.set_in = function(v, next) {115 factor.cont.data_stack.push(v);116 factor.get_word("kernel", "set-in").execute(next);117 if (fjsc_repl) {118 fjsc_repl.ps = '( ' + v + ' )';119 }120}121Factor.prototype.get_word = function(vocab,name) {122 return factor.vocabs[vocab][name];123}124Factor.prototype.find_word = function(name) {125 for(var v = 0; v<factor.using_vocabs.length; ++v) {126 var w = factor.vocabs[factor.using_vocabs[v]][name];127 if(w)128 return w;129 }130 return false;131}132Factor.prototype.add_word = function(vocab,name, source, func) {133 var v = factor.vocabs[vocab];134 if(!v) {135 v = { };136 factor.vocabs[vocab] = v;137 }138 v[name] = new Word(vocab,name,source,func);139}140Factor.prototype.remove_word = function(vocab,name) {141 var v = factor.vocabs[vocab];142 if(!v) {143 v = { };144 factor.vocabs[vocab] = v;145 }146 delete v[name];147}148 149Factor.prototype.define_word = function(name, source, func, next) {150 factor.vocabs[factor.in_vocab][name] = new Word(factor.in_vocab, name, source, function(next) {151 var old = factor.cont.next;152 factor.cont.next = function() {153 factor.cont.next = old;154 factor.call_next(next);155 }156 func();157 });158 factor.call_next(next);159}160Factor.prototype.make_quotation = function(source, func) {161 return new Word("quotations", "quotation", source, function(next) {162 var old = factor.cont.next;163 factor.cont.next = function() {164 factor.cont.next = old;165 factor.call_next(next);166 }167 func();168 });169}170Factor.prototype.server_eval = function(text, handler, next) {171 var self = this;172 $.post("compile", { code: text }, function(result) {173 factor.run_eval = function(func) {174 factor.cont.next = function() { handler(text,result); } 175 try {176 func(factor);177 } catch(ex) {178 alert("Error Parsing Javascript: " + ex); 179 handler(text, result);180 }181 if(next) 182 factor.call_next(next);183 }184 try {185 eval("factor.run_eval" + result);186 } catch(e) {187 factor.run_eval(function() { alert("Error Parsing Javascript: " + e); });188 }189 });190}191/* kernel-internals vocabulary */192factor.add_word("kernel-internals", ">n", "primitive", function(next) {193 var data_stack = factor.cont.data_stack;194 var name_stack = factor.cont.name_stack;195 name_stack.push(data_stack.pop());196 factor.call_next(next);197});198factor.add_word("kernel-internals", "n>", "primitive", function(next) {199 var data_stack = factor.cont.data_stack;200 var name_stack = factor.cont.name_stack;201 data_stack.push(name_stack.pop());202 factor.call_next(next);203});204/* Kernel Vocabulary */205factor.add_word("kernel","dup", "primitive", function(next) {206 var stack = factor.cont.data_stack;207 stack[stack.length] = stack[stack.length-1];208 factor.call_next(next);209});210factor.add_word("kernel", "drop", "primitive", function(next) {211 factor.cont.data_stack.pop();212 factor.call_next(next);213});214factor.add_word("kernel", "nip", "primitive", function(next) {215 var stack = factor.cont.data_stack;216 stack[stack.length-2] = stack[stack.length-1];217 stack.pop();218 factor.call_next(next);219});220factor.add_word("kernel", "over", "primitive", function(next) {221 var stack = factor.cont.data_stack;222 stack[stack.length] = stack[stack.length-2];223 factor.call_next(next);224});225factor.add_word("kernel", "pick", "primitive", function(next) {226 var stack = factor.cont.data_stack;227 stack[stack.length] = stack[stack.length-3];228 factor.call_next(next);229});230factor.add_word("kernel", "swap", "primitive", function(next) {231 var stack = factor.cont.data_stack;232 var temp = stack[stack.length-2];233 stack[stack.length-2] = stack[stack.length-1];234 stack[stack.length-1] = temp;235 factor.call_next(next);236});237factor.add_word("kernel", ">r", "primitive", function(next) {238 var data_stack = factor.cont.data_stack;239 var retain_stack = factor.cont.retain_stack;240 retain_stack.push(data_stack.pop());241 factor.call_next(next);242});243factor.add_word("kernel", "r>", "primitive", function(next) {244 var data_stack = factor.cont.data_stack;245 var retain_stack = factor.cont.retain_stack;246 data_stack.push(retain_stack.pop());247 factor.call_next(next);248});249factor.add_word("kernel", "call", "primitive", function(next) {250 var quot = factor.cont.data_stack.pop();251 quot.execute(next);252});253factor.add_word("kernel", "execute", "primitive", function(next) {254 var quot = factor.cont.data_stack.pop();255 quot.execute(next);256});257factor.add_word("kernel", "clear", "primitive", function(next) {258 factor.cont.data_stack = [];259 factor.cont.retain_stack = [];260 factor.call_next(next);261});262factor.add_word("kernel", "if", "primitive", function(next) { 263 var stack = factor.cont.data_stack;264 var else_quot = stack.pop();265 var then_quot = stack.pop();266 var condition = stack.pop();267 if(condition) {268 then_quot.execute(next);269 } else {270 else_quot.execute(next);271 }272});273factor.add_word("kernel", "f", "primitive", function(next) { 274 factor.cont.data_stack.push(false);275 factor.call_next(next);276});277factor.add_word("kernel", "t", "primitive", function(next) { 278 factor.cont.data_stack.push(true);279 factor.call_next(next);280});281factor.add_word("kernel", "=", "primitive", function(next) { 282 var stack = factor.cont.data_stack;283 stack.push(stack.pop()==stack.pop());284 factor.call_next(next);285});286factor.add_word("kernel", "bootstrap", "primitive", function(next) { 287 factor.cont.data_stack.push("/responder/fjsc-resources/bootstrap.factor");288 factor.get_word("parser", "run-file").execute(next);289});290factor.add_word("kernel", "callcc0", "primitive", function(next) { 291 var data_stack = factor.cont.data_stack;292 var quot = data_stack.pop();293 var new_cont = factor.cont.clone(); 294 var old_next = factor.cont.next;295 factor.cont.next = function() {296 factor.cont.next = old_next;297 factor.call_next(next);298 }299 new_cont.data_stack.push(factor.cont);300 factor.cont = new_cont;301 quot.execute(next); 302});303factor.add_word("kernel", "callcc1", "primitive", function(next) { 304 factor.get_word("kernel", "callcc0").execute(next);305});306factor.add_word("kernel", "continue", "primitive", function(next) { 307 var data_stack = factor.cont.data_stack;308 var cont = data_stack.pop(); 309 factor.cont = cont.clone();310 factor.call_next(cont.next);311});312factor.add_word("kernel", "continue-with", "primitive", function(next) { 313 var data_stack = factor.cont.data_stack;314 var cont = data_stack.pop(); 315 var data = data_stack.pop(); 316 factor.cont = cont.clone();317 factor.cont.data_stack.push(data);318 factor.call_next(cont.next);319});320factor.add_word("kernel", "set-in", "primitive", function(next) { 321 var stack = factor.cont.data_stack;322 var vocab = stack.pop();323 var v = factor.vocabs[vocab];324 if(!v) {325 v = { };326 factor.vocabs[vocab] = v;327 }328 factor.in_vocab = vocab;329 factor.call_next(next); 330});331factor.add_word("kernel", "current-vocab", "primitive", function(next) { 332 var stack = factor.cont.data_stack;333 stack.push(factor.in_vocab);334 factor.call_next(next); 335});336factor.add_word("kernel", "use+", "primitive", function(next) { 337 var stack = factor.cont.data_stack;338 var vocab = stack.pop();339 var v = factor.vocabs[vocab];340 if(!v) {341 v = { };342 factor.vocabs[vocab] = v;343 }344 factor.using_vocabs.push(vocab);345 factor.call_next(next); 346});347factor.add_word("kernel", "using", "primitive", function(next) { 348 var stack = factor.cont.data_stack;349 var vocabs = stack.pop();350 for(var i=0;i<vocabs.length;++i) { 351 var v = factor.vocabs[vocabs[i]];352 if(!v) {353 v = { };354 factor.vocabs[vocabs[i]] = v;355 }356 factor.using_vocabs.push(vocabs[i]);357 }358 factor.call_next(next); 359});360factor.add_word("kernel", "current-using", "primitive", function(next) { 361 var stack = factor.cont.data_stack;362 stack.push(factor.using_vocabs);363 factor.call_next(next); 364});365factor.add_word("kernel", "forget", "primitive", function(next) { 366 var stack = factor.cont.data_stack;367 var word = stack.pop();368 factor.remove_word(word.vocab, word.name);369 factor.call_next(next); 370});371factor.add_word("kernel", ">function", "primitive", function(next) { 372 var stack = factor.cont.data_stack;373 var word = stack.pop();374 stack.push(function() { word.func(function() { }) });375 factor.call_next(next); 376});377factor.add_word("kernel", "curry", "primitive", function(next) { 378 var stack = factor.cont.data_stack;379 var quot = stack.pop();380 var value = stack.pop();381 382 stack.push(factor.make_quotation("quotation", function(next) {383 factor.cont.data_stack.push(value); 384 quot.execute(factor.cont.next);385 }));386 factor.call_next(next);387});388/* Math vocabulary */389factor.add_word("math", "*", "primitive", function(next) {390 var stack = factor.cont.data_stack;391 stack.push(stack.pop() * stack.pop());392 factor.call_next(next);393});394factor.add_word("math", "+", "primitive", function(next) {395 var stack = factor.cont.data_stack;396 stack.push(stack.pop() + stack.pop());397 factor.call_next(next);398});399factor.add_word("math", "-", "primitive", function(next) {400 var stack = factor.cont.data_stack;401 var v1 = stack.pop();402 var v2 = stack.pop();403 stack.push(v2 - v1);404 factor.call_next(next);405});406factor.add_word("math", "/", "primitive", function(next) {407 var stack = factor.cont.data_stack;408 var v1 = stack.pop();409 var v2 = stack.pop();410 stack.push(v2 / v1);411 factor.call_next(next);412});413factor.add_word("parser", "run-file", "primitive", function(next) { 414 var stack = factor.cont.data_stack;415 var url = stack.pop();416 $.get(url, function(result) {417 factor.server_eval(result, function() { }, next);418 });419});420factor.add_word("alien", "alien-invoke", "primitive", function(next) { 421 var stack = factor.cont.data_stack;422 var arg_types = stack.pop();423 var method_name = stack.pop();424 var library_name = stack.pop();425 var return_values = stack.pop();426 var obj = stack.pop();427 var args = [ ];428 for(var i = 0; i < arg_types.length; ++i) {429 args[i] = stack.pop();430 }431 var func = obj[method_name];432 if(method_name=="alert") {433 func = function(a) { alert(a); }434 }435 var v = func.apply(obj, args.reverse());436 if(return_values.length > 0)437 stack.push(v);438 factor.call_next(next);439});440factor.add_word("alien", "alien-property", "primitive", function(next) { 441 var stack = factor.cont.data_stack;442 var obj = stack.pop();443 var property_name = stack.pop();444 var v = obj[property_name];445 stack.push(v);446 factor.call_next(next);447});448factor.add_word("alien", "set-alien-property", "primitive", function(next) { 449 var stack = factor.cont.data_stack;450 var obj = stack.pop();451 var property_name = stack.pop();452 var data = stack.pop();453 obj[property_name] = v;454 factor.call_next(next);455});456factor.add_word("alien", "uneval", "primitive", function(next) {457 var stack = factor.cont.data_stack;458 stack.push(uneval(stack.pop()));459 factor.call_next(next);460});461factor.add_word("words", "vocabs", "primitive", function(next) { 462 var stack = factor.cont.data_stack;463 var result = [];464 for(v in factor.vocabs) {465 result.push(v);466 }467 stack.push(result);468 factor.call_next(next);469});470factor.add_word("words", "words", "primitive", function(next) { 471 var stack = factor.cont.data_stack;472 var vocab = factor.vocabs[stack.pop()];473 var result = [];474 for(w in vocab) {475 result.push(vocab[w]);476 }477 stack.push(result);478 factor.call_next(next);479});480factor.add_word("words", "all-words", "primitive", function(next) { 481 var stack = factor.cont.data_stack;482 var result = [];483 for(v in factor.vocabs) {484 for(w in factor.vocabs[v]) {485 result.push(factor.vocabs[v][w]);486 }487 }488 stack.push(result);489 factor.call_next(next);490});491/* Sequences vocabulary */492factor.add_word("sequences", "nth", "primitive", function(next) { 493 var stack = factor.cont.data_stack;494 var seq = stack.pop();495 var index = stack.pop();496 stack.push(seq[index]);497 factor.call_next(next);498});499factor.add_word("sequences", "first", "primitive", function(next) { 500 var stack = factor.cont.data_stack;501 var seq = stack.pop();502 stack.push(seq[0]);503 factor.call_next(next);504});505factor.add_word("sequences", "second", "primitive", function(next) { 506 var stack = factor.cont.data_stack;507 var seq = stack.pop();508 stack.push(seq[1]);509 factor.call_next(next);510});511factor.add_word("sequences", "third", "primitive", function(next) { 512 var stack = factor.cont.data_stack;513 var seq = stack.pop();514 stack.push(seq[2]);515 factor.call_next(next);516});517factor.add_word("sequences", "fourth", "primitive", function(next) { 518 var stack = factor.cont.data_stack;519 var seq = stack.pop();520 stack.push(seq[0]);521 factor.call_next(next);522});523factor.add_word("sequences", "first2", "primitive", function(next) { 524 var stack = factor.cont.data_stack;525 var seq = stack.pop();526 stack.push(seq[0],seq[1]);527 factor.call_next(next);528});529factor.add_word("sequences", "first3", "primitive", function(next) { 530 var stack = factor.cont.data_stack;531 var seq = stack.pop();532 stack.push(seq[0],seq[1],seq[2]);533 factor.call_next(next);534});535factor.add_word("sequences", "first4", "primitive", function(next) { 536 var stack = factor.cont.data_stack;537 var seq = stack.pop();538 stack.push(seq[0],seq[1],seq[2],seq[3]);539 factor.call_next(next);540});541factor.add_word("sequences", "each", "primitive", function(next) { 542 var stack = factor.cont.data_stack;543 var quot = stack.pop();544 var seq = stack.pop();545 for(var i=0;i<seq.length;++i) { 546 stack.push(seq[i]);547 quot.execute();548 }549 factor.call_next(next);550});551factor.add_word("sequences", "map", "primitive", function(next) { 552 var stack = factor.cont.data_stack;553 var quot = stack.pop();554 var seq = stack.pop();555 var result = [ ];556 for(var i=0;i<seq.length;++i) { 557 stack.push(seq[i]);558 quot.execute();559 result[i]=stack.pop();560 }561 stack.push(result);562 factor.call_next(next);563});564factor.add_word("sequences", "reduce", "primitive", function(next) { 565 var stack = factor.cont.data_stack;566 var quot = stack.pop();567 var prev = stack.pop();568 var seq = stack.pop();569 for(var i=0;i<seq.length;++i) { 570 stack.push(prev);571 stack.push(seq[i]);572 quot.execute();573 prev=stack.pop();Al574 }575 stack.push(prev);576 factor.call_next(next);577});578/* hashtables vocabulary */579factor.add_word("hashtables", "alist>hash", "primitive", function(next) { 580 var stack = factor.cont.data_stack;581 var alist = stack.pop();582 stack.push(new Hashtable().fromAlist(alist));583 factor.call_next(next);584});585factor.add_word("hashtables", "hash>alist", "primitive", function(next) { 586 var stack = factor.cont.data_stack;587 var hashtable = stack.pop();588 stack.push(hashtable.toAlist());589 factor.call_next(next);590});591factor.add_word("hashtables", "hash", "primitive", function(next) { 592 var stack = factor.cont.data_stack;593 var hashtable = stack.pop();594 var key = stack.pop();595 stack.push(hashtable.get(key));596 factor.call_next(next);597});598factor.add_word("hashtables", "set-hash", "primitive", function(next) { 599 var stack = factor.cont.data_stack;600 var hashtable = stack.pop();601 var key = stack.pop();602 var value = stack.pop();603 hashtable.set(key, value);604 factor.call_next(next);605});606factor.add_word("sequences", "hash-each", "primitive", function(next) { 607 var stack = factor.cont.data_stack;608 var quot = stack.pop();609 var hashtable = stack.pop().table;610 for(k in hashtable) { 611 var v = hashtable[k]; 612 stack.push(k, v);613 quot.execute();614 }615 factor.call_next(next);616});617factor.add_word("sequences", "hash-map", "primitive", function(next) { 618 var stack = factor.cont.data_stack;619 var quot = stack.pop();620 var hashtable = stack.pop().table;621 var result = [ ];622 for(k in hashtable) { 623 var v = hashtable[k];624 stack.push(k,v);625 quot.execute();626 result.push(stack.pop());627 }628 stack.push(result);629 factor.call_next(next);630});631/* browser-dom vocab */632factor.add_word("browser-dom", "window", "primitive", function(next) { 633 factor.cont.data_stack.push(window);634 factor.call_next(next);635});636factor.add_word("browser-dom", "document", "primitive", function(next) { 637 factor.cont.data_stack.push(document);638 factor.call_next(next);639});640factor.add_word("browser-dom", "load-script", "primitive", function(next) { 641 var stack = factor.cont.data_stack;642 $("head/script#jsonrequest").remove();643 var script = document.createElement("script");644 script.id = "jsonrequest"; 645 script.type = "text/javascript";646 script.src = stack.pop();647 $("head").append(script);648 factor.call_next(next); 649});650var handle_json = false;651factor.add_word("browser-dom", "json-request", "primitive", function(next) { 652 var stack = factor.cont.data_stack;653 handle_json = function(data) { 654 factor.cont.data_stack.push(data);655 factor.call_next(next);656 }657 factor.get_word("browser-dom", "load-script").execute();...

Full Screen

Full Screen

App.js

Source:App.js Github

copy

Full Screen

1import React, { useState, useEffect } from "react";2import { StyleSheet } from "react-native";3import { Ionicons } from "@expo/vector-icons";4import { FontAwesome } from "@expo/vector-icons";5import { AntDesign } from "@expo/vector-icons";6import { AsyncStorage } from "react-native";7import { NavigationContainer } from "@react-navigation/native";8import { createStackNavigator } from "@react-navigation/stack";9import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";10const Stack = createStackNavigator();11const Tab = createBottomTabNavigator();12// Import des composants :13import Home from "./screens/Home";14import Login from "./screens/Login";15import Message from "./screens/Message";16import ProfileMenu from "./screens/ProfileMenu";17import Profile from "./screens/Profile";18import Search from "./screens/Search";19import SearchArticle from "./components/SearchArticle";20import SearchUser from "./components/SearchUser";21import Signup from "./screens/Signup";22import Annonce from "./components/Annonce";23import Acheter from "./screens/Acheter";24import ProfileVendeur from "./screens/ProfileVendeur";25import Vendre from "./screens/Vendre";26import DeleteAccount from "./components/DeleteAccount";27import Commandes from "./screens/Commandes";28import Dressing from "./screens/Dressing";29import Evaluations from "./screens/Evaluations";30import Ventes from "./screens/Ventes";31import Favoris from "./screens/Favoris";32import FAQ from "./screens/FAQ";33import FaqVendre from "./components/FaqVendre";34import FaqAcheter from "./components/FaqAcheter";35import FaqCommunaute from "./components/FaqCommunaute";36import DeleteAdd from "./components/DeleteAdd";37import UpdateAdd from "./components/UpdateAdd";38import Formulaire from "./components/Formulaire";39// Fin Import des composants40export default function App() {41 const [isLoading, setisLoading] = useState(true);42 const [userToken, setUserToken] = useState(null);43 const [userId, setUserId] = useState(null);44 const [favoris, setFavoris] = useState([]);45 const setToken = async (token) => {46 if (token) {47 AsyncStorage.setItem("userToken", token);48 } else {49 AsyncStorage.removeItem("userToken");50 }51 setUserToken(token);52 };53 const setId = async (id) => {54 if (id) {55 AsyncStorage.setItem("userId", id);56 } else {57 AsyncStorage.removeItem("userId");58 }59 setUserId(id);60 };61 useEffect(() => {62 const bootstrapAsync = async () => {63 const userToken = await AsyncStorage.getItem("userToken");64 setisLoading(false);65 setUserToken(userToken);66 };67 bootstrapAsync();68 }, []);69 return (70 <NavigationContainer>71 {isLoading ? null : userToken === null ? (72 <Stack.Navigator>73 <Stack.Screen name="Login">74 {() => <Login setId={setId} setToken={setToken} />}75 </Stack.Screen>76 <Stack.Screen name="Signup">77 {() => <Signup setId={setId} setToken={setToken} />}78 </Stack.Screen>79 </Stack.Navigator>80 ) : (81 <Stack.Navigator>82 <Stack.Screen83 name="Menu"84 options={{ header: () => null, animationEnabled: false }}85 >86 {() => (87 <Tab.Navigator88 tabBarOptions={{89 style: {90 backgroundColor: "white",91 height: "14%",92 },93 }}94 >95 <Tab.Screen96 name="Home"97 options={{98 tabBarLabel: "Home",99 tabBarIcon: () => (100 <Ionicons name={"ios-home"} size={32} color="#C63E81" />101 ),102 }}103 >104 {() => (105 <Stack.Navigator>106 <Stack.Screen107 options={{108 title: "Fil d'actualité",109 headerShown: true,110 }}111 name="Home"112 >113 {() => (114 <Home115 favoris={favoris}116 setFavoris={setFavoris}117 userToken={userToken}118 />119 )}120 </Stack.Screen>121 <Stack.Screen122 name="Annonce"123 options={{124 title: "Annonce",125 headerShown: true,126 }}127 >128 {() => (129 <Annonce130 favoris={favoris}131 setFavoris={setFavoris}132 userToken={userToken}133 />134 )}135 </Stack.Screen>136 <Stack.Screen137 name="Dressing"138 options={{139 title: "Mon Dressing",140 headerShown: true,141 }}142 >143 {() => <Dressing setId={setId} setToken={setToken} />}144 </Stack.Screen>145 <Stack.Screen146 name="Acheter"147 options={{148 title: "Acheter",149 headerShown: true,150 }}151 >152 {() => <Acheter />}153 </Stack.Screen>154 <Stack.Screen155 name="ProfileVendeur"156 options={{157 title: "Profil du vendeur",158 headerShown: true,159 }}160 >161 {() => <ProfileVendeur />}162 </Stack.Screen>163 </Stack.Navigator>164 )}165 </Tab.Screen>166 <Tab.Screen167 name="Vendre"168 options={{169 tabBarLabel: "Vendre",170 tabBarIcon: () => (171 <AntDesign name="pluscircleo" size={30} color="#C63E81" />172 ),173 }}174 >175 {() => (176 <Stack.Navigator>177 <Stack.Screen178 name="Vendre"179 options={{180 title: "Vendre un article",181 headerShown: true,182 }}183 >184 {() => <Vendre />}185 </Stack.Screen>186 <Stack.Screen187 name="Dressing"188 options={{189 title: "Mon Dressing",190 headerShown: true,191 }}192 >193 {() => <Dressing setId={setId} setToken={setToken} />}194 </Stack.Screen>195 </Stack.Navigator>196 )}197 </Tab.Screen>198 <Tab.Screen199 name="Profile"200 options={{201 tabBarLabel: "Profile",202 tabBarIcon: () => (203 <Ionicons name={"ios-person"} size={40} color="#C63E81" />204 ),205 }}206 >207 {() => (208 <Stack.Navigator>209 <Stack.Screen210 name="ProfileMenu"211 options={{212 title: "Mon Profile",213 headerShown: true,214 }}215 >216 {() => (217 <ProfileMenu setId={setId} setToken={setToken} />218 )}219 </Stack.Screen>220 <Stack.Screen221 name="Profile"222 options={{223 title: "Mes informations personnelles",224 headerShown: true,225 }}226 >227 {() => <Profile setId={setId} setToken={setToken} />}228 </Stack.Screen>229 <Stack.Screen230 name="DeleteAccount"231 options={{232 title: "Supprimer mon compte",233 headerShown: true,234 }}235 >236 {() => (237 <DeleteAccount setId={setId} setToken={setToken} />238 )}239 </Stack.Screen>240 <Stack.Screen241 name="Commandes"242 options={{243 title: "Mes commandes",244 headerShown: true,245 }}246 >247 {() => <Commandes setId={setId} setToken={setToken} />}248 </Stack.Screen>249 <Stack.Screen250 name="Ventes"251 options={{252 title: "Mes ventes",253 headerShown: true,254 }}255 >256 {() => <Ventes setId={setId} setToken={setToken} />}257 </Stack.Screen>258 <Stack.Screen259 name="ProfileVendeur"260 options={{261 title: "Profil du vendeur",262 headerShown: true,263 }}264 >265 {() => <ProfileVendeur />}266 </Stack.Screen>267 <Stack.Screen268 name="Dressing"269 options={{270 title: "Mon Dressing",271 headerShown: true,272 }}273 >274 {() => <Dressing setId={setId} setToken={setToken} />}275 </Stack.Screen>276 <Stack.Screen277 name="DeleteAdd"278 options={{279 title: "Supprimer une annonce",280 headerShown: true,281 }}282 >283 {() => <DeleteAdd />}284 </Stack.Screen>285 <Stack.Screen286 name="UpdateAdd"287 options={{288 title: "Modifier une annonce",289 headerShown: true,290 }}291 >292 {() => <UpdateAdd />}293 </Stack.Screen>294 <Stack.Screen295 name="Evaluations"296 options={{297 title: "Mes évaluations",298 headerShown: true,299 }}300 >301 {() => <Evaluations />}302 </Stack.Screen>303 <Stack.Screen304 name="Favoris"305 options={{306 title: "Mes favoris",307 headerShown: true,308 }}309 >310 {() => (311 <Favoris favoris={favoris} setFavoris={setFavoris} />312 )}313 </Stack.Screen>314 <Stack.Screen315 name="Annonce"316 options={{317 title: "Annonce",318 headerShown: true,319 }}320 >321 {() => (322 <Annonce favoris={favoris} setFavoris={setFavoris} />323 )}324 </Stack.Screen>325 <Stack.Screen326 name="FAQ"327 options={{328 title: "Comment est ce que ça marche ?",329 headerShown: true,330 }}331 >332 {() => <FAQ />}333 </Stack.Screen>334 <Stack.Screen335 name="FaqVendre"336 options={{337 title: "Comment vendre mon article ?",338 headerShown: true,339 }}340 >341 {() => <FaqVendre />}342 </Stack.Screen>343 <Stack.Screen344 name="FaqAcheter"345 options={{346 title: "Comment acheter un article ?",347 headerShown: true,348 }}349 >350 {() => <FaqAcheter />}351 </Stack.Screen>352 <Stack.Screen353 name="FaqCommunaute"354 options={{355 title: "La communauté SyMa",356 headerShown: true,357 }}358 >359 {() => <FaqCommunaute />}360 </Stack.Screen>361 <Stack.Screen362 name="Formulaire"363 options={{364 title: "Nous contacter",365 headerShown: true,366 }}367 >368 {() => <Formulaire />}369 </Stack.Screen>370 </Stack.Navigator>371 )}372 </Tab.Screen>373 <Tab.Screen374 name="Message"375 options={{376 tabBarLabel: "Message",377 tabBarIcon: () => (378 <FontAwesome379 name="envelope-o"380 size={30}381 color="#C63E81"382 />383 ),384 }}385 >386 {() => (387 <Stack.Navigator>388 <Stack.Screen389 name="Message"390 options={{391 title: "Message",392 headerShown: true,393 }}394 >395 {() => <Message />}396 </Stack.Screen>397 </Stack.Navigator>398 )}399 </Tab.Screen>400 <Tab.Screen401 name="Search"402 options={{403 tabBarLabel: "Search",404 tabBarIcon: () => (405 <FontAwesome name="search" size={30} color="#C63E81" />406 ),407 }}408 >409 {() => (410 <Stack.Navigator>411 <Stack.Screen412 name="Search"413 options={{414 title: "Rechercher",415 headerShown: true,416 }}417 >418 {() => <Search />}419 </Stack.Screen>420 <Stack.Screen421 name="SearchArticle"422 options={{423 title: "Rechercher un article",424 headerShown: true,425 }}426 >427 {() => <SearchArticle />}428 </Stack.Screen>429 <Stack.Screen430 name="SearchUser"431 options={{432 title: "Rechercher un membre",433 headerShown: true,434 }}435 >436 {() => <SearchUser />}437 </Stack.Screen>438 <Stack.Screen439 name="ProfileVendeur"440 options={{441 title: "Profil du vendeur",442 headerShown: true,443 }}444 >445 {() => <ProfileVendeur />}446 </Stack.Screen>447 </Stack.Navigator>448 )}449 </Tab.Screen>450 </Tab.Navigator>451 )}452 </Stack.Screen>453 </Stack.Navigator>454 )}455 </NavigationContainer>456 );457}458const styles = StyleSheet.create({459 container: {460 flex: 1,461 backgroundColor: "#fff",462 alignItems: "center",463 justifyContent: "center",464 },...

Full Screen

Full Screen

InsideStack.js

Source:InsideStack.js Github

copy

Full Screen

1import React from 'react';2import { I18nManager } from 'react-native';3import { createStackNavigator } from '@react-navigation/stack';4import { createDrawerNavigator } from '@react-navigation/drawer';5import { ThemeContext } from '../theme';6import {7 defaultHeader, themedHeader, ModalAnimation, StackAnimation8} from '../utils/navigation';9import Sidebar from '../views/SidebarView';10// Chats Stack11import RoomView from '../views/RoomView';12import RoomsListView from '../views/RoomsListView';13import RoomActionsView from '../views/RoomActionsView';14import RoomInfoView from '../views/RoomInfoView';15import RoomInfoEditView from '../views/RoomInfoEditView';16import RoomMembersView from '../views/RoomMembersView';17import SearchMessagesView from '../views/SearchMessagesView';18import SelectedUsersView from '../views/SelectedUsersView';19import InviteUsersView from '../views/InviteUsersView';20import InviteUsersEditView from '../views/InviteUsersEditView';21import MessagesView from '../views/MessagesView';22import AutoTranslateView from '../views/AutoTranslateView';23import DirectoryView from '../views/DirectoryView';24import NotificationPrefView from '../views/NotificationPreferencesView';25import VisitorNavigationView from '../views/VisitorNavigationView';26import ForwardLivechatView from '../views/ForwardLivechatView';27import LivechatEditView from '../views/LivechatEditView';28import PickerView from '../views/PickerView';29import ThreadMessagesView from '../views/ThreadMessagesView';30import TeamChannelsView from '../views/TeamChannelsView';31import MarkdownTableView from '../views/MarkdownTableView';32import ReadReceiptsView from '../views/ReadReceiptView';33import { themes } from '../constants/colors';34// Profile Stack35import ProfileView from '../views/ProfileView';36import UserPreferencesView from '../views/UserPreferencesView';37import UserNotificationPrefView from '../views/UserNotificationPreferencesView';38// Settings Stack39import SettingsView from '../views/SettingsView';40import SecurityPrivacyView from '../views/SecurityPrivacyView';41import E2EEncryptionSecurityView from '../views/E2EEncryptionSecurityView';42import LanguageView from '../views/LanguageView';43import ThemeView from '../views/ThemeView';44import DefaultBrowserView from '../views/DefaultBrowserView';45import ScreenLockConfigView from '../views/ScreenLockConfigView';46// Admin Stack47import AdminPanelView from '../views/AdminPanelView';48// NewMessage Stack49import NewMessageView from '../views/NewMessageView';50import CreateChannelView from '../views/CreateChannelView';51// E2ESaveYourPassword Stack52import E2ESaveYourPasswordView from '../views/E2ESaveYourPasswordView';53import E2EHowItWorksView from '../views/E2EHowItWorksView';54// E2EEnterYourPassword Stack55import E2EEnterYourPasswordView from '../views/E2EEnterYourPasswordView';56// InsideStackNavigator57import AttachmentView from '../views/AttachmentView';58import ModalBlockView from '../views/ModalBlockView';59import JitsiMeetView from '../views/JitsiMeetView';60import StatusView from '../views/StatusView';61import ShareView from '../views/ShareView';62import CreateDiscussionView from '../views/CreateDiscussionView';63import QueueListView from '../ee/omnichannel/views/QueueListView';64import AddChannelTeamView from '../views/AddChannelTeamView';65import AddExistingChannelView from '../views/AddExistingChannelView';66import SelectListView from '../views/SelectListView';67// ChatsStackNavigator68const ChatsStack = createStackNavigator();69const ChatsStackNavigator = () => {70 const { theme } = React.useContext(ThemeContext);71 return (72 <ChatsStack.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation }}>73 <ChatsStack.Screen74 name='RoomsListView'75 component={RoomsListView}76 />77 <ChatsStack.Screen78 name='RoomView'79 component={RoomView}80 />81 <ChatsStack.Screen82 name='RoomActionsView'83 component={RoomActionsView}84 options={RoomActionsView.navigationOptions}85 />86 <ChatsStack.Screen87 name='SelectListView'88 component={SelectListView}89 options={SelectListView.navigationOptions}90 />91 <ChatsStack.Screen92 name='RoomInfoView'93 component={RoomInfoView}94 options={RoomInfoView.navigationOptions}95 />96 <ChatsStack.Screen97 name='RoomInfoEditView'98 component={RoomInfoEditView}99 options={RoomInfoEditView.navigationOptions}100 />101 <ChatsStack.Screen102 name='RoomMembersView'103 component={RoomMembersView}104 options={RoomMembersView.navigationOptions}105 />106 <ChatsStack.Screen107 name='SearchMessagesView'108 component={SearchMessagesView}109 options={SearchMessagesView.navigationOptions}110 />111 <ChatsStack.Screen112 name='SelectedUsersView'113 component={SelectedUsersView}114 />115 <ChatsStack.Screen116 name='InviteUsersView'117 component={InviteUsersView}118 options={InviteUsersView.navigationOptions}119 />120 <ChatsStack.Screen121 name='InviteUsersEditView'122 component={InviteUsersEditView}123 options={InviteUsersEditView.navigationOptions}124 />125 <ChatsStack.Screen126 name='MessagesView'127 component={MessagesView}128 />129 <ChatsStack.Screen130 name='AutoTranslateView'131 component={AutoTranslateView}132 options={AutoTranslateView.navigationOptions}133 />134 <ChatsStack.Screen135 name='DirectoryView'136 component={DirectoryView}137 options={DirectoryView.navigationOptions}138 />139 <ChatsStack.Screen140 name='NotificationPrefView'141 component={NotificationPrefView}142 options={NotificationPrefView.navigationOptions}143 />144 <ChatsStack.Screen145 name='VisitorNavigationView'146 component={VisitorNavigationView}147 options={VisitorNavigationView.navigationOptions}148 />149 <ChatsStack.Screen150 name='ForwardLivechatView'151 component={ForwardLivechatView}152 options={ForwardLivechatView.navigationOptions}153 />154 <ChatsStack.Screen155 name='LivechatEditView'156 component={LivechatEditView}157 options={LivechatEditView.navigationOptions}158 />159 <ChatsStack.Screen160 name='PickerView'161 component={PickerView}162 options={PickerView.navigationOptions}163 />164 <ChatsStack.Screen165 name='ThreadMessagesView'166 component={ThreadMessagesView}167 options={ThreadMessagesView.navigationOptions}168 />169 <ChatsStack.Screen170 name='TeamChannelsView'171 component={TeamChannelsView}172 options={TeamChannelsView.navigationOptions}173 />174 <ChatsStack.Screen175 name='CreateChannelView'176 component={CreateChannelView}177 options={CreateChannelView.navigationOptions}178 />179 <ChatsStack.Screen180 name='AddChannelTeamView'181 component={AddChannelTeamView}182 options={AddChannelTeamView.navigationOptions}183 />184 <ChatsStack.Screen185 name='AddExistingChannelView'186 component={AddExistingChannelView}187 options={AddExistingChannelView.navigationOptions}188 />189 <ChatsStack.Screen190 name='MarkdownTableView'191 component={MarkdownTableView}192 options={MarkdownTableView.navigationOptions}193 />194 <ChatsStack.Screen195 name='ReadReceiptsView'196 component={ReadReceiptsView}197 options={ReadReceiptsView.navigationOptions}198 />199 <ChatsStack.Screen200 name='QueueListView'201 component={QueueListView}202 options={QueueListView.navigationOptions}203 />204 </ChatsStack.Navigator>205 );206};207// ProfileStackNavigator208const ProfileStack = createStackNavigator();209const ProfileStackNavigator = () => {210 const { theme } = React.useContext(ThemeContext);211 return (212 <ProfileStack.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation }}>213 <ProfileStack.Screen214 name='ProfileView'215 component={ProfileView}216 options={ProfileView.navigationOptions}217 />218 <ProfileStack.Screen219 name='UserPreferencesView'220 component={UserPreferencesView}221 options={UserPreferencesView.navigationOptions}222 />223 <ProfileStack.Screen224 name='UserNotificationPrefView'225 component={UserNotificationPrefView}226 options={UserNotificationPrefView.navigationOptions}227 />228 <ProfileStack.Screen229 name='PickerView'230 component={PickerView}231 options={PickerView.navigationOptions}232 />233 </ProfileStack.Navigator>234 );235};236// SettingsStackNavigator237const SettingsStack = createStackNavigator();238const SettingsStackNavigator = () => {239 const { theme } = React.useContext(ThemeContext);240 return (241 <SettingsStack.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation }}>242 <SettingsStack.Screen243 name='SettingsView'244 component={SettingsView}245 options={SettingsView.navigationOptions}246 />247 <SettingsStack.Screen248 name='SecurityPrivacyView'249 component={SecurityPrivacyView}250 options={SecurityPrivacyView.navigationOptions}251 />252 <SettingsStack.Screen253 name='E2EEncryptionSecurityView'254 component={E2EEncryptionSecurityView}255 options={E2EEncryptionSecurityView.navigationOptions}256 />257 <SettingsStack.Screen258 name='LanguageView'259 component={LanguageView}260 options={LanguageView.navigationOptions}261 />262 <SettingsStack.Screen263 name='ThemeView'264 component={ThemeView}265 options={ThemeView.navigationOptions}266 />267 <SettingsStack.Screen268 name='DefaultBrowserView'269 component={DefaultBrowserView}270 options={DefaultBrowserView.navigationOptions}271 />272 <SettingsStack.Screen273 name='ScreenLockConfigView'274 component={ScreenLockConfigView}275 options={ScreenLockConfigView.navigationOptions}276 />277 </SettingsStack.Navigator>278 );279};280// AdminPanelStackNavigator281const AdminPanelStack = createStackNavigator();282const AdminPanelStackNavigator = () => {283 const { theme } = React.useContext(ThemeContext);284 return (285 <AdminPanelStack.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation }}>286 <AdminPanelStack.Screen287 name='AdminPanelView'288 component={AdminPanelView}289 options={AdminPanelView.navigationOptions}290 />291 </AdminPanelStack.Navigator>292 );293};294// DrawerNavigator295const Drawer = createDrawerNavigator();296const DrawerNavigator = () => {297 const { theme } = React.useContext(ThemeContext);298 return (299 <Drawer.Navigator300 drawerContent={({ navigation, state }) => <Sidebar navigation={navigation} state={state} />}301 drawerPosition={I18nManager.isRTL ? 'right' : 'left'}302 screenOptions={{ swipeEnabled: false }}303 drawerType='back'304 overlayColor={`rgba(0,0,0,${ themes[theme].backdropOpacity })`}305 >306 <Drawer.Screen name='ChatsStackNavigator' component={ChatsStackNavigator} />307 <Drawer.Screen name='ProfileStackNavigator' component={ProfileStackNavigator} />308 <Drawer.Screen name='SettingsStackNavigator' component={SettingsStackNavigator} />309 <Drawer.Screen name='AdminPanelStackNavigator' component={AdminPanelStackNavigator} />310 </Drawer.Navigator>311 );312};313// NewMessageStackNavigator314const NewMessageStack = createStackNavigator();315const NewMessageStackNavigator = () => {316 const { theme } = React.useContext(ThemeContext);317 return (318 <NewMessageStack.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation }}>319 <NewMessageStack.Screen320 name='NewMessageView'321 component={NewMessageView}322 options={NewMessageView.navigationOptions}323 />324 <NewMessageStack.Screen325 name='SelectedUsersViewCreateChannel'326 component={SelectedUsersView}327 />328 <NewMessageStack.Screen329 name='CreateChannelView'330 component={CreateChannelView}331 options={CreateChannelView.navigationOptions}332 />333 <NewMessageStack.Screen334 name='CreateDiscussionView'335 component={CreateDiscussionView}336 />337 </NewMessageStack.Navigator>338 );339};340// E2ESaveYourPasswordStackNavigator341const E2ESaveYourPasswordStack = createStackNavigator();342const E2ESaveYourPasswordStackNavigator = () => {343 const { theme } = React.useContext(ThemeContext);344 return (345 <E2ESaveYourPasswordStack.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation }}>346 <E2ESaveYourPasswordStack.Screen347 name='E2ESaveYourPasswordView'348 component={E2ESaveYourPasswordView}349 options={E2ESaveYourPasswordView.navigationOptions}350 />351 <E2ESaveYourPasswordStack.Screen352 name='E2EHowItWorksView'353 component={E2EHowItWorksView}354 options={E2EHowItWorksView.navigationOptions}355 />356 </E2ESaveYourPasswordStack.Navigator>357 );358};359// E2EEnterYourPasswordStackNavigator360const E2EEnterYourPasswordStack = createStackNavigator();361const E2EEnterYourPasswordStackNavigator = () => {362 const { theme } = React.useContext(ThemeContext);363 return (364 <E2EEnterYourPasswordStack.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation }}>365 <E2EEnterYourPasswordStack.Screen366 name='E2EEnterYourPasswordView'367 component={E2EEnterYourPasswordView}368 options={E2EEnterYourPasswordView.navigationOptions}369 />370 </E2EEnterYourPasswordStack.Navigator>371 );372};373// InsideStackNavigator374const InsideStack = createStackNavigator();375const InsideStackNavigator = () => {376 const { theme } = React.useContext(ThemeContext);377 return (378 <InsideStack.Navigator mode='modal' screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...ModalAnimation }}>379 <InsideStack.Screen380 name='DrawerNavigator'381 component={DrawerNavigator}382 options={{ headerShown: false }}383 />384 <InsideStack.Screen385 name='NewMessageStackNavigator'386 component={NewMessageStackNavigator}387 options={{ headerShown: false }}388 />389 <InsideStack.Screen390 name='E2ESaveYourPasswordStackNavigator'391 component={E2ESaveYourPasswordStackNavigator}392 options={{ headerShown: false }}393 />394 <InsideStack.Screen395 name='E2EEnterYourPasswordStackNavigator'396 component={E2EEnterYourPasswordStackNavigator}397 options={{ headerShown: false }}398 />399 <InsideStack.Screen400 name='AttachmentView'401 component={AttachmentView}402 />403 <InsideStack.Screen404 name='StatusView'405 component={StatusView}406 />407 <InsideStack.Screen408 name='ShareView'409 component={ShareView}410 />411 <InsideStack.Screen412 name='ModalBlockView'413 component={ModalBlockView}414 options={ModalBlockView.navigationOptions}415 />416 <InsideStack.Screen417 name='JitsiMeetView'418 component={JitsiMeetView}419 options={{ headerShown: false }}420 />421 </InsideStack.Navigator>422 );423};...

Full Screen

Full Screen

main-stack.js

Source:main-stack.js Github

copy

Full Screen

1import React from 'react';2import {mainStack} from 'src/config/navigator';3import {createStackNavigator} from '@react-navigation/stack';4import HomeTabs from './home-tabs';5import Blogs from 'src/screens/blog/blogs';6import Blog from 'src/screens/blog/blog';7import Checkout from 'src/screens/cart/checkout';8import WeViewCheckout from 'src/screens/cart/webview-checkout';9import WeViewPayment from 'src/screens/cart/webview-payment';10import WeViewThankYou from 'src/screens/cart/webview-thankyou';11import Products from 'src/screens/shop/products';12import Search from 'src/screens/shop/search';13import Product from 'src/screens/shop/product';14import ProductReview from 'src/screens/shop/product-review';15import ProductReviewForm from 'src/screens/shop/product-review-form';16import ProductDescription from 'src/screens/shop/product-description';17import ProductAttribute from 'src/screens/shop/product-attribute';18import Refine from 'src/screens/shop/refine';19import FilterCategory from 'src/screens/shop/filter-category';20import FilterAttribute from 'src/screens/shop/filter-attribute';21import FilterTag from 'src/screens/shop/filter-tag';22import FilterPrice from 'src/screens/shop/filter-price';23import Stores from 'src/screens/shop/stores';24import StoreDetail from 'src/screens/shop/store-detail';25import StoreReview from 'src/screens/shop/store-review';26import LinkingWebview from 'src/screens/linking-webview';27import SettingScreen from 'src/screens/profile/setting';28import HelpScreen from 'src/screens/profile/help';29import ContactScreen from 'src/screens/profile/contact';30import AccountScreen from 'src/screens/profile/account';31import ChangePasswordScreen from 'src/screens/profile/change-password';32import AddressBookScreen from 'src/screens/profile/address-book';33import OrderList from 'src/screens/profile/orders';34import OrderDetail from 'src/screens/profile/order';35import DemoConfig from 'src/screens/profile/demo-config';36import EditAccount from 'src/screens/profile/edit-account';37import Downloads from 'src/screens/profile/downloads';38import Page from 'src/screens/profile/Page';39const Stack = createStackNavigator();40function MainStack() {41 return (42 <Stack.Navigator43 initialRouteName={mainStack.home_tab}44 screenOptions={{gestureEnabled: false}}>45 <Stack.Screen46 options={{headerShown: false}}47 name={mainStack.home_tab}48 component={HomeTabs}49 />50 <Stack.Screen51 options={{headerShown: false}}52 name={mainStack.blogs}53 component={Blogs}54 />55 <Stack.Screen56 options={{headerShown: false}}57 name={mainStack.blog}58 component={Blog}59 />60 <Stack.Screen61 options={{headerShown: false}}62 name={mainStack.checkout}63 component={Checkout}64 />65 <Stack.Screen66 options={{headerShown: false}}67 name={mainStack.webview_checkout}68 component={WeViewCheckout}69 />70 <Stack.Screen71 options={{headerShown: false}}72 name={mainStack.webview_payment}73 component={WeViewPayment}74 />75 <Stack.Screen76 options={{headerShown: false}}77 name={mainStack.webview_thank_you}78 component={WeViewThankYou}79 />80 <Stack.Screen81 options={{headerShown: false}}82 name={mainStack.products}83 component={Products}84 />85 <Stack.Screen86 options={{headerShown: false}}87 name={mainStack.search}88 component={Search}89 />90 <Stack.Screen91 options={{headerShown: false}}92 name={mainStack.product}93 component={Product}94 />95 <Stack.Screen96 options={{headerShown: false}}97 name={mainStack.product_review}98 component={ProductReview}99 />100 <Stack.Screen101 options={{headerShown: false}}102 name={mainStack.product_review_form}103 component={ProductReviewForm}104 />105 <Stack.Screen106 options={{headerShown: false}}107 name={mainStack.product_description}108 component={ProductDescription}109 />110 <Stack.Screen111 options={{headerShown: false}}112 name={mainStack.product_attribute}113 component={ProductAttribute}114 />115 <Stack.Screen116 options={{headerShown: false}}117 name={mainStack.refine}118 component={Refine}119 />120 <Stack.Screen121 options={{headerShown: false}}122 name={mainStack.filter_category}123 component={FilterCategory}124 />125 <Stack.Screen126 options={{headerShown: false}}127 name={mainStack.filter_price}128 component={FilterPrice}129 />130 <Stack.Screen131 options={{headerShown: false}}132 name={mainStack.filter_tag}133 component={FilterTag}134 />135 <Stack.Screen136 options={{headerShown: false}}137 name={mainStack.filter_attribute}138 component={FilterAttribute}139 />140 <Stack.Screen141 options={{headerShown: false}}142 name={mainStack.stores}143 component={Stores}144 />145 <Stack.Screen146 options={{headerShown: false}}147 name={mainStack.store_detail}148 component={StoreDetail}149 />150 <Stack.Screen151 options={{headerShown: false}}152 name={mainStack.store_review}153 component={StoreReview}154 />155 <Stack.Screen156 options={{headerShown: false}}157 name={mainStack.linking_webview}158 component={LinkingWebview}159 />160 <Stack.Screen161 options={{headerShown: false}}162 name={mainStack.setting}163 component={SettingScreen}164 />165 <Stack.Screen166 options={{headerShown: false}}167 name={mainStack.contact}168 component={ContactScreen}169 />170 <Stack.Screen171 options={{headerShown: false}}172 name={mainStack.help}173 component={HelpScreen}174 />175 <Stack.Screen176 options={{headerShown: false}}177 name={mainStack.account}178 component={AccountScreen}179 />180 <Stack.Screen181 options={{headerShown: false}}182 name={mainStack.change_password}183 component={ChangePasswordScreen}184 />185 <Stack.Screen186 options={{headerShown: false}}187 name={mainStack.address_book}188 component={AddressBookScreen}189 />190 <Stack.Screen191 options={{headerShown: false}}192 name={mainStack.order_list}193 component={OrderList}194 />195 <Stack.Screen196 options={{headerShown: false}}197 name={mainStack.order_detail}198 component={OrderDetail}199 />200 <Stack.Screen201 options={{headerShown: false}}202 name={mainStack.demo_config}203 component={DemoConfig}204 />205 <Stack.Screen206 options={{headerShown: false}}207 name={mainStack.edit_account}208 component={EditAccount}209 />210 <Stack.Screen211 options={{headerShown: false}}212 name={mainStack.downloads}213 component={Downloads}214 />215 <Stack.Screen216 options={{headerShown: false}}217 name={mainStack.page}218 component={Page}219 />220 </Stack.Navigator>221 );222}...

Full Screen

Full Screen

ErrorStack.js

Source:ErrorStack.js Github

copy

Full Screen

1// |reftest| skip-if(!xulRuntime.shell) -- needs drainJobQueue2var BUGNUMBER = 1343158;3var summary = "Error.stack should provide meaningful stack trace in async function";4print(BUGNUMBER + ": " + summary);5let COOKIE = "C0F5DBB89807";6async function thrower() {7 let stack = new Error().stack; // line 118 assertEq(/^thrower@.+ErrorStack.js:11/m.test(stack), true, toMessage(stack));9 assertEq(/^inner@.+ErrorStack.js:38/m.test(stack), true, toMessage(stack));10 assertEq(/^async\*middle@.+ErrorStack.js:58/m.test(stack), true, toMessage(stack));11 assertEq(/^async\*outer@.+ErrorStack.js:78/m.test(stack), true, toMessage(stack));12 assertEq(/^async\*@.+ErrorStack.js:82/m.test(stack), true, toMessage(stack));13 throw new Error(COOKIE); // line 1814}15async function inner() {16 let stack = new Error().stack; // line 2217 assertEq(/thrower@.+ErrorStack.js/m.test(stack), false, toMessage(stack));18 assertEq(/^inner@.+ErrorStack.js:22/m.test(stack), true, toMessage(stack));19 assertEq(/^middle@.+ErrorStack.js:58/m.test(stack), true, toMessage(stack));20 assertEq(/^async\*outer@.+ErrorStack.js:78/m.test(stack), true, toMessage(stack));21 assertEq(/^async\*@.+ErrorStack.js:82/m.test(stack), true, toMessage(stack));22 await Promise.resolve(100);23 stack = new Error().stack; // line 3124 assertEq(/thrower@.+ErrorStack.js/m.test(stack), false, toMessage(stack));25 assertEq(/^inner@.+ErrorStack.js:31/m.test(stack), true, toMessage(stack));26 assertEq(/^async\*middle@.+ErrorStack.js:58/m.test(stack), true, toMessage(stack));27 assertEq(/^async\*outer@.+ErrorStack.js:78/m.test(stack), true, toMessage(stack));28 assertEq(/^async\*@.+ErrorStack.js:82/m.test(stack), true, toMessage(stack));29 await thrower(); // line 3830}31async function middle() {32 let stack = new Error().stack; // line 4233 assertEq(/thrower@.+ErrorStack.js/m.test(stack), false, toMessage(stack));34 assertEq(/inner@.+ErrorStack.js/m.test(stack), false, toMessage(stack));35 assertEq(/^middle@.+ErrorStack.js:42/m.test(stack), true, toMessage(stack));36 assertEq(/^outer@.+ErrorStack.js:78/m.test(stack), true, toMessage(stack));37 assertEq(/^async\*@.+ErrorStack.js:82/m.test(stack), true, toMessage(stack));38 await Promise.resolve(1000);39 stack = new Error().stack; // line 5140 assertEq(/thrower@.+ErrorStack.js/m.test(stack), false, toMessage(stack));41 assertEq(/inner@.+ErrorStack.js/m.test(stack), false, toMessage(stack));42 assertEq(/^middle@.+ErrorStack.js:51/m.test(stack), true, toMessage(stack));43 assertEq(/^async\*outer@.+ErrorStack.js:78/m.test(stack), true, toMessage(stack));44 assertEq(/^async\*@.+ErrorStack.js:82/m.test(stack), true, toMessage(stack));45 await inner(); // line 5846}47async function outer() {48 let stack = new Error().stack; // line 6249 assertEq(/thrower@.+ErrorStack.js/m.test(stack), false, toMessage(stack));50 assertEq(/inner@.+ErrorStack.js/m.test(stack), false, toMessage(stack));51 assertEq(/middle@.+ErrorStack.js/m.test(stack), false, toMessage(stack));52 assertEq(/^outer@.+ErrorStack.js:62/m.test(stack), true, toMessage(stack));53 assertEq(/^@.+ErrorStack.js:82/m.test(stack), true, toMessage(stack));54 await Promise.resolve(10000);55 stack = new Error().stack; // line 7156 assertEq(/thrower@.+ErrorStack.js/m.test(stack), false, toMessage(stack));57 assertEq(/inner@.+ErrorStack.js/m.test(stack), false, toMessage(stack));58 assertEq(/middle@.+ErrorStack.js/m.test(stack), false, toMessage(stack));59 assertEq(/^outer@.+ErrorStack.js:71/m.test(stack), true, toMessage(stack));60 assertEq(/^async\*@.+ErrorStack.js:82/m.test(stack), true, toMessage(stack));61 await middle(); // line 7862}63try {64 getPromiseResult(outer()); // line 8265 assertEq(true, false);66} catch (e) {67 // Re-throw the exception to log the assertion failure properly.68 if (!e.message.includes(COOKIE))69 throw e;70 let stack = e.stack;71 assertEq(/^thrower@.+ErrorStack.js:18/m.test(stack), true, toMessage(stack));72 assertEq(/^inner@.+ErrorStack.js:38/m.test(stack), true, toMessage(stack));73 assertEq(/^async\*middle@.+ErrorStack.js:58/m.test(stack), true, toMessage(stack));74 assertEq(/^async\*outer@.+ErrorStack.js:78/m.test(stack), true, toMessage(stack));75 assertEq(/^async\*@.+ErrorStack.js:82/m.test(stack), true, toMessage(stack));76}77function toMessage(stack) {78 // Provide the stack string in the error message for debugging.79 return `[stack: ${stack.replace(/\n/g, "\\n")}]`;80}81if (typeof reportCompare === "function")...

Full Screen

Full Screen

History.js

Source:History.js Github

copy

Full Screen

1import range from '../core/range';2export default class History {3 constructor($editable) {4 this.stack = [];5 this.stackOffset = -1;6 this.$editable = $editable;7 this.editable = $editable[0];8 }9 makeSnapshot() {10 const rng = range.create(this.editable);11 const emptyBookmark = { s: { path: [], offset: 0 }, e: { path: [], offset: 0 } };12 return {13 contents: this.$editable.html(),14 bookmark: ((rng && rng.isOnEditable()) ? rng.bookmark(this.editable) : emptyBookmark),15 };16 }17 applySnapshot(snapshot) {18 if (snapshot.contents !== null) {19 this.$editable.html(snapshot.contents);20 }21 if (snapshot.bookmark !== null) {22 range.createFromBookmark(this.editable, snapshot.bookmark).select();23 }24 }25 /**26 * @method rewind27 * Rewinds the history stack back to the first snapshot taken.28 * Leaves the stack intact, so that "Redo" can still be used.29 */30 rewind() {31 // Create snap shot if not yet recorded32 if (this.$editable.html() !== this.stack[this.stackOffset].contents) {33 this.recordUndo();34 }35 // Return to the first available snapshot.36 this.stackOffset = 0;37 // Apply that snapshot.38 this.applySnapshot(this.stack[this.stackOffset]);39 }40 /**41 * @method commit42 * Resets history stack, but keeps current editor's content.43 */44 commit() {45 // Clear the stack.46 this.stack = [];47 // Restore stackOffset to its original value.48 this.stackOffset = -1;49 // Record our first snapshot (of nothing).50 this.recordUndo();51 }52 /**53 * @method reset54 * Resets the history stack completely; reverting to an empty editor.55 */56 reset() {57 // Clear the stack.58 this.stack = [];59 // Restore stackOffset to its original value.60 this.stackOffset = -1;61 // Clear the editable area.62 this.$editable.html('');63 // Record our first snapshot (of nothing).64 this.recordUndo();65 }66 /**67 * undo68 */69 undo() {70 // Create snap shot if not yet recorded71 if (this.$editable.html() !== this.stack[this.stackOffset].contents) {72 this.recordUndo();73 }74 if (this.stackOffset > 0) {75 this.stackOffset--;76 this.applySnapshot(this.stack[this.stackOffset]);77 }78 }79 /**80 * redo81 */82 redo() {83 if (this.stack.length - 1 > this.stackOffset) {84 this.stackOffset++;85 this.applySnapshot(this.stack[this.stackOffset]);86 }87 }88 /**89 * recorded undo90 */91 recordUndo() {92 this.stackOffset++;93 // Wash out stack after stackOffset94 if (this.stack.length > this.stackOffset) {95 this.stack = this.stack.slice(0, this.stackOffset);96 }97 // Create new snapshot and push it to the end98 this.stack.push(this.makeSnapshot());99 }...

Full Screen

Full Screen

stack.two.spec.js

Source:stack.two.spec.js Github

copy

Full Screen

...3 var myStack;4 var testValue1 = "test_string1"5 var testValue2 = "test_string2"6 beforeEach(function() {7 myStack = new stack();8 myStack.push(testValue1);9 myStack.push(testValue2);10 });11 afterEach(function() {12 myStack = null;13 });14 it('the stack`s length should be 2', function () {15 expect(myStack.length).toBe(2);16 });17});18describe('When pushing two elements to a stack and then popping an element', function () {19 var myStack;20 var testValue1 = "test_string1"21 var testValue2 = "test_string2"22 beforeEach(function() {23 myStack = new stack();24 myStack.push(testValue1);25 myStack.push(testValue2);26 });27 afterEach(function() {28 myStack = null;29 });30 it('the stack`s length should be 1', function () {31 var result = myStack.pop();32 expect(myStack.length).toBe(1);33 });34 it('the element popped should be the last element added.', function () {35 var result = myStack.pop();36 expect(result).toBe(testValue2);37 });38});39describe('When pushing two elements to a stack and then popping 2 elements', function () {40 var myStack;41 var testValue1 = "test_string1"42 var testValue2 = "test_string2"43 beforeEach(function() {44 myStack = new stack();45 myStack.push(testValue1);46 myStack.push(testValue2);47 });48 afterEach(function() {49 myStack = null;50 });51 it('the stack`s length should be 0', function () {52 myStack.pop();53 myStack.pop();54 expect(myStack.length).toBe(0);55 });56 it('the elements popped should be in the inverse order to which they were added.', function () {57 var result1 = myStack.pop();58 var result2 = myStack.pop();...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var s = new Stack();2s.push(5);3s.push(8);4s.push(11);5s.push(15);6var q = new Queue();7q.enqueue('a');8q.enqueue('b');9q.enqueue('c');10var mySet = new Set();11mySet.add(1);12mySet.add(5);13mySet.add(5);14mySet.add('some text');15var o = {a: 1, b: 2};16mySet.add(o);17mySet.add({a: 1, b: 2}); 18mySet.delete(5);19mySet.add([1,2,3]);20mySet.add(o);21var dictionary = new Dictionary();22dictionary.add('David', '12345');23dictionary.add('Jennifer', '98765');24dictionary.add('Donnie', '56789');25dictionary.add('Raymond', '01010');26var value = dictionary.find('Jennifer');27if (value) {28 console.log('Jennifer: ' + value);29} else {30 console.log('Not found.');31}32dictionary.remove('Raymond');33value = dictionary.find('Raymond');34if (value) {35 console.log('Raymond: ' + value);36} else {37 console.log('Not found.');38}

Full Screen

Using AI Code Generation

copy

Full Screen

1var Stack = require('./stack.js');2var stack = new Stack();3stack.push(1);4stack.push(2);5stack.push(3);6stack.push(4);7stack.push(5);8console.log(stack.pop());9console.log(stack.pop());10console.log(stack.pop());11console.log(stack.pop());12console.log(stack.pop());13console.log(stack.pop());14console.log(stack.pop());

Full Screen

Using AI Code Generation

copy

Full Screen

1var stack = require('./stack');2var myStack = new stack.Stack();3myStack.push(1);4myStack.push(2);5myStack.push(3);6myStack.push(4);7myStack.push(5);8myStack.push(6);9myStack.push(7);10myStack.push(8);11myStack.push(9);12myStack.push(10);13myStack.push(11);14myStack.push(12);15myStack.push(13);16myStack.push(14);17myStack.push(15);18myStack.push(16);19myStack.push(17);20myStack.push(18);21myStack.push(19);22myStack.push(20);23myStack.push(21);24myStack.push(22);25myStack.push(23);26myStack.push(24);27myStack.push(25);28myStack.push(26);29myStack.push(27);30myStack.push(28);31myStack.push(29);32myStack.push(30);33myStack.push(31);34myStack.push(32);35myStack.push(33);36myStack.push(34);37myStack.push(35);38myStack.push(36);39myStack.push(37);40myStack.push(38);41myStack.push(39);42myStack.push(40);43myStack.push(41);44myStack.push(42);45myStack.push(43);46myStack.push(44);47myStack.push(45);48myStack.push(46);49myStack.push(47);50myStack.push(48);51myStack.push(49);52myStack.push(50);53myStack.push(51);54myStack.push(52);55myStack.push(53);56myStack.push(54);57myStack.push(55);58myStack.push(56);59myStack.push(57);60myStack.push(58);61myStack.push(59);62myStack.push(60);63myStack.push(61);64myStack.push(62);65myStack.push(63);66myStack.push(64);67myStack.push(65);68myStack.push(66);69myStack.push(67);70myStack.push(68);71myStack.push(69);72myStack.push(70);73myStack.push(71);74myStack.push(72);75myStack.push(73);76myStack.push(74);77myStack.push(75);78myStack.push(76);79myStack.push(77);80myStack.push(78);81myStack.push(79);82myStack.push(80);

Full Screen

Using AI Code Generation

copy

Full Screen

1const Stack = require('./stack.js');2const stack = new Stack();3stack.push(1);4stack.push(2);5stack.push(3);6stack.push(4);7console.log(stack.pop());8console.log(stack.pop());9console.log(stack.pop());10console.log(stack.pop());11class Stack {12 constructor() {13 this.items = [];14 }15 push(item) {16 this.items.push(item);17 }18 pop() {19 if (this.items.length === 0) {20 return 'Stack is empty';21 } else {22 return this.items.pop();23 }24 }25}26module.exports = Stack;27const Queue = require('./queue.js');28const queue = new Queue();29queue.enqueue(1);30queue.enqueue(2);31queue.enqueue(3);32queue.enqueue(4);33console.log(queue.dequeue());34console.log(queue.dequeue());35console.log(queue.dequeue());36console.log(queue.dequeue());37class Queue {38 constructor() {39 this.items = [];40 }41 enqueue(item) {42 this.items.push(item);43 }44 dequeue() {45 if (this.items.length === 0) {46 return 'Queue is empty';47 } else {48 return this.items.shift();49 }50 }51}52module.exports = Queue;53const Queue = require('./queueUsingStack.js');54const queue = new Queue();55queue.enqueue(1);56queue.enqueue(2);57queue.enqueue(3);58queue.enqueue(4);59console.log(queue.dequeue());60console.log(queue.dequeue());61console.log(queue.dequeue());62console.log(queue.dequeue());63class Queue {64 constructor() {65 this.items = [];66 }67 enqueue(item) {68 this.items.push(item);69 }70 dequeue() {71 if (this.items.length === 0) {72 return 'Queue is empty';73 } else {74 return this.items.shift();75 }76 }77}

Full Screen

Using AI Code Generation

copy

Full Screen

1var Stack = require('./stack')2var stack = new Stack();3stack.push(10)4stack.push(20)5stack.push(30)6stack.push(40)7stack.push(50)8stack.printStack();9stack.pop();10stack.printStack();11console.log("Peek: " + stack.peek());12console.log("isEmpty: " + stack.isEmpty());13console.log("Size: " + stack.size());

Full Screen

Using AI Code Generation

copy

Full Screen

1let stack = [];2let input = "1+2)*3-4)*5-6)))";3let output = '';4for (let i = 0; i < input.length; i++) {5 if (input[i] == ')') {6 while (stack.length > 0 && stack[stack.length - 1] != '(') {7 output += stack.pop();8 }9 stack.pop();10 } else {11 stack.push(input[i]);12 }13}14while (stack.length > 0) {15 output += stack.pop();16}17console.log(output);

Full Screen

Using AI Code Generation

copy

Full Screen

1var stack = [];2var str = "Hello World!";3for (var i = 0; i < str.length; i++) {4 stack.push(str[i]);5}6var reverseStr = "";7for (var i = 0; i < str.length; i++) {8 reverseStr += stack.pop();9}10console.log(reverseStr);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ava automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful