This commit is contained in:
Diego Sampaio 2017-08-21 22:24:41 -03:00
parent 7d4b01c9e4
commit 5fc7fe247e
No known key found for this signature in database
GPG Key ID: E060152B30502562
17 changed files with 221 additions and 933 deletions

View File

@ -113,7 +113,8 @@
"semi": [2, "always"], "semi": [2, "always"],
"prefer-const": 2, "prefer-const": 2,
"object-shorthand": 2, "object-shorthand": 2,
"consistent-return": 0 "consistent-return": 0,
"global-require": "off"
}, },
"globals": { "globals": {
"__DEV__": true "__DEV__": true

2
.gitignore vendored
View File

@ -36,6 +36,8 @@ node_modules/
npm-debug.log npm-debug.log
yarn-error.log yarn-error.log
coverage/
# BUCK # BUCK
buck-out/ buck-out/
\.buckd/ \.buckd/

View File

@ -1,7 +1,14 @@
import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import { Animated, Text } from 'react-native'; import { Animated, Text } from 'react-native';
export default class Fade extends React.Component { export default class Fade extends React.Component {
static propTypes = {
visible: PropTypes.bool.isRequired,
style: PropTypes.object,
children: PropTypes.object
}
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -26,7 +33,7 @@ export default class Fade extends React.Component {
} }
render() { render() {
const { visible, style, children, ...rest } = this.props; const { style, children, ...rest } = this.props;
const containerStyle = { const containerStyle = {
opacity: this._visibility.interpolate({ opacity: this._visibility.interpolate({

View File

@ -36,18 +36,15 @@ export default class MessageBox extends React.PureComponent {
rid: PropTypes.string.isRequired rid: PropTypes.string.isRequired
} }
constructor(props) {
super(props);
// this._textInput.setNativeProps({ text: '' });
}
submit(message) { submit(message) {
// console.log(this.state); // console.log(this.state);
const text = message; const text = message;
if (text.trim() === '') { if (text.trim() === '') {
return; return;
} }
this.component && this.component.setNativeProps({ text: '' }); if (this.component) {
this.component.setNativeProps({ text: '' });
}
this.props.onSubmit(text); this.props.onSubmit(text);
} }

View File

@ -62,7 +62,8 @@ export default class RoomItem extends React.PureComponent {
type: PropTypes.string.isRequired, type: PropTypes.string.isRequired,
name: PropTypes.string.isRequired, name: PropTypes.string.isRequired,
unread: PropTypes.number, unread: PropTypes.number,
baseUrl: PropTypes.string baseUrl: PropTypes.string,
onPress: PropTypes.func
} }
get icon() { get icon() {
@ -115,9 +116,9 @@ export default class RoomItem extends React.PureComponent {
} }
render() { render() {
const { unread, name, _id } = this.props; const { unread, name } = this.props;
return ( return (
<TouchableOpacity key={_id} onPress={this.props.onPress} style={styles.container}> <TouchableOpacity onPress={this.props.onPress} style={styles.container}>
{this.icon} {this.icon}
<Text style={styles.roomName} ellipsizeMode='tail' numberOfLines={1}>{ name }</Text> <Text style={styles.roomName} ellipsizeMode='tail' numberOfLines={1}>{ name }</Text>
{this.renderNumber(unread)} {this.renderNumber(unread)}

View File

@ -1,4 +1,5 @@
import { StyleSheet, View, Text } from 'react-native'; import { StyleSheet, View, Text } from 'react-native';
import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
@ -24,6 +25,12 @@ const styles = StyleSheet.create({
})) }))
export default class Banner extends React.PureComponent { export default class Banner extends React.PureComponent {
static propTypes = {
connecting: PropTypes.bool,
authenticating: PropTypes.bool,
offline: PropTypes.bool
}
render() { render() {
const { connecting, authenticating, offline } = this.props; const { connecting, authenticating, offline } = this.props;
if (connecting) { if (connecting) {

View File

@ -37,7 +37,8 @@ Navigation.registerComponent('CustomButton', () => CustomButton);
export default class Cards extends React.PureComponent { export default class Cards extends React.PureComponent {
static propTypes = { static propTypes = {
data: PropTypes.object.isRequired data: PropTypes.object.isRequired,
base: PropTypes.string
} }
constructor() { constructor() {
super(); super();

View File

@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Text } from 'react-native'; import { Text } from 'react-native';
@ -61,13 +62,18 @@ export class PrivateScreen extends React.PureComponent {
return (<LoginView {...this.props} />); return (<LoginView {...this.props} />);
} }
} }
@connect(state => ({ @connect(() => ({
// logged: state.login.isAuthenticated // logged: state.login.isAuthenticated
}), dispatch => ({ }), dispatch => ({
// navigate: routeName => dispatch(NavigationActions.navigate({ routeName })), // navigate: routeName => dispatch(NavigationActions.navigate({ routeName })),
setNavigator: navigator => dispatch(setNavigator(navigator)) setNavigator: navigator => dispatch(setNavigator(navigator))
})) }))
export const HomeScreen = class extends React.PureComponent { export const HomeScreen = class extends React.PureComponent {
static propTypes = {
setNavigator: PropTypes.fun.isRequired,
navigator: PropTypes.object.isRequired
}
componentWillMount() { componentWillMount() {
this.props.setNavigator(this.props.navigator); this.props.setNavigator(this.props.navigator);
this.props.navigator.resetTo({ this.props.navigator.resetTo({

View File

@ -3,7 +3,6 @@ import 'regenerator-runtime/runtime';
import { createStore, applyMiddleware } from 'redux'; import { createStore, applyMiddleware } from 'redux';
import createSagaMiddleware from 'redux-saga'; import createSagaMiddleware from 'redux-saga';
import logger from 'redux-logger';
import reducers from '../reducers'; import reducers from '../reducers';
import sagas from '../sagas'; import sagas from '../sagas';

View File

@ -1,5 +1,4 @@
import Realm from 'realm'; import Realm from 'realm';
import { AsyncStorage } from 'react-native';
const serversSchema = { const serversSchema = {
name: 'servers', name: 'servers',

View File

@ -9,7 +9,6 @@ import settingsType from '../constants/settings';
import realm from './realm'; import realm from './realm';
import * as actions from '../actions'; import * as actions from '../actions';
import { disconnect, connectSuccess } from '../actions/connect'; import { disconnect, connectSuccess } from '../actions/connect';
import { loginSuccess } from '../actions/login';
export { Accounts } from 'react-native-meteor'; export { Accounts } from 'react-native-meteor';

View File

@ -1,4 +1,4 @@
import { takeEvery, takeLatest, select, take, put } from 'redux-saga/effects'; import { takeLatest, select, take, put } from 'redux-saga/effects';
import { MESSAGES, LOGIN } from '../actions/actionsTypes'; import { MESSAGES, LOGIN } from '../actions/actionsTypes';
import { messagesSuccess, messagesFailure } from '../actions/messages'; import { messagesSuccess, messagesFailure } from '../actions/messages';
import RocketChat from '../lib/rocketchat'; import RocketChat from '../lib/rocketchat';

View File

@ -75,7 +75,8 @@ class LoginView extends React.Component {
loginSubmit: PropTypes.func.isRequired, loginSubmit: PropTypes.func.isRequired,
server: PropTypes.string.isRequired, server: PropTypes.string.isRequired,
Accounts_EmailOrUsernamePlaceholder: PropTypes.string, Accounts_EmailOrUsernamePlaceholder: PropTypes.string,
Accounts_PasswordPlaceholder: PropTypes.string Accounts_PasswordPlaceholder: PropTypes.string,
login: PropTypes.object
} }
static navigationOptions = () => ({ static navigationOptions = () => ({

View File

@ -57,12 +57,14 @@ const styles = StyleSheet.create({
export default class RoomView extends React.Component { export default class RoomView extends React.Component {
static propTypes = { static propTypes = {
navigator: PropTypes.object.isRequired, navigator: PropTypes.object.isRequired,
getMessages: PropTypes.func.isRequired,
rid: PropTypes.string, rid: PropTypes.string,
sid: PropTypes.string, sid: PropTypes.string,
name: PropTypes.string, name: PropTypes.string,
server: PropTypes.string, server: PropTypes.string,
Site_Url: PropTypes.string, Site_Url: PropTypes.string,
Message_TimeFormat: PropTypes.string Message_TimeFormat: PropTypes.string,
loading: PropTypes.bool
} }
constructor(props) { constructor(props) {

View File

@ -67,6 +67,7 @@ const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
export default class RoomsListView extends React.Component { export default class RoomsListView extends React.Component {
static propTypes = { static propTypes = {
navigator: PropTypes.object.isRequired, navigator: PropTypes.object.isRequired,
Site_Url: PropTypes.string.isRequired,
server: PropTypes.string server: PropTypes.string
} }
@ -236,7 +237,7 @@ export default class RoomsListView extends React.Component {
renderItem = item => ( renderItem = item => (
<RoomItem <RoomItem
_id={item._id} key={item._id}
name={item.name} name={item.name}
type={item.t} type={item.t}
baseUrl={this.props.Site_Url} baseUrl={this.props.Site_Url}

View File

@ -72,6 +72,7 @@ const zeroconf = new Zeroconf();
export default class ListServerView extends React.Component { export default class ListServerView extends React.Component {
static propTypes = { static propTypes = {
navigator: PropTypes.object.isRequired, navigator: PropTypes.object.isRequired,
selectServer: PropTypes.func.isRequired,
actions: PropTypes.object, actions: PropTypes.object,
server: PropTypes.string server: PropTypes.string
} }

1090
package-lock.json generated

File diff suppressed because it is too large Load Diff