Skip to content

Commit

Permalink
[NEW] Scrollable room name feature (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavpandey1998official authored and diegolmello committed Mar 25, 2019
1 parent c873b20 commit e9183b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion app/containers/HeaderButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { CustomIcon } from '../lib/Icons';
import { isIOS } from '../utils/deviceInfo';

const color = isIOS ? '#1D74F5' : '#FFF';
export const headerIconSize = 23;

const CustomHeaderButton = React.memo(props => (
<HeaderButton {...props} IconComponent={CustomIcon} iconSize={23} color={color} />
<HeaderButton {...props} IconComponent={CustomIcon} iconSize={headerIconSize} color={color} />
));

export const CustomHeaderButtons = React.memo(props => (
Expand Down
16 changes: 12 additions & 4 deletions app/views/RoomView/Header/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
View, Text, StyleSheet, LayoutAnimation
View, Text, StyleSheet, LayoutAnimation, ScrollView
} from 'react-native';
import { connect } from 'react-redux';
import { responsive } from 'react-native-responsive-ui';
Expand All @@ -13,6 +13,7 @@ import sharedStyles from '../../Styles';
import { isIOS } from '../../../utils/deviceInfo';
import { CustomIcon } from '../../../lib/Icons';
import Status from '../../../containers/Status/Status';
import { headerIconSize } from '../../../containers/HeaderButton';

const TITLE_SIZE = 18;
const ICON_SIZE = 18;
Expand Down Expand Up @@ -173,6 +174,7 @@ export default class RoomHeaderView extends Component {
window, title, usersTyping
} = this.props;
const portrait = window.height > window.width;
const widthScrollView = window.width - 6.5 * headerIconSize;
let scale = 1;

if (!portrait) {
Expand All @@ -183,9 +185,15 @@ export default class RoomHeaderView extends Component {

return (
<View style={styles.container}>
<View style={styles.titleContainer}>
{this.renderIcon()}
<Text style={[styles.title, { fontSize: TITLE_SIZE * scale }]} numberOfLines={1}>{title}</Text>
<View style={[styles.titleContainer, { width: widthScrollView }]}>
<ScrollView
showsHorizontalScrollIndicator={false}
horizontal
bounces={false}
>
{this.renderIcon()}
<Text style={[styles.title, { fontSize: TITLE_SIZE * scale }]} numberOfLines={1}>{title}</Text>
</ScrollView>
</View>
{this.typing}
</View>
Expand Down

0 comments on commit e9183b5

Please sign in to comment.