Created
February 19, 2019 09:43
-
-
Save mrcthms/d9f23e1bd9f39521968fbe6dd0cb3ea6 to your computer and use it in GitHub Desktop.
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, { PureComponent, Fragment } from 'react' | |
import { Search, ListView, Avatar, TabBar, Header, ScreenTitle } from 'component-library' | |
import { Settings } from 'component-library/icons' | |
class App extends PureComponent { | |
state = { | |
searchValue: '', | |
listItems: [] | |
} | |
componentDidMount() { | |
fetch('/get-items') | |
.then(data => data.json()) | |
.then(listItems => this.setState({ listItems })) | |
} | |
handleSearchChange = e => { | |
const { value } = e.target | |
this.setState({ | |
searchValue: value | |
}) | |
} | |
render() { | |
const { user, goToProfile, goToSettings } = this.props | |
const { listItems, searchValue } = this.state | |
return ( | |
<Fragment> | |
<Header> | |
<ScreenTitle>Transactions</ScreenTitle> | |
<Settings onPress={goToSettings} /> | |
<Avatar src={user.src} name={user.name} onPress={goToProfile} /> | |
<Search align="left" initialValue="" onChange={this.handleSearchChange} /> | |
</Header> | |
<ListView items={listItems} filter={searchValue} /> | |
<TabBar active="transactions" /> | |
</Fragment> | |
) | |
} | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment