Changeset View
Changeset View
Standalone View
Standalone View
native/components/user-list-user.react.js
// @flow | // @flow | ||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { Text, Platform, Alert } from 'react-native'; | import { Text, Platform, Alert } from 'react-native'; | ||||
import { getAvatarForUser } from 'lib/shared/avatar-utils.js'; | |||||
import type { UserListItem } from 'lib/types/user-types.js'; | import type { UserListItem } from 'lib/types/user-types.js'; | ||||
import Avatar from './avatar.react.js'; | |||||
import Button from './button.react.js'; | import Button from './button.react.js'; | ||||
import { SingleLine } from './single-line.react.js'; | import { SingleLine } from './single-line.react.js'; | ||||
import { type Colors, useColors, useStyles } from '../themes/colors.js'; | import { type Colors, useColors, useStyles } from '../themes/colors.js'; | ||||
import type { TextStyle } from '../types/styles.js'; | import type { TextStyle } from '../types/styles.js'; | ||||
// eslint-disable-next-line no-unused-vars | // eslint-disable-next-line no-unused-vars | ||||
const getUserListItemHeight = (item: UserListItem): number => { | const getUserListItemHeight = (item: UserListItem): number => { | ||||
// TODO consider parent thread notice | // TODO consider parent thread notice | ||||
Show All 14 Lines | |||||
class UserListUser extends React.PureComponent<Props> { | class UserListUser extends React.PureComponent<Props> { | ||||
render() { | render() { | ||||
const { userInfo } = this.props; | const { userInfo } = this.props; | ||||
let notice = null; | let notice = null; | ||||
if (userInfo.notice) { | if (userInfo.notice) { | ||||
notice = <Text style={this.props.styles.notice}>{userInfo.notice}</Text>; | notice = <Text style={this.props.styles.notice}>{userInfo.notice}</Text>; | ||||
} | } | ||||
const { modalIosHighlightUnderlay: underlayColor } = this.props.colors; | const { modalIosHighlightUnderlay: underlayColor } = this.props.colors; | ||||
const avatarInfo = getAvatarForUser(this.props.userInfo); | |||||
return ( | return ( | ||||
<Button | <Button | ||||
onPress={this.onSelect} | onPress={this.onSelect} | ||||
disabled={userInfo.disabled} | disabled={userInfo.disabled} | ||||
iosFormat="highlight" | iosFormat="highlight" | ||||
iosHighlightUnderlayColor={underlayColor} | iosHighlightUnderlayColor={underlayColor} | ||||
iosActiveOpacity={0.85} | iosActiveOpacity={0.85} | ||||
style={this.props.styles.button} | style={this.props.styles.button} | ||||
> | > | ||||
<Avatar size="small" avatarInfo={avatarInfo} /> | |||||
<SingleLine style={[this.props.styles.text, this.props.textStyle]}> | <SingleLine style={[this.props.styles.text, this.props.textStyle]}> | ||||
{this.props.userInfo.username} | {this.props.userInfo.username} | ||||
</SingleLine> | </SingleLine> | ||||
{notice} | {notice} | ||||
</Button> | </Button> | ||||
); | ); | ||||
} | } | ||||
Show All 39 Lines |