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 { class Avatar extends React.PureComponent {
render() { 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 { initials, color } = avatarInitialsAndColor(`${ text }`);
const iconContainerStyle = { const iconContainerStyle = {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,18 +12,21 @@ const initialState = {
export default function server(state = initialState, action) { export default function server(state = initialState, action) {
switch (action.type) { switch (action.type) {
case SERVER.REQUEST: case SERVER.REQUEST:
return { ...state, return {
...state,
connecting: true, connecting: true,
failure: false failure: false
}; };
case SERVER.SUCCESS: case SERVER.SUCCESS:
return { ...state, return {
...state,
connecting: false, connecting: false,
connected: true, connected: true,
failure: false failure: false
}; };
case SERVER.FAILURE: case SERVER.FAILURE:
return { ...state, return {
...state,
connecting: false, connecting: false,
connected: false, connected: false,
failure: true, 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>} {this.props.login.failure && <Text style={styles.error}>{this.props.login.error.reason}</Text>}
</View> </View>
<Spinner visible={this.props.login.isFetching} textContent="Loading..." textStyle={{ color: '#FFF' }} /> <Spinner visible={this.props.login.isFetching} textContent='Loading...' textStyle={{ color: '#FFF' }} />
</View> </View>
</SafeAreaView> </SafeAreaView>
</KeyboardView> </KeyboardView>

View File

@ -27,7 +27,7 @@ export default class extends React.PureComponent {
style={{ ...styles.image }} style={{ ...styles.image }}
source={{ uri: encodeURI(image) }} source={{ uri: encodeURI(image) }}
mutable mutable
resizeMode={'contain'} resizeMode='contain'
/> />
</ScrollView> </ScrollView>
</View> </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'); .filtered('_server.id = $0 AND t = $1', this.props.server, 'd');
this.state = { this.state = {
dataSource: ds.cloneWithRows(this.data), dataSource: ds.cloneWithRows(this.data),
searching: false, // searching: false,
searchDataSource: [], // searchDataSource: [],
searchText: '', searchText: ''
login: false // login: false
}; };
this.data.addListener(this.updateState); this.data.addListener(this.updateState);
} }
@ -103,8 +103,8 @@ export default class RoomsListView extends React.Component {
onSearchChangeText = (text) => { onSearchChangeText = (text) => {
const searchText = text.trim(); const searchText = text.trim();
this.setState({ this.setState({
searchText: text, searchText: text
searching: searchText !== '' // searching: searchText !== ''
}); });
if (searchText === '') { if (searchText === '') {
return this.setState({ return this.setState({

View File

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