Skip to content

Instantly share code, notes, and snippets.

import { useState } from 'react';
import { Dimensions, KeyboardAvoidingViewProps, Platform, StyleSheet, View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import CommonKeyboardAvoidingView from '../KeyboardAvoidingView';
const { height: DEVICE_HEIGHT } = Dimensions.get('screen');
const IOSKeyboardAvoidingView = (props: KeyboardAvoidingViewProps) => {
const insets = useSafeAreaInsets();
import { useHeaderHeight } from "@react-navigation/elements";
import {
KeyboardAvoidingView as RNKeyboardAvoidingView,
KeyboardAvoidingViewProps as RNKeyboardAvoidingViewProps,
Platform,
StyleSheet,
} from 'react-native';
const BEHAVIOR = Platform.OS === 'ios' ? 'padding' : undefined;
import {
KeyboardAvoidingView as RNKeyboardAvoidingView,
KeyboardAvoidingViewProps as RNKeyboardAvoidingViewProps,
Platform,
StyleSheet,
} from 'react-native';
const BEHAVIOR = Platform.OS === 'ios' ? 'padding' : undefined;
const KeyboardAvoidingView = ({ style, ...props }: RNKeyboardAvoidingViewProps) => (
@felippepuhle
felippepuhle / Player.tsx
Created November 13, 2020 13:22
ant media web player
import React, { useRef, useState, useCallback, useEffect, memo } from 'react'
import styled from 'styled-components'
import { MEDIA } from 'src/styles'
import {
AntMediaCommands,
AntMediaTakeConfigurationType,
AntMediaTakeConfigurationSignal,
AntMediaTakeCandidateSignal,
import {useCallback, useReducer, useEffect, Reducer} from 'react';
type GenericDataType = {
id: string;
};
type Action<T extends GenericDataType> = {
type: 'PROCESS_ROW';
payload: T;
};
import { UserAPI } from '@datasources'
import { GraphQLType, getGlobalId, updateLocalUser } from '@relay'
// ...
const onPressBlockUser = useCallback(async (blockedUserId: string) => {
await UserAPI.blockUser({ blockedUserId })
updateLocalUser(
getGlobalId({ type: GraphQLType.USER, resourceId: blockedUserId }),
() => ({ isBlocked: true })
import { GraphQLType, getGlobalId } from '@relay'
// ...
const onPressTag = useCallback((tag: TagDataFromREST) => {
navigation.navigate(TagScreen.TAG_VIDEOS, {
id: getGlobalId({
type: GraphQLType.GOLIVE_TAG,
resourceId: tag.id,
}),
})
import { ReleasyProvider, Config, Link, renderToStringWithData } from 'react-releasy';
const config = new Config({
link: new Link({
url: 'https://yourserveraddress.com/graphql',
}),
});
const Application = (
<ReleasyProvider config={config}>
import path from 'path';
import fs from 'fs';
import { ReleasyProvider, Config, Link, renderToStringWithData } from 'react-releasy';
// renderer middleware
const filePath = path.resolve(__dirname, '..', 'build', 'index.html');
fs.readFile(filePath, 'utf8', (htmlErr, htmlData) => {
if (htmlErr) {
return res.status(404).end()
}
"dependencies": {
"react-relay": "https://github.com/releasy/relay/releases/download/v1.7.0-releasy/react-relay-1.7.0-releasy.tgz",
},
"resolutions": {
"react-relay": "https://github.com/releasy/relay/releases/download/v1.7.0-releasy/react-relay-1.7.0-releasy.tgz"
},