Giter Club home page Giter Club logo

react-native-loading-container's Issues

Loading overlay style

It's good to have. Everybody happy with loading overlay but it would be great to have styling props for it. I'll make a PR in near future.

How to use with Apollo?

I've been using this library with great success for simple fetch requests to external resources, but now I'm bringing Apollo / GraphQL into my codebase and I'm wondering how to properly use it with this package.

Apollo fetches data using its own HOC. You specify the query, and the data arrives at some point

const withQuery = graphql(gql`
  {
    nativeCurrencies {
      name
      symbol
    }
  }
`);

const enhance = compose(
  withQuery,
);

export default enhance(SomeComponent);

So my logic for handing the fetch is abstracted away into Apollo's HOC, so I don't have direct control over it anymore. All I have to work with is whether or not data.loading is true or false, which is great for DX. But I start to lose control over things like this.

Is there a way to get these two systems to work together? Perhaps, passing in my loading state directly rather than specifying the async functions?

Launching app from pre-bundled file won't find onLoadStartAsync

Hi Brent, thanks for putting this together! It solves a problem I was about to tackle within my app.

I ran into this issue when loading my app from a pre-bundled file.
Xcode log shows this error:
'Warning: Failed propType: Required prop onLoadStartAsyncwas not specified inLoadingContainer. Check the render method of PropertyList.'
If I load the app from the development server everything works wonderfully.
Is this a bug or a noob mistake? Can you point me on the right direction please?

Versions:
react-native-loading-container: 0.2.0
react-native: 0.15.0

Snippet:

class PropertyList extends Component {
  async _loadProperties() { /* stuff */ }

  async _handleResponse() { /* more stuff */ }

  render() {
    return (
      <LoadingContainer style={styles.searchBarContainer}
        onLoadStartAsync={this._loadProperties.bind(this)}
        onReadyAsync={this._handleResponse.bind(this)}
      >
        <ListView  />
      </LoadingContainer>
    )
  }
}

null is not an object (evaluating 'this._loadingOverlay.fadeOverlay')

Holla,

i get the above mentioned error sometimes. Any idea what to do or how to solve this?

My code:

    } else {
        return (
            <LoadingContainer
                onLoadStartAsync={this._loadInitialDataAsync.bind(this)}>
                { /* render content */ }
                <View style={{flex: 1}}>
                    <Image style={styles.backgroundImage}
                           source={require('../../Images/paper_background_icon.png')}/>
                    <ListView
                        dataSource={this.state.dataSource}
                        renderRow={this.renderNetworkList}
                    />
                    <AddNetworkActionBtn
                        style={{flex:1}}
                        navigator={this.props.navigator}
                        {...this.props}
                        actualNetworks={actualNetworks}/>
                </View>
            </LoadingContainer>
        )
    }
},


async _loadInitialDataAsync() {
    let response = await fetch(API_URL + 'families', {
        method: 'GET',
        headers: {'Authorization': AuthStore.getUserTokenWithBearer()}
    });
    return response.json();
},

How to Integrate with Pull to Refresh?

My LoadingContainer renders a ListView which contains a refreshControl prop:

<LoadingContainer
  ...
  onLoadStartAsync={this._loadInitialDataAsync.bind(this)}
  onReadyAsync={this._onReadyAsync.bind(this)}
  ...
>
  <ListView
    ...
    refreshControl={
          <RefreshControl
            ...
            onRefresh={() => {}} // what should I supply here?
            ...
          />
    ...
  />
</LoadingContainer>

What should I be supplying to onRefresh to get it to play nicely with onLoadStartAsync and onReadyAsync? I basically just want to re-execute their logic to get my ListView's data to update, but I'm not sure how to get that to work. Example would be great!

React.PropTypes is deprecated

Hello, I was planning on using your component for a project, but after testing your example I get multiple yellow warnings. These warnings are generated because React.PropTypes is being manually called for the indeterminate prop on ProgressBarAndroid.

The same warning links me to https://fb.me/react-warning-dont-call-proptypes.

I tried to fix it by myself but I couldn't figure it out.

I've attached screenshots of the three warnings I get.

screenshot_20170316-182525
screenshot_20170316-182529
screenshot_20170316-182534

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.