Skip to content

Instantly share code, notes, and snippets.

View rutvikbhatt9's full-sized avatar
🎯
Focusing on new learning

Rutvik Bhatt rutvikbhatt9

🎯
Focusing on new learning
View GitHub Profile
import { ApolloClient, ApolloLink, Observable, InMemoryCache } from "@apollo/client";
import { onError } from "@apollo/client/link/error";
import { RetryLink } from "@apollo/client/link/retry";
import { createUploadLink } from 'apollo-upload-client'
const request = async (operation) => {
const token = "yourToken"; // you can get token from persistent storage or redux store
console.log('REQUESTING', operation.operationName, operation.variables);
operation.setContext({
headers: {
import client from './src/api';
import { ApolloProvider } from '@apollo/client';
import Home from './src/screens/Home'
const App= () => {
return (
<>
{....}
<ApolloProvider client={client}>
import { ApolloClient, ApolloLink, InMemoryCache } from "@apollo/client";
const link = ApolloLink.from([retryLink, requestLink, error, uploadLink]);
const cache = new InMemoryCache();
const client = new ApolloClient({
link,
cache,
});
import { onError } from "@apollo/client/link/error";
const error = onError((error) => {
const { graphQLErrors, networkError, operation } = error;
if (graphQLErrors) {
console.log('GRAPH QL ERROR', graphQLErrors);
if (!graphQLErrors[0].message) {
console.log('Something went wrong', graphQLErrors[0].name);
} else {
console.log("Error message", graphQLErrors[0].message);
import { ApolloLink, Observable } from "@apollo/client";
const request = async (operation) => {
const token = "yourToken"; // you can get token from persistent storage or redux store
console.log('REQUESTING', operation.operationName, operation.variables);
operation.setContext({
headers: {
authorization: `Bearer ${token}`,
},
});
@rutvikbhatt9
rutvikbhatt9 / .gitlab.ci.yml (react-native)
Created February 11, 2019 05:53
.gitlab.ci.yml file for React-Native
image: openjdk:8-jdk #Defining the Docker Image
variables:
ANDROID_COMPILE_SDK: "28" #set compile SDK version
ANDROID_BUILD_TOOLS: "28.0.2" #set build tool version
ANDROID_SDK_TOOLS: "4333796" #set SDK tool build number you can find yous here https://developer.android.com/studio/releases/sdk-tools
before_script:
# Fetch the specified SDK tools version to build with
- wget --quiet --output-document=/tmp/sdk-tools-linux.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
@rutvikbhatt9
rutvikbhatt9 / ArtistScreenScrollView.js
Last active January 26, 2021 09:46
Setting Animated.ScrollView
<Animated.ScrollView
overScrollMode={'never'}
style={{zIndex: 10}}
scrollEventThrottle={16}
onScroll={Animated.event([{
nativeEvent: {contentOffset: {y: this.state.scrollY}},
}], {
listener: (event) => {
},
useNativeDriver: false,
import React, {Component} from 'react';
/*Components*/
import {Animated, View, StatusBar, Text, Image, Platform, StyleSheet, Linking, TouchableOpacity} from 'react-native';
import Icons from 'react-native-vector-icons/MaterialCommunityIcons';
import MaterialAnimatedView from 'src/component/MaterialAnimatedView';
/*utils*/
import styles from './style';
import {ThemeUtils, Color} from 'src/utils';
/*Data*/
import artistData from 'src/assets/data/SongData';