Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
beep

Janic Duplessis janicduplessis

🤖
beep
View GitHub Profile
View ghactions.yml
- name: Restore yarn workspaces
id: yarn-cache
uses: actions/cache@master
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
View MainApplication.java
+ import com.facebook.react.modules.network.OkHttpClientProvider;
+ import okhttp3.OkHttpClient;
+ import okhttp3.brotli.BrotliInterceptor;
...
public void onCreate() {
super.onCreate();
+ OkHttpClientProvider.setOkHttpClientFactory(() -> {
View KeyboardAvoidingView.tsx
import * as React from 'react';
import {
EmitterSubscription,
Keyboard,
KeyboardEvent,
LayoutAnimation,
Platform,
Dimensions,
ScreenRect,
} from 'react-native';
View WindowScrollContext.tsx
import * as React from 'react';
import PropTypes from 'prop-types';
type Props = {
disabled?: boolean;
children: React.ReactNode;
};
export class WindowScrollContext extends React.Component<Props> {
// https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/vendor/react-native/VirtualizedList/index.js#L470
View useDisableBodyScroll.ts
import * as React from 'react';
export function useDisableBodyScroll(disabled: boolean): void {
const scrollPosition = React.useRef(0);
React.useEffect(() => {
// Don't do anything if scroll is already blocked somewhere else.
if (!disabled || document.body.style.position === 'fixed') {
return undefined;
}
scrollPosition.current = window.scrollY;
View ProgressiveImage.tsx
import * as React from 'react';
import { Image, View, StyleSheet, ViewStyle, ImageProps } from 'react-native';
type ImageURISource = Readonly<{
uri?: string | undefined;
}>;
type Props = {
style?: ViewStyle | null | undefined;
lowResSource: ImageURISource;
View AppMinHeightWrapper.tsx
import { Box, useDimensions, useSafeAreaInsets } from '@th3rdwave/ui';
import * as React from 'react';
import { updateSafeAreaInsets } from './metrics';
/**
* This is a hack to simulate iOS keyboard behavior on Android. We use the
* keyboard behavior that causes the window to resize and make sure
* the min height stays the same when we detect that the keyboard opens.
*/
export function AppMinHeightWrapper({
View TypeScriptGenerator.js
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
View QueryRenderer.js
/* eslint-disable */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
View DevPersistedNavigationContainer.tsx
import AsyncStorage from '@react-native-community/async-storage';
import {
InitialState,
NavigationContainer,
NavigationContainerProps,
NavigationContainerRef,
} from '@react-navigation/core';
import * as React from 'react';
import { InteractionManager } from 'react-native';