Fixing merge from 'develop'.
This commit is contained in:
parent
3abc47b7d4
commit
6ac45fc620
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
import PropTypes from 'prop-types';
|
||||
import { StyleSheet, Text, View } from 'react-native';
|
||||
import { CachedImage } from 'react-native-img-cache';
|
||||
import avatarInitialsAndColor from '../../utils/avatarInitialsAndColor';
|
||||
import avatarInitialsAndColor from '../utils/avatarInitialsAndColor';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
iconContainer: {
|
||||
|
@ -20,25 +20,38 @@ const styles = StyleSheet.create({
|
|||
|
||||
class Avatar extends React.PureComponent {
|
||||
render() {
|
||||
const { text = '', size = 25, baseUrl = this.props.baseUrl,
|
||||
borderRadius = 5, style, avatar } = this.props;
|
||||
const { text = '', size = 25, baseUrl, borderRadius = 5, style, avatar } = this.props;
|
||||
const { initials, color } = avatarInitialsAndColor(`${ text }`);
|
||||
|
||||
const iconContainerStyle = {
|
||||
backgroundColor: color,
|
||||
width: size,
|
||||
height: size,
|
||||
borderRadius
|
||||
};
|
||||
|
||||
const avatarInitialsStyle = {
|
||||
fontSize: size / 2
|
||||
};
|
||||
|
||||
const avatarStyle = {
|
||||
width: size,
|
||||
height: size
|
||||
};
|
||||
|
||||
const uri = avatar || `${ baseUrl }/avatar/${ text }`;
|
||||
|
||||
const image = (avatar || baseUrl) && (
|
||||
<CachedImage
|
||||
style={[styles.avatar, avatarStyle]}
|
||||
source={{ uri }}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<View style={[styles.iconContainer, {
|
||||
backgroundColor: color,
|
||||
width: size,
|
||||
height: size,
|
||||
borderRadius
|
||||
}, style]}
|
||||
>
|
||||
<Text style={[styles.avatarInitials, { fontSize: size / 2 }]}>{initials}</Text>
|
||||
{(avatar || baseUrl) && <CachedImage
|
||||
style={[styles.avatar, {
|
||||
width: size,
|
||||
height: size
|
||||
}]}
|
||||
source={{ uri: avatar || `${ baseUrl }/avatar/${ text }` }}
|
||||
/>}
|
||||
<View style={[styles.iconContainer, iconContainerStyle, style]}>
|
||||
<Text style={[styles.avatarInitials, avatarInitialsStyle]}>{initials}</Text>
|
||||
{image}
|
||||
</View>);
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ import { emojify } from 'react-emojione';
|
|||
import Markdown from 'react-native-easy-markdown';
|
||||
|
||||
import Card from './message/Card';
|
||||
import Avatar from './message/Avatar';
|
||||
import Avatar from './Avatar';
|
||||
import User from './message/User';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
|
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
import PropTypes from 'prop-types';
|
||||
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
|
||||
import Avatar from './avatar';
|
||||
import Avatar from '../containers/Avatar';
|
||||
import avatarInitialsAndColor from '../utils/avatarInitialsAndColor';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
|
@ -79,7 +79,7 @@ export default class RoomItem extends React.PureComponent {
|
|||
return null;
|
||||
}
|
||||
|
||||
const { initials, color } = avatarInitialsAndColor(name);
|
||||
const { color } = avatarInitialsAndColor(name);
|
||||
|
||||
if (type === 'd') {
|
||||
return (
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { ScrollView } from 'react-native';
|
||||
|
||||
import Avatar from '../../app/components/avatar';
|
||||
import Avatar from '../../app/containers/Avatar';
|
||||
|
||||
export default (
|
||||
<ScrollView>
|
||||
|
|
127
yarn.lock
127
yarn.lock
|
@ -223,7 +223,7 @@ amdefine@>=0.0.4:
|
|||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
|
||||
|
||||
ansi-escapes@^1.1.0, ansi-escapes@^1.4.0:
|
||||
ansi-escapes@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e"
|
||||
|
||||
|
@ -1085,14 +1085,6 @@ babel-plugin-transform-strict-mode@^6.24.1:
|
|||
babel-runtime "^6.22.0"
|
||||
babel-types "^6.24.1"
|
||||
|
||||
babel-polyfill@6.23.0:
|
||||
version "6.23.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.23.0.tgz#8364ca62df8eafb830499f699177466c3b03499d"
|
||||
dependencies:
|
||||
babel-runtime "^6.22.0"
|
||||
core-js "^2.4.0"
|
||||
regenerator-runtime "^0.10.0"
|
||||
|
||||
babel-polyfill@^6.20.0, babel-polyfill@^6.23.0, babel-polyfill@^6.26.0:
|
||||
version "6.26.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153"
|
||||
|
@ -1705,7 +1697,7 @@ chain-function@^1.0.0:
|
|||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/chain-function/-/chain-function-1.0.0.tgz#0d4ab37e7e18ead0bdc47b920764118ce58733dc"
|
||||
|
||||
chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3:
|
||||
chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
|
||||
dependencies:
|
||||
|
@ -2848,7 +2840,7 @@ extend@~3.0.0:
|
|||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444"
|
||||
|
||||
external-editor@^2.0.1, external-editor@^2.0.4:
|
||||
external-editor@^2.0.4:
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.4.tgz#1ed9199da9cbfe2ef2f7a31b2fde8b0d12368972"
|
||||
dependencies:
|
||||
|
@ -3524,24 +3516,6 @@ inline-style-prefixer@^3.0.6:
|
|||
bowser "^1.6.0"
|
||||
css-in-js-utils "^1.0.3"
|
||||
|
||||
inquirer@3.0.6:
|
||||
version "3.0.6"
|
||||
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.0.6.tgz#e04aaa9d05b7a3cb9b0f407d04375f0447190347"
|
||||
dependencies:
|
||||
ansi-escapes "^1.1.0"
|
||||
chalk "^1.0.0"
|
||||
cli-cursor "^2.1.0"
|
||||
cli-width "^2.0.0"
|
||||
external-editor "^2.0.1"
|
||||
figures "^2.0.0"
|
||||
lodash "^4.3.0"
|
||||
mute-stream "0.0.7"
|
||||
run-async "^2.2.0"
|
||||
rx "^4.1.0"
|
||||
string-width "^2.0.0"
|
||||
strip-ansi "^3.0.0"
|
||||
through "^2.3.6"
|
||||
|
||||
inquirer@^3.0.6:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.2.1.tgz#06ceb0f540f45ca548c17d6840959878265fa175"
|
||||
|
@ -4322,10 +4296,6 @@ lodash.isarray@^3.0.0:
|
|||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55"
|
||||
|
||||
lodash.isequal@^4.5.0:
|
||||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
|
||||
|
||||
lodash.keys@^3.0.0, lodash.keys@^3.1.2:
|
||||
version "3.1.2"
|
||||
resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a"
|
||||
|
@ -4608,7 +4578,7 @@ minimist@0.0.8:
|
|||
version "0.0.8"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
|
||||
|
||||
minimist@1.2.0, minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.0:
|
||||
minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
|
||||
|
||||
|
@ -4636,20 +4606,10 @@ mkdirp@0.5.0:
|
|||
dependencies:
|
||||
minimist "0.0.8"
|
||||
|
||||
mobx-react@^4.2.1:
|
||||
version "4.2.2"
|
||||
resolved "https://registry.yarnpkg.com/mobx-react/-/mobx-react-4.2.2.tgz#db9cc3cafefbd830d0584c1149af5aae67829201"
|
||||
dependencies:
|
||||
hoist-non-react-statics "^1.2.0"
|
||||
|
||||
mobx@^2.3.4:
|
||||
version "2.7.0"
|
||||
resolved "https://registry.yarnpkg.com/mobx/-/mobx-2.7.0.tgz#cf3d82d18c0ca7f458d8f2a240817b3dc7e54a01"
|
||||
|
||||
mobx@^3.1.16:
|
||||
version "3.2.2"
|
||||
resolved "https://registry.yarnpkg.com/mobx/-/mobx-3.2.2.tgz#aa671459bededfd9880c948889a3f62bce09279c"
|
||||
|
||||
moment@^2.18.1:
|
||||
version "2.18.1"
|
||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.18.1.tgz#c36193dd3ce1c2eed2adb7c802dbbc77a81b1c0f"
|
||||
|
@ -4709,13 +4669,6 @@ negotiator@0.6.1:
|
|||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
|
||||
|
||||
node-fetch@1.6.3:
|
||||
version "1.6.3"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.6.3.tgz#dc234edd6489982d58e8f0db4f695029abcd8c04"
|
||||
dependencies:
|
||||
encoding "^0.1.11"
|
||||
is-stream "^1.0.1"
|
||||
|
||||
node-fetch@^1.0.1, node-fetch@^1.3.3, node-fetch@^1.6.3:
|
||||
version "1.7.2"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.2.tgz#c54e9aac57e432875233525f3c891c4159ffefd7"
|
||||
|
@ -4893,24 +4846,6 @@ onetime@^2.0.0:
|
|||
dependencies:
|
||||
mimic-fn "^1.0.0"
|
||||
|
||||
opencollective@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/opencollective/-/opencollective-1.0.3.tgz#aee6372bc28144583690c3ca8daecfc120dd0ef1"
|
||||
dependencies:
|
||||
babel-polyfill "6.23.0"
|
||||
chalk "1.1.3"
|
||||
inquirer "3.0.6"
|
||||
minimist "1.2.0"
|
||||
node-fetch "1.6.3"
|
||||
opn "4.0.2"
|
||||
|
||||
opn@4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/opn/-/opn-4.0.2.tgz#7abc22e644dff63b0a96d5ab7f2790c0f01abc95"
|
||||
dependencies:
|
||||
object-assign "^4.0.1"
|
||||
pinkie-promise "^2.0.0"
|
||||
|
||||
opn@^3.0.2:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/opn/-/opn-3.0.3.tgz#b6d99e7399f78d65c3baaffef1fb288e9b85243a"
|
||||
|
@ -5721,23 +5656,9 @@ react-native-action-button@^2.7.2:
|
|||
dependencies:
|
||||
prop-types "^15.5.10"
|
||||
|
||||
react-native-auto-grow-textinput@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-auto-grow-textinput/-/react-native-auto-grow-textinput-1.2.0.tgz#575f2e0fc2c49dbd4fa7fd91ba9f82bdf3409b0c"
|
||||
|
||||
react-native-autogrow-input@^0.2.1:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/react-native-autogrow-input/-/react-native-autogrow-input-0.2.1.tgz#4b0fb440b570efdedfde32666036db666d3ac4ec"
|
||||
dependencies:
|
||||
prop-types "^15.5.10"
|
||||
|
||||
react-native-autogrow-textinput@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-autogrow-textinput/-/react-native-autogrow-textinput-4.1.0.tgz#a7e5b17eb3c16ab08e31bbfb88d92488ed87f276"
|
||||
|
||||
react-native-button@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-button/-/react-native-button-2.1.0.tgz#a39e23292922afeea4f7be141dd43e18f1b51876"
|
||||
react-native-animatable@^1.2.3:
|
||||
version "1.2.3"
|
||||
resolved "https://registry.yarnpkg.com/react-native-animatable/-/react-native-animatable-1.2.3.tgz#d0f0bd694833b934f3aaa1275739228b786ecb4b"
|
||||
dependencies:
|
||||
prop-types "^15.5.10"
|
||||
|
||||
|
@ -5749,10 +5670,6 @@ react-native-compat@0.0.2:
|
|||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/react-native-compat/-/react-native-compat-0.0.2.tgz#5d7642f3d53ad324a025893be3c66d16a01cda23"
|
||||
|
||||
react-native-console-time-polyfill@0.0.6:
|
||||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/react-native-console-time-polyfill/-/react-native-console-time-polyfill-0.0.6.tgz#7823d86fe83439c74480d1b124a92b1a78571889"
|
||||
|
||||
react-native-dismiss-keyboard@1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-dismiss-keyboard/-/react-native-dismiss-keyboard-1.0.0.tgz#32886242b3f2317e121f3aeb9b0a585e2b879b49"
|
||||
|
@ -5782,11 +5699,7 @@ react-native-fetch-blob@^0.10.8:
|
|||
base-64 "0.1.0"
|
||||
glob "7.0.6"
|
||||
|
||||
react-native-form-generator@^0.9.9:
|
||||
version "0.9.9"
|
||||
resolved "https://registry.yarnpkg.com/react-native-form-generator/-/react-native-form-generator-0.9.9.tgz#68aae26d1e8dc3e30073ccd7bb298fbdfdce1bca"
|
||||
|
||||
react-native-image-picker@^0.26.3:
|
||||
react-native-image-picker@^0.26.4:
|
||||
version "0.26.4"
|
||||
resolved "https://registry.yarnpkg.com/react-native-image-picker/-/react-native-image-picker-0.26.4.tgz#e53b0564bef44cb3c96ff81594e1e874daa1f0b3"
|
||||
|
||||
|
@ -5796,11 +5709,7 @@ react-native-img-cache@^1.4.0:
|
|||
dependencies:
|
||||
crypto-js "^3.1.9-1"
|
||||
|
||||
react-native-loader@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-loader/-/react-native-loader-1.1.0.tgz#9e87e88d5b0a03a26b28591b23da73408a189e47"
|
||||
|
||||
react-native-loading-spinner-overlay@^0.5.1:
|
||||
react-native-loading-spinner-overlay@^0.5.2:
|
||||
version "0.5.2"
|
||||
resolved "https://registry.yarnpkg.com/react-native-loading-spinner-overlay/-/react-native-loading-spinner-overlay-0.5.2.tgz#b7bcd277476d596615fd7feee601789f9bdc7acc"
|
||||
|
||||
|
@ -5829,18 +5738,6 @@ react-native-optimized-flatlist@^1.0.1:
|
|||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/react-native-optimized-flatlist/-/react-native-optimized-flatlist-1.0.1.tgz#dbee82f208b48bef23c6cb26f1d5f3ac58e675b2"
|
||||
|
||||
react-native-router-flux@^4.0.0-beta.18:
|
||||
version "4.0.0-beta.21"
|
||||
resolved "https://registry.yarnpkg.com/react-native-router-flux/-/react-native-router-flux-4.0.0-beta.21.tgz#cdbb3cec5b18fab0ffdb8abf38ce790749f625d0"
|
||||
dependencies:
|
||||
lodash.isequal "^4.5.0"
|
||||
mobx "^3.1.16"
|
||||
mobx-react "^4.2.1"
|
||||
opencollective "^1.0.3"
|
||||
prop-types "^15.5.10"
|
||||
react-native-button "^2.0.0"
|
||||
react-navigation "^1.0.0-beta.11"
|
||||
|
||||
react-native-svg-image@^1.1.4:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/react-native-svg-image/-/react-native-svg-image-1.1.4.tgz#4c7af4edb5ec5146e1e47c5d2af211dd0528415c"
|
||||
|
@ -6193,7 +6090,7 @@ regenerate@^1.2.1:
|
|||
version "1.3.2"
|
||||
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.2.tgz#d1941c67bad437e1be76433add5b385f95b19260"
|
||||
|
||||
regenerator-runtime@^0.10.0, regenerator-runtime@^0.10.5:
|
||||
regenerator-runtime@^0.10.5:
|
||||
version "0.10.5"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658"
|
||||
|
||||
|
@ -6389,10 +6286,6 @@ rx-lite@*, rx-lite@^4.0.8:
|
|||
version "4.0.8"
|
||||
resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444"
|
||||
|
||||
rx@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782"
|
||||
|
||||
safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
|
||||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
|
||||
|
|
Loading…
Reference in New Issue