Coder Social home page Coder Social logo

Custom Navigators about rfcs HOT 13 CLOSED

react-navigation avatar react-navigation commented on May 2, 2024 1
Custom Navigators

from rfcs.

Comments (13)

jpstrikesback avatar jpstrikesback commented on May 2, 2024 3

Hey @Theo-Taylor we took a different route and added docking capabilities to a fork of react-native-drawer-layout that added push/displace/slide drawers (added docking in another fork of that fork) and then exposed those in a fork of react-navigation's DrawerNavigator.

Basically you pass a drawerType='responsive' and a breakpoint in drawerResponsiveWidth at which it will dock or go back to being a push screen drawer (like twitter mobile).

We'll eventually PR these I think, but for now it's up there if it's of interest.

from rfcs.

by-theo avatar by-theo commented on May 2, 2024 2

Very basic implementation:
https://github.com/theo-taylor/basic-react-navigation-sidebar

from rfcs.

by-theo avatar by-theo commented on May 2, 2024 1

@jpstrikesback hey awesome!

This was like a proof of concept for us and we haven't been able to do much work on it since. But if you are interested in collaborating to make a custom navigator out of it we'd be happy to work with you!

from rfcs.

by-theo avatar by-theo commented on May 2, 2024 1

@jpstrikesback interesting, it seems plausible. Shoot me an email at [email protected], let's discuss how we can proceed.

from rfcs.

brentvatne avatar brentvatne commented on May 2, 2024

hey @Theo-Taylor! very cool stuff. we don't want to add more navigators to the core of react-navigation, we're actually going the opposite direction and plan on moving out as many as we can. but we're hoping that more folks like you build navigators to solve various use cases like this! we can have a directory for them inside of the docs

from rfcs.

by-theo avatar by-theo commented on May 2, 2024

@brentvatne awesome! I like the directory idea

from rfcs.

jpstrikesback avatar jpstrikesback commented on May 2, 2024

@Theo-Taylor this looks awesome!

Any chance you could share your code? We're about to experiment with iPad/Desktop nav and need split-screen/panes as well.

from rfcs.

jpstrikesback avatar jpstrikesback commented on May 2, 2024

@Theo-Taylor Sweet! Definitely interested! I want to be able to use navigation actions to show/hide but also change the content in side panes (dual and triple pane). And then be able to integrate that with linking for deep links and the web.

From your experience does that sound reasonable?

Cheers!
JP

from rfcs.

by-theo avatar by-theo commented on May 2, 2024

Hey @jpstrikesback, I'll definitely check them out

from rfcs.

brentvatne avatar brentvatne commented on May 2, 2024

cool stuff @Theo-Taylor!

from rfcs.

donni106 avatar donni106 commented on May 2, 2024

@Theo-Taylor did you ran into the following problem?

When I click on an item in the left navigation screen the right details screen is showing up. Everything is ok. When the right details screen is scrollable I scroll down a bit. Everything is ok.
But when I am changing now the right details screen with clicking on a new item left, the right screen stays at the same scroll position.
So an user wonders why the content is changing or even don't recognize that, because the scroll position stays the same.
I am thinking of managing some scroll to top after navigating somehow, but didn't figure out yet.
You got it?

from rfcs.

by-theo avatar by-theo commented on May 2, 2024

@donni106 hey, I haven't come across that issue

Can you share some more details?
Are the root views of the details screens ScrollViews?
Or are they wrapped in a normal View?

from rfcs.

donni106 avatar donni106 commented on May 2, 2024

@Theo-Taylor I managed to fix it for my case with a work around.
The right details screen is a ScrollView wrapped inside nested Views.

A simple prototype:

<View>
  <View navigation={navigation} /> // <-- left sidebar
  <View>
    <ScrollView navigation={descriptor.navigation} /> // <-- right details screen
  </View>
</View>

Somehow the real navigation is not done, only contents were changed.
When a user clicked somewhere left while scrolled down right, the right screen scroll position was kept.

I am navigating with:

return navigation.navigate({
  routeName: navigateTo,
  key: `${navigateTo.toLowerCase()}-${item.id}`,
  action: NavigationActions.navigate({
    routeName: navigateToAction,
    params: navigateItem
  });
}}

Now a hard stack reset with navigation is done to properly reset the right screen:

return navigation.navigate({
  routeName: navigateTo,
  key: `${navigateTo.toLowerCase()}-${item.id}`,
  action: StackActions.reset({
    index: 0,
    actions: [
      NavigationActions.navigate({
        routeName: navigateToAction,
        params: navigateItem
      })
    ]
  });
}}

from rfcs.

Related Issues (20)

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.