- Like TabNavigator, StackNavigator keeps previous screens in the stack - it doesn't unmount/unrender them. Unmounting would cause previous screens to lose state, making them slower to load when you return to them. There is an active Github discussion about this, but no official solution yet.
- Screens in the middle of the navigation stack will still re-render when props change. We may be able to do some work with
shouldComponentUpdate
on each screen to avoid re-rendering. Again, there's a long discussion on Github about fixing this. - When navigating to a screen you've already been to, the screen is mounted again (meaning two of the same screen are in the stack).
- We can remove screens from the navigation stack using
goBack
orreset
.goBack
will pop the current screen off the stack and return to the previous screen.reset
allows you to manually clear the stack and set the active screen. We should usegoBack
wherever possible, and look for places where we canreset
the stack. - I'm not clear
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createClient } from "@supabase/supabase-js"; | |
import jwt from "jsonwebtoken"; | |
import { headers } from "next/headers"; | |
export const dynamic = "force-dynamic"; // defaults to auto | |
export async function GET(request: Request) { | |
// const authHeader = req.headers.get('Authorization')! | |
const headersList = headers(); | |
const authHeader = headersList.get("Authorization") ?? ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let baselineAnimationValue = new Animated.Value(0); | |
let titleXPosition = new Animated.Value(0); | |
let titleOpacity = new Animated.Value(0); | |
// our baseline animation, going from 0 to 1 | |
function runBaselineAnimation() { | |
Animated.timing(this.state.baselineAnimationValue, { | |
toValue: 1, | |
duration: 2000, // 2 seconds | |
}).start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import cv2 | |
import numpy as np | |
from sklearn.cluster import MiniBatchKMeans | |
from phue import Bridge | |
HUE_IS_ENABLED = False | |
if HUE_IS_ENABLED: | |
hue = Bridge('10.0.0.12') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import * as React from 'react'; | |
import { Animated } from 'react-native'; | |
type HOCProps = { | |
/** | |
* The distance that a ScrollView has been scrolled | |
*/ | |
[key: string]: Animated.Value | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WHERE TO PUT SCRIPT TAGS | |
<script src="whatever.js"></script> | |
</body> | |
<html> | |
// if they don't depend on the DOM or script load order, you can put them in the head with an "async attribute | |
<script src="whatever.js" async></script> | |
</head> |