This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type BrowsersListProps = { | |
loading: boolean | |
browsers: Browser[] | |
modalVisible: boolean | |
description: string | |
changeDescription: (description: string) => void | |
changeOpacity: () => void | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {useEffect, useState} from 'react' | |
import {BrowsersListProps} from '../components/BrowsersList' | |
export function useBrowsers(url: string): BrowsersListProps { | |
const [loading, setLoading] = useState(true) | |
// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
export type Browser = { | |
fullname: string // we expect "fullname" Browser field to be a string | |
image: string | |
linkToBrowser: string | |
minMemory: string | |
currentVersion: string | |
minimumRAM: string | |
description: string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type Browser = { | |
fullname: string // we expect "fullname" Browser field to be a string | |
image: string | |
linkToBrowser: string | |
minMemory: string | |
currentVersion: string | |
minimumRAM: string | |
description: string | |
windows: boolean | |
mac: boolean |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// useBrowsers.js | |
... | |
return { | |
loading, | |
browsers, | |
modalVisible, | |
descripton, | |
changeDescription, | |
changeOpacity, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import {BrowsersList} from './components/BrowsersList' | |
import {useBrowsers} from './hooks/useBrowsers' | |
export function Browsers() { | |
return <BrowsersList {...useBrowsers('https://google.com/myData.json')} /> | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import {FlatList, StyleSheet, View} from 'react-native' | |
import AddModal from '../../../components/AddModal' | |
import LoadingIndicator from '../../../components/LoadingIndicator' | |
import BrowserItem from '../../../components/BrowserItem' | |
const styles = StyleSheet.create({ | |
container: { | |
justifyContent: 'center', | |
alignItems: 'center', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useEffect, useState} from 'react' | |
import {FlatList, StyleSheet, View} from 'react-native' | |
import AddModal from '../components/AddModal' | |
import LoadingIndicator from '../components/LoadingIndicator' | |
import BrowserItem from '../components/BrowserItem' | |
const styles = StyleSheet.create({ | |
container: { | |
justifyContent: 'center', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Browsers({url = 'https://google.com/myData.json'}) { | |
const URL = url | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from 'react'; | |
import { FlatList, Text, View, StyleSheet, Modal, TouchableOpacity } from 'react-native'; | |
import AddModal from '../components/AddModal'; | |
import LoadingIndicator from '../components/LoadingIndicator' | |
import BrowserItem from '../components/BrowserItem' | |
import colors from '../config/colors'; | |
function Browsers() { |