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
const path = require("path"); | |
const exclusionList = require("metro-config/src/defaults/exclusionList"); | |
const escape = require("escape-string-regexp"); | |
const package = require("../package.json"); | |
const modules = Object.keys({ | |
...package.peerDependencies, | |
}); |
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 React from 'react'; | |
import {unstable_batchedUpdates} from 'react-native'; | |
const originalUseState = React.useState; | |
export function createBatchedStateHook( | |
batchingFunction: (fn: () => void) => void, | |
) { | |
const useState = originalUseState; | |
let updateQueue: (() => void)[] = []; |
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
export const LazyScrollView = forwardRef(function LazyScrollView( | |
props: LazyScrollViewProps, | |
ref: ForwardedRef<FlashList<unknown[]>>, | |
): JSX.Element { | |
const {children, estimatedScrollViewSize, estimatedItemSize} = | |
props; | |
const data = isArray(children) ? children : Children.toArray(children); | |
// No specific reason for 2000, just a big number. Roughly 2x the screen size |
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
const RecyclableImage = (props) => { | |
const imageUri = useRef(props.source.uri); | |
const imageRef = useRef(null); | |
if (props.source.uri && props.source.uri !== imageUri.current) { | |
imageUri.current = props.source.uri; | |
imageRef.current?.setNativeProps({ opacity: 0 }); | |
} | |
return <Image {...props} ref={imageRef} onLoad={()=> { imageRef.current?.setNativeProps({ opacity: 1 }) }} /> | |
} |
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 { NativeModules } from 'react-native'; | |
//resolves to the web version when relevant, reduces the need of .web.ts files | |
NativeModules.Toast.show('hello'); |