Replace mobx-state-tree with mobx and get a basic home feed rendering
This commit is contained in:
parent
6b32698b3e
commit
dc55f58004
20 changed files with 534 additions and 273 deletions
|
@ -1,20 +1,23 @@
|
|||
import React from 'react'
|
||||
import {Text, Button, View} from 'react-native'
|
||||
import React, {useEffect} from 'react'
|
||||
import {Text, View} from 'react-native'
|
||||
import {Shell} from '../shell'
|
||||
import type {RootTabsScreenProps} from '../routes/types'
|
||||
import {Feed} from '../com/Feed'
|
||||
// import type {RootTabsScreenProps} from '../routes/types'
|
||||
import {useStores} from '../../state'
|
||||
|
||||
export function Home({navigation}: RootTabsScreenProps<'Home'>) {
|
||||
export function Home(/*{navigation}: RootTabsScreenProps<'Home'>*/) {
|
||||
const store = useStores()
|
||||
useEffect(() => {
|
||||
console.log('Fetching home feed')
|
||||
store.homeFeed.fetch()
|
||||
}, [store.homeFeed])
|
||||
return (
|
||||
<Shell>
|
||||
<View style={{alignItems: 'center'}}>
|
||||
<Text style={{fontSize: 20, fontWeight: 'bold'}}>Home</Text>
|
||||
<Button
|
||||
title="Go to Jane's profile"
|
||||
onPress={() => navigation.navigate('Profile', {name: 'Jane'})}
|
||||
/>
|
||||
<Button title="Logout" onPress={() => store.session.logout()} />
|
||||
<View>
|
||||
<Text style={{fontSize: 20, fontWeight: 'bold'}}>
|
||||
Hello, {store.me.displayName} ({store.me.name})
|
||||
</Text>
|
||||
<Feed feed={store.homeFeed} />
|
||||
</View>
|
||||
</Shell>
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue