React Native Router Flux with Drawer and Swiper - react-native

I couldn't figure out a way to scroll swiper when a button pressed inside a drawer.
To be exact: One component has a full screen swiper. When user clicks on hamburger button, drawer shows up with an array of swiper datasource items. I would like to navigate to clicked datasource item inside my component. Swiper already has a scrollBy function for this. I just need to know how can I possibly trigger my swiper to scroll x indexes.
I'm using Redux model in my application. I've tried to pass the reference of swiper via reducers but it just seemed wrong.

Related

How do you make swiper buttons show only inside the swiper container

I have coded swiper button and navigation insider the swiper container but the buttons and the bullets are showing in the wrong place(at the top of the page).... I would like them to show inside the swiper container...
I also faced the same issue when I used Swiper.
Try to use this
::ng-deep .swiper-pagination { `bottom: 10px;`}
You can modify it like you want by using some id or class for swiper.
<swiper class="bulletsAtBottom">some code...<swiper>
.bulletsAtbottom {bottom:10px;}

how to add menu in stackNavigator's header button

I want to open a menu on click of option button in header of a StackNavigator
snack link https://snack.expo.io/#abdulbsit/vengeful-macaroni-and-cheese
and here is the visual of screen https://drive.google.com/file/d/1mR3fL7KtF-BTp8OY9jlZlWvn3y_DGNhF/view?usp=sharing
Note: I don't want to use drawerNavigator, i want to make menu like this https://storage.googleapis.com/spec-host/mio-staging%2Fmio-design%2F1563837804615%2Fassets%2F0B8wSqcLwbhFuSGtLYzhXYWpRdk0%2Fbehavior-menu-multiple-position.mp4
you can do the above using making another component of menu using https://www.npmjs.com/package/react-native-material-menu
and import in your stack's Header button directly and to access navigation props in the menu component use withNavigation - https://reactnavigation.org/docs/en/connecting-navigation-prop.html

react-navigation - display 'are you sure' dialog before navigating back

I am building an app in react native with the use of react-navigation. On one screen I need to display a simple dialog to make sure user really wants to exit that screen.
I've tried to add BackHandler listener but that does not apply when the user clicks on the back arrow in the header. Is there any way, how I can prevent transition back before user click on the alert button?
implement "headerLeft" of Screen Navigation Options, like
headerLeft=()=>{
return <Button onPress={}>
}
then you can do anything you want in onPress callback

Passing the navigation object down the nested react component

My react component hierarchy looks like
StackNavigation
- MainScreen
- List
- Row
- Button
My usecase involves go to a new screen on click of the button. My main screen receives react-navigation's navigation props. How do I pass it down to my button in a sane manner.
You'd better pass a callback to your button through all the hierarchy and call it when button is pressed. Afterwards when you know which button is pressed (on which row) you can navigate to necessary screen from your MainScreen.

React Native NavigatorExperimental - Combine AnimatedView with CardStack

i 've a NavigationAnimatedView which rendering a ListView with pushed DetailsView.
In the NavigationHeader, on the rightComponent, i have a button and i want to display a view with NavigationCardStack from bottomToTop. How can i combine the two modes of navigation ?
Like the filters button on the F8 app on the home screen.
i don't understand how with a dispatch action (navigatePush ?) on the FiltersButton, i can't switch with a navigationCardStack to display a FilterViews from BottomToTop.
You can provide props to NavigationCard when you render it:
_renderScene(props) {
return (
<NavigationCard
style={NavigationCardStackStyleInterpolator.forVertical(props)}
...
Sorry that part isn't documented very well right now!