GithubHelp home page GithubHelp logo

Comments (13)

shamoons avatar shamoons commented on May 28, 2024 1

Wow - that was amazingly fast. Thank you so much, I'll be able to try later today and will report on what I find =)

from react-native-multibar.

alex-melnyk avatar alex-melnyk commented on May 28, 2024

I’m using next.js and don’t want to take over Navigation. I like how next does it, but with the default react-native tab bars, it requires a tense scene and handles navigation. Can I somehow use just three tab bar and manually maintain / set routing?

That's an interesting case, I've updated library to [email protected] that you can probably use a few members of it:

  • MultiBarProvider (provides state)
  • MultiBarOverlay (overlay with extras icons)

Just take a look at the new example in the readme file.

from react-native-multibar.

alex-melnyk avatar alex-melnyk commented on May 28, 2024

Wow - that was amazingly fast. Thank you so much, I'll be able to try later today and will report on what I find =)

I rethought the library structure according to your comment and it allows me to exclude the "react-navigation" module as a dependency at all.

from react-native-multibar.

shamoons avatar shamoons commented on May 28, 2024

I'm a bit unsure how to use this now...

Do I need to wrap in NavigationContainer?

from react-native-multibar.

alex-melnyk avatar alex-melnyk commented on May 28, 2024

I'm a bit unsure how to use this now...

Do I need to wrap in NavigationContainer?

As you wish, the main idea is to put all things inside MultiBarProvider that is provide state for extras icons, so need to build something like that:

<View>
  <MultiBarProvider data={[/*ITEMS*/]}>
    <BottomTabBarWrapper navigation={props.navigation}>
      <YourBarComponent />
    </BottomTabBarWrapper>
  </MultiBarProvider>
</View>

But also you can easily just use MultiBarOverlay wherever you want, but don't forget to wrap it with MultiBarProvider, keep in mind that MultiBarButton contains logics that manage extras state (visible/hidden), if you don't want to use it then make your own button and use MultiBarContext to manage state.

from react-native-multibar.

shamoons avatar shamoons commented on May 28, 2024

I'm confused about what YourBarComponent is and what props.navigation refers to if I'm not using react-navigation?

from react-native-multibar.

alex-melnyk avatar alex-melnyk commented on May 28, 2024

I'm confused about what YourBarComponent is and what props.navigation refers to if I'm not using react-navigation?

Provide me an example of your code

from react-native-multibar.

shamoons avatar shamoons commented on May 28, 2024

I’m on my phone so I apologize for poor formatting:

import App from 'next/app';
import React from 'react';
import { View, ScrollView, Dimensions } from 'react-native';
import { Provider as PaperProvider } from 'react-native-paper';

import { customTheme as theme } from '../config/theme'
import FooterBar from '../components/FooterBar'
import '../config/aws'

function MyApp({ Component, pageProps }) {
    const dim = Dimensions.get('screen')

    return (
        <PaperProvider theme={theme}>
            <View style={{ flex: 1, height: dim.height || 1 }}>
                <ScrollView style={{ flex: 10 }}>
                    <Component {...pageProps} />
                </ScrollView>
                <FooterBar />
            </View>
        </PaperProvider>
    )
}

export default MyApp

And

export default function FooterBar(props) {
    const [showAuthModal, setShowAuthModal] = useGlobalState('showAuthModal')
    const routes = [{
        key: 'home',
        title: 'Home',
        icon: 'home'
    }, {
        key: 'explore',
        title: 'Explore',
        icon: 'home'
    }]


    return (
        <StyledSurface>
            <Link href={`/`}><Button mode="contained">Home</Button></Link>
            <Link href={`/conversations`}><Button mode="contained">Explore</Button></Link>
            <Button mode="contained" onPress={() => setShowAuthModal(true)}>Auth</Button>
            <AuthDialog />
        </StyledSurface>

    );
}

Obviously FooterBar is simply a placeholder for now. I’m unsure where / how to use the multi bar.

from react-native-multibar.

alex-melnyk avatar alex-melnyk commented on May 28, 2024

So, if your tab bar is FooterBar, then you need to put it inside the wrapper BottomTabBarWrapper, navigation - it's an object which will be passed to each extras item on the press event if you like you can remove it.

