This file contains hidden or 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 { | |
View, | |
StyleSheet, | |
Image, | |
Animated, | |
TouchableOpacity, | |
Text, |
This file contains hidden or 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 React, { Component, useCallback, useState, useRef } from "react"; | |
import "./App.css"; | |
const imgUrl = require("./assets/iPhone-XS-Portrait-Space-Gray.png"); | |
const fullSize = { | |
width: 1325, | |
height: 2616 | |
}; |
This file contains hidden or 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 * as path from "path"; | |
import * as fs from "fs"; | |
export default function netlifyModulePreload(config) { | |
return { | |
name: "netlify-modulepreload", | |
generateBundle(outputOptions, bundle) { | |
const { publicRoot, entries } = config; | |
const { dir, format } = outputOptions; |
This file contains hidden or 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
// Global import to register <virtual-scroller /> custom element | |
// This should be replaced with a layered import once it is introduced into browsers | |
import "virtual-scroller/src/virtual-scroller"; | |
import React, { | |
useRef, | |
useEffect, | |
forwardRef, | |
useImperativeMethods | |
} from "react"; |
This file contains hidden or 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 ReactDOM from "react-dom"; | |
export default ReactDOM.unstable_batchedUpdates; |
This file contains hidden or 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 React from "react"; | |
import { usePress } from "./usePress"; | |
export const MyJSButton = () => { | |
const [pressRef, isPressed, accessibilityProps] = usePress( | |
"button", // role [button | link] | |
() => console.log("Pressed!"), // callback | |
true // should preventDefault | |
); |
This file contains hidden or 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 React, { useContext, useLayoutEffect, useEffect, useRef } from "react"; | |
import GatewayRegistry from "./GatewayRegistry"; | |
import { GatewayContext } from "./GatewayProvider"; | |
const Gateway = props => { | |
const gatewayRegistry = useContext(GatewayContext); | |
// keeping track of previous `into` prop | |
const prevIntoRef = useRef(); | |
useLayoutEffect(() => { |
This file contains hidden or 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
React Wormhole Registry Entry* | |
Unmounted* | |
Empty* | |
container registered -> Has Container | |
Has Container | |
target registered -> Mounted |
This file contains hidden or 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
/** | |
* This is the "native" module that runs on the main thread | |
* To add this to the bridge the exported class gets added to the `nativeModules` array in the `bootstrap.js` file. | |
* | |
* @flow | |
*/ | |
import { | |
RCT_EXPORT_METHOD, | |
RCT_EXPORT_MODULE, |
This file contains hidden or 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
(() => { | |
window.history.pushState("BackHandler", null, null); | |
window.onpopstate = () => { | |
if(document.dispatchEvent(new Event("hardwareBackPress")) { | |
window.history.back(); | |
} else { | |
window.history.pushState("BackHandler", null, null); | |
} |