dappconnect-sdks/apps/mobile/App.tsx

86 lines
2.6 KiB
TypeScript
Raw Normal View History

// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable import/namespace */
2023-01-11 13:38:47 +00:00
import 'expo-dev-client'
2023-01-16 12:12:29 +00:00
import { useState } from 'react'
2023-01-11 13:38:47 +00:00
2023-01-16 12:12:29 +00:00
import {
Code,
Heading,
Label,
2023-01-18 15:42:55 +00:00
Messages,
2023-01-16 12:12:29 +00:00
Paragraph,
Shape,
Sidebar,
} from '@status-im/components'
import { Stack, TamaguiProvider } from '@tamagui/core'
import { useFonts } from 'expo-font'
import { SafeAreaView, ScrollView, TouchableOpacity } from 'react-native'
2023-01-11 13:38:47 +00:00
import tamaguiConfig from './tamagui.config'
type ThemeVars = 'light' | 'dark'
2023-01-11 13:38:47 +00:00
export default function App() {
const [theme, setTheme] = useState<ThemeVars>('light')
const [loaded] = useFonts({
Inter: require('@tamagui/font-inter/otf/Inter-Medium.otf'),
InterBold: require('@tamagui/font-inter/otf/Inter-Bold.otf'),
// Tamagui does this for you on web, but you need to do it manually on native. Only for the demo. We should seek a better solution.
UbuntuMono: require('./assets/fonts/UbuntuMono.ttf'),
})
if (!loaded) {
return null
}
2023-01-11 13:38:47 +00:00
return (
<TamaguiProvider config={tamaguiConfig} defaultTheme={theme}>
<SafeAreaView>
<ScrollView>
<Sidebar
name="Rarible"
description="Multichain community-centric NFT marketplace. Create, buy and sell your NFTs."
membersCount={123}
/>
<Stack
flexDirection="column"
justifyContent="center"
alignItems="center"
paddingTop={20}
2023-01-18 15:42:55 +00:00
paddingHorizontal={12}
width="100%"
backgroundColor="$background"
>
<Heading weight="semibold" marginBottom={12}>
Communities
</Heading>
<Heading heading="h2" marginBottom={12}>
This is an Heading 2
</Heading>
<Paragraph weight="semibold" marginBottom={12} uppercase>
Paragraph uppercased and bolded
</Paragraph>
<Paragraph marginBottom={12} uppercase>
This is a paragraph
</Paragraph>
<Label marginBottom={12}>This is a label</Label>
<Code marginBottom={12}>This is a code line</Code>
<Paragraph fontWeight="400">0x213abc190 ... 121ah4a9e</Paragraph>
<Shape marginVertical={20} />
2023-01-18 15:42:55 +00:00
<Paragraph>Theme selected - {theme}</Paragraph>
<TouchableOpacity
onPress={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
>
<Paragraph>Toogle theme</Paragraph>
</TouchableOpacity>
2023-01-18 15:42:55 +00:00
<Messages />
</Stack>
</ScrollView>
</SafeAreaView>
2023-01-11 13:38:47 +00:00
</TamaguiProvider>
)
}