function MyApp({ Component, pageProps }) {
  const dim = Dimensions.get('screen');

  return (
    <PaperProvider theme={theme}>
      <MultiBarProvider data={[/*ITEMS*/]}>
        <View style={{ flex: 1, height: dim.height || 1 }}>
          <ScrollView style={{ flex: 10 }}>
            <Component {...pageProps} />
          </ScrollView>
          <BottomTabBarWrapper navigation={props.navigation}>
            <FooterBar />
          </BottomTabBarWrapper>
        </View>
      </MultiBarProvider>
    </PaperProvider>
  );
}

from react-native-multibar.

shamoons avatar shamoons commented on May 28, 2024

Got it! So ITEMS is my buttons / icons? How do I get access to the so I can manage my own navigation / routing?

And thank you again for such a wonderful library!

from react-native-multibar.

alex-melnyk avatar alex-melnyk commented on May 28, 2024

Got it! So ITEMS is my buttons / icons? How do I get access to the so I can manage my own navigation / routing?

And thank you again for such a wonderful library!

navigation - it's an object that you provide in
<BottomTabBarWrapper navigation {props.navigation}>

(navigation) => COMPONENT

function MyApp({ Component, pageProps }) {
  const dim = Dimensions.get('screen');

  return (
    <PaperProvider theme={theme}>
      <MultiBarProvider data={[(navigation) => (
        <Icon />
      )]}>
        <View style={{ flex: 1, height: dim.height || 1 }}>
          <ScrollView style={{ flex: 10 }}>
            <Component {...pageProps} />
          </ScrollView>
          <BottomTabBarWrapper navigation={props.navigation}>
            <FooterBar />
          </BottomTabBarWrapper>
        </View>
      </MultiBarProvider>
    </PaperProvider>
  );
}

from react-native-multibar.

shamoons avatar shamoons commented on May 28, 2024

I have:

        <PaperProvider theme={theme}>
            <MultiBarProvider data={[(navigation) => (
                <AntDesign name='add' />
            )]}>
                <View style={{ flex: 1, height: 'auto', maxHeight: dim.height }}>
                    <View style={{ flex: 10, marginBottom: 50 }}>
                        <Component {...pageProps} key={router.route} />
                    </View>
                </View>
            </MultiBarProvider>
        </PaperProvider>

without the BottomTabBarWrapper for now and I get:

TypeError: Cannot read property 'createElement' of undefined
    at Object../node_modules/react-native-multibar/dist/components/BottomTabBarWrapper/index.js (/Users/shamoon/Sites/talkabout/talkabout-fe/.next/server/static/development/pages/_app.js:4836:19)
    at __webpack_require__ (/Users/shamoon/Sites/talkabout/talkabout-fe/.next/server/static/development/pages/_app.js:23:31)
    at Object../node_modules/react-native-multibar/dist/components/index.js (/Users/shamoon/Sites/talkabout/talkabout-fe/.next/server/static/development/pages/_app.js:5189:10)

from react-native-multibar.

alex-melnyk avatar alex-melnyk commented on May 28, 2024

I have:


        <PaperProvider theme={theme}>

            <MultiBarProvider data={[(navigation) => (

                <AntDesign name='add' />

            )]}>

                <View style={{ flex: 1, height: 'auto', maxHeight: dim.height }}>

                    <View style={{ flex: 10, marginBottom: 50 }}>

                        <Component {...pageProps} key={router.route} />

                    </View>

                </View>

            </MultiBarProvider>

        </PaperProvider>

without the BottomTabBarWrapper for now and I get:


TypeError: Cannot read property 'createElement' of undefined

    at Object../node_modules/react-native-multibar/dist/components/BottomTabBarWrapper/index.js (/Users/shamoon/Sites/talkabout/talkabout-fe/.next/server/static/development/pages/_app.js:4836:19)

    at __webpack_require__ (/Users/shamoon/Sites/talkabout/talkabout-fe/.next/server/static/development/pages/_app.js:23:31)

    at Object../node_modules/react-native-multibar/dist/components/index.js (/Users/shamoon/Sites/talkabout/talkabout-fe/.next/server/static/development/pages/_app.js:5189:10)

Could you create a snack, that I can help you better.

https://snack.expo.io

from react-native-multibar.

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.