Comments (13)
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.
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.
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.
I'm a bit unsure how to use this now...
Do I need to wrap in NavigationContainer
?
from react-native-multibar.
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.
I'm confused about what YourBarComponent
is and what props.navigation
refers to if I'm not using react-navigation
?
from react-native-multibar.
I'm confused about what
YourBarComponent
is and whatprops.navigation
refers to if I'm not usingreact-navigation
?
Provide me an example of your code
from react-native-multibar.
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.
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.
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.
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.
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.
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.
from react-native-multibar.
Related Issues (20)
- Close multi bar options when click outside HOT 3
- hi how do you import multi-bar into a file after 'yarn add react-native-multibar'?
- Usage for React Navigation 5 [Question] HOT 5
- Bug when click in multibar and bottom bar in the same time
- Bug: when navigating using the `MultiBarToggle`, a navigation error is thrown HOT 2
- How do you change the color of MultiBarToggle away from blue?
- "renderIcon is not a function" when upgrading to React Navigation v5 HOT 5
- Cannot read property 'index' of undefined
- typescript
- View beneath Navigation Bar HOT 4
- Animated: `useNativeDriver` was not specified. HOT 3
- Is MultiBarProvider able to set extrasVisible to true or false? HOT 3
- Show Modal on Tab Item Press HOT 3
- How can I make Icon wrapped in MultiBarButton to rotate 45 degree ? HOT 1
- Transform with key of "rotateZ" must be a string in android. HOT 1
- dist is missing in npm package 1.1.5
- this package itself specifies a `main` module field that could not be resolved HOT 1
- Cannot find module 'react-native-multibar' or its corresponding type declarations.ts HOT 2
- setExtrasVisible can't change via context
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-multibar.