Giter Site home page Giter Site logo

Bottom Tab Style about rnn-screens HOT 10 CLOSED

aeq-dev avatar aeq-dev commented on May 24, 2024
Bottom Tab Style

from rnn-screens.

Comments (10)

kanzitelli avatar kanzitelli commented on May 24, 2024

Hi @aeq-dev! Thanks!

So when you generate screens with generateRNNScreens(), you can pass any tab options to the screens. You can check the example here.

Let me know how it goes!

from rnn-screens.

aeq-dev avatar aeq-dev commented on May 24, 2024

Hi @kanzitelli , Thanks for help,
Yes I can set a static badge for any screen, but I want to update the badge (number) of a tab from somewhere in app,
let's say I do a query and get response with count, how could I update a tab by this value ?
Thank you again :)

from rnn-screens.

kanzitelli avatar kanzitelli commented on May 24, 2024

Hey @aeq-dev!

Ah got it! So when you do const screens = generateRNNScreens({...}), screens will have a field N which is the current React Native Navigation instance. Which means you can just do something like screens.N.mergeOptions(componentId, { bottomTabs: { ... } }). Hope this helps :)

from rnn-screens.

aeq-dev avatar aeq-dev commented on May 24, 2024

Thanks a lot for quick reply, and I'm so sorry to bother you because I'm newer in RN ^^'
So I did like this :

screens.N.mergeOptions(props.componentId, { bottomTabs: { 
            backgroundColor:Colors.red20
        } });

it works fine, but this is applied for all tabs, is there a way to update on only one tab ? in my case I have Dashboard, Tickets, Settings. so I want to update Ticket badge number.
my solution is to get the count from store which I update this value each time the user books a ticket :)

from rnn-screens.

aeq-dev avatar aeq-dev commented on May 24, 2024

I got it :)
But I have a small question please :
the componentId is it fixed for each sceen ? otherwise, how could I get the componentID of other screens ?
Let's say I'm on Dashboard screen which its componentId is 'Component1' , how can I get the comopnentID of Tickets screen ?
Thanks

from rnn-screens.

kanzitelli avatar kanzitelli commented on May 24, 2024

@aeq-dev yeah, just wanted to write that you probably want to use bottomTab: {}, not bottomTabs: {} :)

And if I remember correctly, you can not get the component ids of other screens from React Native Navigation API itself (maybe something changed tho), so it makes it impossible for rnn-screens also. Also every pushed screen has a different component id. But the one way to achieve it (how I would do) is to save componentId in useEffect for each tab to the global store and use those values whenever you need them :)

from rnn-screens.

aeq-dev avatar aeq-dev commented on May 24, 2024

mmm I see, so what about the root screens componentID ? are they also not fixed ? and do you have any idea how to get the id by its name or something else ?

Here's the console log at starting app :

BUNDLE  ./index.js 

LOG  Running "Ticket" with {"initialProps":{"componentId":"Component3"},"rootTag":1}
LOG  Running "Dashboard" with {"initialProps":{"componentId":"Component1"},"rootTag":11}
LOG  Running "Search" with {"initialProps":{"componentId":"Component2"},"rootTag":21}
LOG  Running "Main" with {"initialProps":{"componentId":"Component4"},"rootTag":31}

I want a way to get the Ticket componentId :)

Thanks.

from rnn-screens.

kanzitelli avatar kanzitelli commented on May 24, 2024

@aeq-dev yeah that’s what i mean, you can only (from what i know) get that componentId inside the screen in the passed props. And as you know your root screens (tabs), in your case it’s Ticket, then just save that passed props.componentId in useEffect to your stores.ui.ticketTabComponentId and then use that value everywhere you need to change the Ticket’s tab badge. This would be my personal approach.

from rnn-screens.

aeq-dev avatar aeq-dev commented on May 24, 2024

Thanks a lot for your assistance !
I think I got a solution for this, but I need to navigate to screen from tab dashboard to Ticket,
How could I achieve that using this package ? I tried push but doesn't work, I stays in same Tab.
Thanks

from rnn-screens.

kanzitelli avatar kanzitelli commented on May 24, 2024

@aeq-dev you need to push a new screen and have bottom tabs hidden in the options for the new screen. but, i would recommend you to read react-native-navigation docs as this library is just a wrapper around RNN

from rnn-screens.

Related Issues (8)

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.