Giter VIP home page Giter VIP logo

code-with-beto-mobile-app's Introduction

Hi, I'm Beto ๐Ÿ‘‹

I am a passionate Software Developer who enjoys spending countless hours coding

  • ๐Ÿ’ก I have an entrepreneurial spirit and love learning new technologies
  • ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป Iโ€™m currently helping thousands of developers to master React and React Native throw my Platform Code with Beto and my YouTube Channel
  • โ™Ÿ Fun fact: I like to play chess even though I'm not so good
  • ๐Ÿ” Learn more about me here

Connect with me


Beto's GitHub stats

code-with-beto-mobile-app's People

Contributors

betomoedano avatar skbhati199 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

code-with-beto-mobile-app's Issues

Problem with Routing

Steps to Reproduce:

  1. Navigate to the auth page (ie, an unprotected route) after signing out.
  2. Try to navigate on to a protected route from there for more than once.
  3. User gets redirected to the auth route only for the first time and not after that.

Expected Behavior:

The useProtectedRoute should redirect the user back to the auth route every time the user tries to visit protected route.

Actual Behavior:

User gets redirected to the auth route only for the first time and not after that.

Code Snippet Causing The Issue:

function useProtectedRoute(user: User) {
  const segments = useSegments();
  const navigationState = useRootNavigationState();

  const [hasNavigated, setHasNavigated] = React.useState(false);

  React.useEffect(() => {
    if (!navigationState?.key || hasNavigated) return;
    const inAuthGroup = segments[0] === "(auth)";

    if (!user.uid && !inAuthGroup) {
      router.replace("/(auth)/sign-in");
      setHasNavigated(true);
    } else if (user.uid && inAuthGroup) {
      router.replace("/(tabs)");
      setHasNavigated(true);
    }
  }, [user.uid, segments, navigationState, hasNavigated]);
}

Requested Action

I would like to open a pull request to address this issue.

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.