How to use the react-redux-firebase.isLoaded function in react-redux-firebase

To help you get started, we’ve selected a few react-redux-firebase 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 prescottprue / generator-react-firebase / examples / react-firebase-redux / src / containers / Navbar / Navbar.js View on Github external
function Navbar() {
  const classes = useStyles()

  // Get auth from redux state
  const auth = useSelector(state => state.firebase.auth)
  const authExists = isLoaded(auth) && !isEmpty(auth)

  return (
    
      {authExists ? (
        
      ) : (
        <button data-test="sign-in">
          Sign In
        </button>
      )}
    
  )
github prescottprue / react-redux-firebase / examples / complete / material / src / containers / Navbar / Navbar.enhancer.js View on Github external
withProps(({ auth, profile }) => ({
    authExists: isLoaded(auth) && !isEmpty(auth)
  })),
  // Flatten profile so that avatarUrl and displayName are props
github mapswipe / mapswipe / src / shared / views / Login.js View on Github external
componentDidUpdate(prevProps: Props) {
        const { auth, navigation } = this.props;
        if (auth !== prevProps.auth) {
            if (isLoaded(auth) && !isEmpty(auth)) {
                navigation.navigate('ProjectNav');
            }
        }
    }
github NUS-ALSET / achievements / src / containers / ActivitySolutions / ActivitySolutions.js View on Github external
render() {
    const activity = this.props.activity || {};
    const problemSolutions = this.props.problemSolutions || {};
    const { open, dialogData, showSolutionFor } = this.state;
    const { student, solution } = dialogData || {};
    if (
      isLoaded(this.props.activity) &amp;&amp;
      this.props.uid !== this.props.activity.owner
    ) {
      return (
        
          You are not the owner of this activity.
        
      );
    }
    const hasLoaded =
      isLoaded(this.props.activity) &amp;&amp; isLoaded(this.props.problemSolutions);

    if (!hasLoaded) {
      return (
        
          Loading...
github ChingStore / ching / src / components / onboarding / sign-up-oauth / index.js View on Github external
checkAuthStatusAndStage = () => {
    const { userId, storeId, history } = this.props
    const { refreshIntervalId } = this.state

    if (ReactReduxFirebase.isLoaded()) {
      clearInterval(refreshIntervalId)

      this.setState({ loading: false })

      if (userId && storeId) {
        history.push(ROUTE.PATH.STORE)
      }

      if (userId && !storeId) {
        history.push(ROUTE.PATH.SIGN_UP_STORE)
      }
    }
  }
github prescottprue / react-redux-firebase / examples / complete / typescript / src / List.tsx View on Github external
function List() {
  useFirestoreConnect([{
    collection: "todos",
  }]);
  const todos = useSelector((state: SystemState) =&gt; state.firebase.data.todos);
  if (!isLoaded(todos)) { return "Loading..."; }
  if (isEmpty(todos)) { return null; }
  return (
    <ul>
      {todos.map((todo: any) =&gt; (
        <li>{todo.name}</li>
      ))}
    </ul>
  );
}
github prescottprue / react-redux-firebase / examples / complete / simple / src / Home.js View on Github external
<div>
        <h2>react-redux-firebase demo</h2>
        <img alt="logo" src="{logo}">
      </div>
      <div>
        <h4>
          Loaded From
          <span>
            <a href="https://redux-firebasev3.firebaseio.com/">
              redux-firebasev3.firebaseio.com
            </a>
          </span>
        </h4>
        <h4>Todos List</h4>
        {
          !isLoaded(todos)
            ? 'Loading'
            : isEmpty(todos)
              ? 'Todo list is empty'
              : todos.reverse().map(({ value: todo, key }, ind) =&gt; (
                
              ))
        }
        
      </div>
    
  )
}
github ChingStore / ching / src / components / root / index.js View on Github external
isLoaded = (): boolean => {
    const { auth, items, orders, currentUser, currentStore } = this.props
    return ReactReduxFirebase.isLoaded(
      auth,
      items,
      orders,
      currentUser,
      currentStore
    )
  }
}