App.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * Sample React Native App
  3. * https://github.com/facebook/react-native
  4. * @flow
  5. */
  6. import React, { Component } from 'react';
  7. import {
  8. Platform,
  9. StyleSheet,
  10. Text,
  11. View
  12. } from 'react-native';
  13. import IM from './src/services/IM';
  14. import Chat from './src/scenes/Chat';
  15. const instructions = Platform.select({
  16. ios: 'Press Cmd+R to reload,\n' +
  17. 'Cmd+D or shake for dev menu',
  18. android: 'Double tap R on your keyboard to reload,\n' +
  19. 'Shake or press menu button for dev menu',
  20. });
  21. type Props = {};
  22. export default class App extends Component<Props> {
  23. constructor(props) {
  24. super(props);
  25. this.state = {
  26. imInited: false
  27. }
  28. }
  29. componentDidMount() {
  30. IM.init()
  31. .then(() => {
  32. this.setState({ 'imInited': true });
  33. })
  34. .catch((error) => {
  35. console.warn(error,'cw');
  36. });
  37. }
  38. render() {
  39. return (
  40. <View style={{ flex: 1 }}>
  41. {
  42. this.state.imInited ?
  43. <Chat members={['Crixus']} />
  44. :
  45. null
  46. }
  47. </View>
  48. );
  49. }
  50. }