How to use the mobx-utils.fromPromise.resolve function in mobx-utils

To help you get started, we’ve selected a few mobx-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vonovak / react-navigation-mst-demo / screens / HomeScreen.js View on Github external
import React from 'react';
import { TextInput, Text, View, Button, FlatList, ActivityIndicator } from 'react-native';
import { inject, observer } from 'mobx-react';
import NavigationService from '../navigation/NavigationService';
import { ScreenWrapper, Row } from './Components';
import { Repo } from './Repo';
import { fromPromise, PENDING, REJECTED, FULFILLED } from 'mobx-utils';

class _HomeScreen extends React.Component {
  static navigationOptions = {
    title: 'Repo List',
  };

  state = {
    observableFetchPromise: fromPromise.resolve(),
  };

  render() {
    return this.state.observableFetchPromise.case({
      [PENDING]: () => ,
      [REJECTED]: err => ,
      [FULFILLED]: value => this.renderContent(),
    });
  }

  renderContent() {
    const { repoStore } = this.props;
    return (