import ActionButton from 'react-native-action-button'; import Icon from 'react-native-vector-icons/Ionicons'; import React from 'react'; import PropTypes from 'prop-types'; import { Button, Text, View, FlatList, StyleSheet, TouchableOpacity, Platform, TextInput } from 'react-native'; import Meteor from 'react-native-meteor'; import realm from '../lib/realm'; import RocketChat from '../lib/rocketchat'; import RoomItem from '../components/RoomItem'; const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'stretch', justifyContent: 'center' }, separator: { height: 1, backgroundColor: '#E7E7E7' }, list: { width: '100%' }, emptyView: { flexGrow: 1, alignItems: 'stretch', justifyContent: 'center' }, emptyText: { textAlign: 'center', fontSize: 18, color: '#ccc' }, bannerContainer: { backgroundColor: '#ddd' }, bannerText: { textAlign: 'center', margin: 5 }, actionButtonIcon: { fontSize: 20, height: 22, color: 'white' }, searchBoxView: { backgroundColor: '#eee' }, searchBox: { backgroundColor: '#fff', margin: 5, borderRadius: 5, padding: 5, paddingLeft: 10, color: '#aaa' } }); let navigation; let setInitialData; Meteor.getData().on('loggingIn', () => { setTimeout(() => { if (Meteor._isLoggingIn === false && Meteor.userId() == null) { console.log('loggingIn', Meteor.userId()); navigation.navigate('Login'); } }, 100); }); Meteor.Accounts.onLogin(() => { console.log('onLogin'); }); export default class RoomsListView extends React.Component { static propTypes = { navigation: PropTypes.object.isRequired } static navigationOptions = (props) => { const server = RocketChat.currentServer ? RocketChat.currentServer.replace(/^https?:\/\//, '') : ''; const textAlign = Platform.OS === 'ios' ? 'center' : 'left'; const marginLeft = Platform.OS === 'ios' ? 0 : 20; const position = Platform.OS === 'ios' ? 'headerLeft' : 'headerRight'; return { headerTitle: Channels {server} , title: 'Channels', [position]: