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"],
"prefer-const": 2,
"object-shorthand": 2,
"consistent-return": 0
"consistent-return": 0,
"global-require": "off"
},
"globals": {
"__DEV__": true

2
.gitignore vendored
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,6 @@ import settingsType from '../constants/settings';
import realm from './realm';
import * as actions from '../actions';
import { disconnect, connectSuccess } from '../actions/connect';
import { loginSuccess } from '../actions/login';
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 { messagesSuccess, messagesFailure } from '../actions/messages';
import RocketChat from '../lib/rocketchat';

View File

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

View File

@ -57,12 +57,14 @@ const styles = StyleSheet.create({
export default class RoomView extends React.Component {
static propTypes = {
navigator: PropTypes.object.isRequired,
getMessages: PropTypes.func.isRequired,
rid: PropTypes.string,
sid: PropTypes.string,
name: PropTypes.string,
server: PropTypes.string,
Site_Url: PropTypes.string,
Message_TimeFormat: PropTypes.string
Message_TimeFormat: PropTypes.string,
loading: PropTypes.bool
}
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 {
static propTypes = {
navigator: PropTypes.object.isRequired,
Site_Url: PropTypes.string.isRequired,
server: PropTypes.string
}
@ -236,7 +237,7 @@ export default class RoomsListView extends React.Component {
renderItem = item => (
<RoomItem
_id={item._id}
key={item._id}
name={item.name}
type={item.t}
baseUrl={this.props.Site_Url}

View File

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

1090
package-lock.json generated

File diff suppressed because it is too large Load Diff