This commit is contained in:
Rodrigo Nascimento 2017-11-13 10:58:35 -02:00
parent 50c50a790a
commit d96a098b60
No known key found for this signature in database
GPG Key ID: CFCE33B7B01AC335
15 changed files with 56 additions and 38 deletions

View File

@ -20,7 +20,9 @@ const styles = StyleSheet.create({
class Avatar extends React.PureComponent {
render() {
const { text = '', size = 25, 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 = {

View File

@ -34,7 +34,9 @@ export default class extends React.PureComponent {
onClose: PropTypes.func.isRequired
}
render() {
const { image, isVisible, onClose, title } = this.props;
const {
image, isVisible, onClose, title
} = this.props;
return (
<Modal
isVisible={isVisible}
@ -50,7 +52,7 @@ export default class extends React.PureComponent {
style={styles.image}
source={{ uri: encodeURI(image) }}
mutable
resizeMode={'contain'}
resizeMode='contain'
/>
</ScrollView>
</View>

View File

@ -38,7 +38,7 @@ const AuthRoutes = StackNavigator(
title: navigation.state.params.title || 'Room',
headerLeft: (
<HeaderBackButton
title={'Back'}
title='Back'
onPress={() => backToScreen(navigation, 'RoomsList')}
/>
)

View File

@ -18,9 +18,7 @@ if (__DEV__) {
applyMiddleware(logger)
);
} else {
enhacers = composeWithDevTools(
applyMiddleware(sagaMiddleware)
);
enhacers = composeWithDevTools(applyMiddleware(sagaMiddleware));
}
const store = enhacers(createStore)(reducers);

View File

@ -10,17 +10,20 @@ const initialState = {
export default function connect(state = initialState, action) {
switch (action.type) {
case METEOR.REQUEST:
return { ...state,
return {
...state,
connecting: true
};
case METEOR.SUCCESS:
return { ...state,
return {
...state,
connecting: false,
connected: true,
failure: false
};
case METEOR.FAILURE:
return { ...state,
return {
...state,
connecting: false,
connected: false,
failure: true,

View File

@ -12,14 +12,16 @@ const initialState = {
export default function login(state = initialState, action) {
switch (action.type) {
case types.LOGIN.REQUEST:
return { ...state,
return {
...state,
isFetching: true,
isAuthenticated: false,
failure: false,
error: ''
};
case types.LOGIN.SUCCESS:
return { ...state,
return {
...state,
isFetching: false,
isAuthenticated: true,
user: action.user,
@ -28,7 +30,8 @@ export default function login(state = initialState, action) {
error: ''
};
case types.LOGIN.FAILURE:
return { ...state,
return {
...state,
isFetching: false,
isAuthenticated: false,
failure: true,
@ -37,7 +40,8 @@ export default function login(state = initialState, action) {
case types.LOGOUT:
return initialState;
case types.LOGIN.SET_TOKEN:
return { ...state,
return {
...state,
token: action.token,
user: action.user
};

View File

@ -8,15 +8,18 @@ const initialState = {
export default function messages(state = initialState, action) {
switch (action.type) {
case types.MESSAGES.REQUEST:
return { ...state,
return {
...state,
isFetching: true
};
case types.MESSAGES.SUCCESS:
return { ...state,
return {
...state,
isFetching: false
};
case types.LOGIN.FAILURE:
return { ...state,
return {
...state,
isFetching: false,
failure: true,
errorMessage: action.err

View File

@ -5,8 +5,7 @@ const initialState = {};
export default function navigations(state = initialState, action) {
switch (action.type) {
case types.NAVIGATION.SET:
return action.navigator
;
return action.navigator;
default:
return state;
}

View File

@ -3,7 +3,8 @@ import initialState from './initialState';
export default function settings(state = initialState.settings, action) {
if (action.type === types.SET_ALL_SETTINGS) {
return { ...state,
return {
...state,
...action.payload
};
}

View File

@ -8,15 +8,18 @@ const initialState = {
export default function login(state = initialState, action) {
switch (action.type) {
case types.ROOMS.REQUEST:
return { ...state,
return {
...state,
isFetching: true
};
case types.ROOMS.SUCCESS:
return { ...state,
return {
...state,
isFetching: false
};
case types.ROOMS.FAILURE:
return { ...state,
return {
...state,
isFetching: false,
failure: true,
errorMessage: action.err

View File

@ -12,18 +12,21 @@ const initialState = {
export default function server(state = initialState, action) {
switch (action.type) {
case SERVER.REQUEST:
return { ...state,
return {
...state,
connecting: true,
failure: false
};
case SERVER.SUCCESS:
return { ...state,
return {
...state,
connecting: false,
connected: true,
failure: false
};
case SERVER.FAILURE:
return { ...state,
return {
...state,
connecting: false,
connected: false,
failure: true,

View File

@ -97,7 +97,7 @@ class ForgotPasswordView extends React.Component {
{this.props.login.failure && <Text style={styles.error}>{this.props.login.error.reason}</Text>}
</View>
<Spinner visible={this.props.login.isFetching} textContent="Loading..." textStyle={{ color: '#FFF' }} />
<Spinner visible={this.props.login.isFetching} textContent='Loading...' textStyle={{ color: '#FFF' }} />
</View>
</SafeAreaView>
</KeyboardView>

View File

@ -27,7 +27,7 @@ export default class extends React.PureComponent {
style={{ ...styles.image }}
source={{ uri: encodeURI(image) }}
mutable
resizeMode={'contain'}
resizeMode='contain'
/>
</ScrollView>
</View>

View File

@ -87,10 +87,10 @@ export default class RoomsListView extends React.Component {
.filtered('_server.id = $0 AND t = $1', this.props.server, 'd');
this.state = {
dataSource: ds.cloneWithRows(this.data),
searching: false,
searchDataSource: [],
searchText: '',
login: false
// searching: false,
// searchDataSource: [],
searchText: ''
// login: false
};
this.data.addListener(this.updateState);
}
@ -103,8 +103,8 @@ export default class RoomsListView extends React.Component {
onSearchChangeText = (text) => {
const searchText = text.trim();
this.setState({
searchText: text,
searching: searchText !== ''
searchText: text
// searching: searchText !== ''
});
if (searchText === '') {
return this.setState({

View File

@ -5,9 +5,9 @@ import Avatar from '../../app/containers/Avatar';
export default (
<ScrollView>
<Avatar text={'test'} />
<Avatar size={40} text={'aa'} />
<Avatar size={30} text={'bb'} />
<Avatar text={'test'} borderRadius={2} />
<Avatar text='test' />
<Avatar size={40} text='aa' />
<Avatar size={30} text='bb' />
<Avatar text='test' borderRadius={2} />
</ScrollView>
);