Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want this loader to be used in Sagas can you suggest #64

Closed
mvsiva4u opened this issue Nov 6, 2017 · 1 comment
Closed

I want this loader to be used in Sagas can you suggest #64

mvsiva4u opened this issue Nov 6, 2017 · 1 comment

Comments

@mvsiva4u
Copy link

mvsiva4u commented Nov 6, 2017

I have to use the loader in Sagas in a react native application. can you please suggest

@baltuonis
Copy link

baltuonis commented Feb 6, 2018

Bind it to global redux store.
This is how I use it:

in RootContainer

class RootContainer extends Component<Props> {
  render () {
    return (
      <MenuContext >
        <View style={styles.applicationView}>
          <ReduxNavigation />

          <Spinner
            overlayColor={'rgba(0,0,0,0.7)'}
            visible={this.props.fetching}
            size='large'
            textContent='Loading'
            textStyle={{color: '#FFF'}}
          />
        </View>
      </MenuContext>
    )
  }
  }

const getFetching = (state : State) : boolean => {
  if (state.login && state.login.fetching) { return true }
  if (state.userUpdate && state.userUpdate.fetching) { return true }
  if (state.userRegister && state.userRegister.fetching) { return true }
  ...
  return false
}

const mapStateToProps = (state) : Props => {
  return {
    fetching: getFetching(state),
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants