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 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
| // 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
| 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
| // ... | |
| 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
| 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 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 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
| type UIFriendlyListProps<T> = FlatListProps<T> & {loading?: 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
| import React from 'react' | |
| import {FlatList, FlatListProps, Text} from 'react-native' | |
| import LoadingIndicator from './LoadingIndicator' | |
| export type UIFriendlyListProps<T> = FlatListProps<T> & {loading?: boolean} | |
| export function UIFriendlyList<T>(props: UIFriendlyListProps<T>) { | |
| if (props.loading) { | |
| return <LoadingIndicator /> | |
| } |