Skip to content

Instantly share code, notes, and snippets.

View bogoslavskiy's full-sized avatar

Artem Bogoslavskiy bogoslavskiy

View GitHub Profile
import React from 'react'
import { View } from 'react-native';
import { MainNavProps } from '../navigation/types/MainStackParams';
export const ConversationScreen = ({}: MainNavProps<'Conversation'>) => {
return (
<View />
);
};
import React from 'react'
import { View } from 'react-native';
import { AuthNavProps } from '../navigation/types/AuthStackParams';
export const LoginScreen = ({}: AuthNavProps<'Conversation'>) => {
return (
<View />
);
};
overwrite: true
schema: "http://localhost:5000/graphql"
documents:
- components/**/*.tsx
- graphql/queries/*.ts
generates:
graphql/generated.ts:
plugins:
- typescript
- typescript-operations
import { ApolloClient, split, HttpLink, InMemoryCache } from '@apollo/client';
import { getMainDefinition } from '@apollo/client/utilities';
import { WebSocketLink } from '@apollo/link-ws';
import Introspection from './introspection-result.json';
const wsLink = new WebSocketLink({
uri: `ws://localhost:5000/graphql`,
options: { reconnect: true }
});
import React from 'react';
import { AsyncStorage } from 'react-native';
import UUID from 'uuid-random';
import { useApolloClient } from '@apollo/client';
type User = {
_id: string;
name: string;
}
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { AuthContext, getUserFromStorage } from '../contexts/AuthContext';
import { MainStackScreens } from './MainStack';
import { AuthStackScreens } from './AuthStack';
export const Routes: React.FC = () => {
const [loading, setLoading] = React.useState(true);
const { setUser, user } = React.useContext(AuthContext);
import * as React from 'react';
import { AppLoading } from 'expo';
import { ApolloProvider } from '@apollo/client';
import { client } from './graphql/client';
import { Routes } from './navigation/Routes';
import { AuthProvider, getUserFromStorage } from './contexts/AuthContext';
const App = ({ skipLoadingScreen }: { skipLoadingScreen: boolean }) => {
const [isLoadingComplete, setLoadingComplete] = React.useState(false);
import React from 'react';
import { TouchableOpacity, Text, Platform } from 'react-native';
interface ButtonProps {
title: string;
onPress?: () => void;
disabled?: boolean;
}
export const Button: React.FC<ButtonProps> = ({ title, onPress, disabled }) => (
import * as React from "react";
import { ViewStyle, StyleSheet, TextInputProps, View, TextInput } from "react-native";
interface InputProps extends TextInputProps {
noWrapper?: boolean;
containerStyle?: ViewStyle;
}
export const Input = (props: InputProps) => {
const { noWrapper, containerStyle, ...other } = props;
import React from 'react'
import { View } from 'react-native';
import { gql } from '@apollo/client';
export const MessageItemFragment = gql`
fragment MessageItem on Message {
_id
sender_id
senderName
text