Skip to content

Instantly share code, notes, and snippets.

View vikrantnegi's full-sized avatar
Focusing

Vikrant Negi vikrantnegi

Focusing
View GitHub Profile
{
isDataFetched ? renderX() : renderPlaceholders();
}
useEffect(() => {
fetch("https://www.googleapis.com/books/v1/volumes/?maxResults=30&q=danbrown")
.then(response => response.json())
.then(responseJson => {
const { items } = responseJson;
const booksList = items.map(book => {
const {
volumeInfo: { title, authors, imageLinks },
id: bookId
const [books, setBooks] = useState([...new Array(10).fill({})]);
const [isDataFetched, setDataFetched] = useState(false);
export default function App() {
const [books, setBooks] = useState([...new Array(10).fill({})]);
const [isDataFetched, setDataFetched] = useState(false);
useEffect(() => {
fetch(
"https://www.googleapis.com/books/v1/volumes/?maxResults=30&q=danbrown"
)
.then(response => response.json())
.then(responseJson => {
const BookCardPlaceholderComponent = () => (
<Placeholder
Animation={ShineOverlay}
style={{
marginVertical: 6,
marginHorizontal: 15,
borderRadius: 4
}}
Left={props => (
<PlaceholderMedia
const BookCardComponent = props => {
const { thumbnail, title, authors, onPress } = props;
return (
<View style={styles.shadow}>
<TouchableOpacity
onPress={onPress}
style={{
flexDirection: "row",
padding: 8
@vikrantnegi
vikrantnegi / sampleREADME.md
Created November 14, 2019 13:09 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

export default class App extends React.Component {
constructor(props) {
super(props);
setI18nConfig(); // set initial config
}
componentDidMount() {
RNLocalize.addEventListener("change", this.handleLocalizationChange);
}
const translationGetters = {
// lazy requires (metro bundler does not support symlinks)
ar: () => require("./src/translations/ar.json"),
en: () => require("./src/translations/en.json"),
fr: () => require("./src/translations/fr.json")
};
const translate = memoize(
(key, config) => i18n.t(key, config),
(key, config) => (config ? key + JSON.stringify(config) : key)
import React from "react";
import * as RNLocalize from "react-native-localize";
import i18n from "i18n-js";
import memoize from "lodash.memoize"; // Use for caching/memoize for better performance
import {
I18nManager,
SafeAreaView,
ScrollView,
StyleSheet,