Every useQuery()
will cause 3 renderings after mount:
- with cache-data (StatusCode 1)
- "now loading" (StatusCode 1)
- with data-result, or error (StatusCode 7)
If you need some prefetching, consider using useLazyQuery()
function generateMarkers(fromCoordinate) { | |
const result = []; | |
const {latitude, longitude} = fromCoordinate; | |
for (let i = 0; i < 10; i++) { | |
let id = Math.ceil(Math.random() * 10000); | |
const newMarker = { | |
coordinate: { | |
latitude: latitude + (Math.random() - 0.5) * (LATITUDE_DELTA / 2), | |
longitude: longitude + (Math.random() - 0.5) * (LONGITUDE_DELTA / 2), | |
}, |
系列基本資料
煩到吐血。
詳細請參考這篇:【密技】手把手教你計算傷害與技能取捨
這裡列一下重點事項
import React from 'react'; | |
import { AppProvider } from "./AppContext"; | |
import { AppContainer } from "./AppContainer"; | |
function App() { | |
return ( | |
<AppProvider> | |
<AppContainer /> | |
</AppProvider> | |
); |
/*globals window, global, require*/ | |
/** | |
* CryptoJS core components. | |
*/ | |
var CryptoJS = CryptoJS || (function (Math, undefined) { | |
var crypto; | |
// Native crypto from window (Browser) |
// for js-yaml 4.0, to avoid unity "YAML unknown tag" error: schema is required | |
import yaml from "js-yaml"; | |
import path from "path"; | |
import fs, { readFileSync } from "fs"; | |
function parseAssetFile(p, assetsPath) { | |
// Read the File | |
let file = fs.readFileSync(path.resolve(assetsPath, p), { encoding: "utf-8" }); | |
// From github: https://github.com/nodeca/js-yaml/issues/100 |
import React, { useEffect, useState } from 'react'; | |
import { AccessibilityInfo } from 'react-native'; | |
const useScreenReaderEnabled = () => { | |
const [screenReaderEnabled, setScreenReaderEnabled] = useState(false); | |
useEffect(() => { | |
const screenReaderChangedSubscription = AccessibilityInfo.addEventListener( | |
"screenReaderChanged", | |
(screenReaderEnabled) => { | |
setScreenReaderEnabled(screenReaderEnabled); |
// @gorhom/bottom-sheet@^4 | |
import React, { | |
useCallback, | |
useLayoutEffect, | |
useMemo, | |
useRef, | |
// useState, | |
} from 'react'; | |
import { View, StyleSheet, Dimensions, Text } from 'react-native'; | |
import MapView from 'react-native-maps'; |