How do i use Drawer with Tabs for navigation in react-native-router-flux v4 - react-native

how to combine Tabs and Drawer in react-native-router-flux ?
Already i have my Tabs who work :
<Router>
<Scene hideNavBar key='root'>
<Tabs
inactiveTintColor={'#acacac'}
activeTintColor={'#000'}
activeBackgroundColor={'#eee'}
animationEnabled={false}
swipeEnabled={true}
tabBarPosition='bottom'>
<Scene
tabBarIcon={({ tintColor }) => <Icon name='ios-home' size={25} color={tintColor}/>}
navBar={Header}
key='gray'
component={GrayScreen}
title='Gray' />
<Scene
tabBarIcon={({ tintColor }) => <Icon name='ios-search' size={25} color={tintColor}/>}
navBar={Header}
key='scarlet'
component={ScarletScreen}
title='Scarlet' />
<Scene
tabBarIcon={({ tintColor }) => <Icon name='ios-notifications' size={25} color={tintColor}/>}
navBar={Header}
key='red'
component={RedScreen}
title='Red' />
<Scene
tabBarIcon={({ tintColor }) => <Icon name='ios-mail' size={25} color={tintColor}/>}
navBar={Header}
key='blue'
component={BlueScreen}
title='Blue' />
</Tabs>
</Scene>
</Router>
I've tried so many things to add a but it dosent works ...

this works fine for me
<Router>
<Scene key="root"
drawer={true}
contentComponent={SideMenu}
drawerIcon={dr}
drawerWidth={260}
navigationBarStyle={{backgroundColor:'#16334c'}}
titleStyle={{color:'#fff'}}>
<Scene
key="splash"
component={Splash}
hideNavBar
timeout={2000}
nextScene={'login'}
initial
/>
<Scene
key="workOrder"
component={WorkOrder}
title="Work Orders"
/>
<Scene
key="addwork"
component={AddWork}
title="Create New Work Order"
back={true}
backButtonTintColor="white"
/>
<Scene
key="prementive"
component={Prementive}
title="PMs"
/>
<Scene
key="scanBarcode"
component={ScanBarcode}
title="Scan or Enter Barcode"
/>
<Scene
key="partLocation"
component={PartLocations}
title="Part Locations"
back={true}
backButtonTintColor="white"
/>
<Scene
key="checkAdjustStock"
component={CheckAdjustStock}
title="Check/Adjust Stock"
/>
<Scene
key="meteredPm"
component={MeteredPm}
title="Metered PMs"
/>
<Scene
key="partsForLocation"
component={PartsForLocation}
title="Parts For Locations"
back={true}
backButtonTintColor="white"
/>
<Scene
key="equipmentForLocation"
component={EquipmentForLocation}
title="Equipment For Locations"
/>
<Scene
key="barcodeAssign"
component={BarcodeAssign}
title="Barcode Assign"
/>
<Scene
key="addPartLocations"
component={AddPartLocations}
title="Add Parts Location"
back={true}
backButtonTintColor="white"
/>
<Scene
key="addBarcodeEquipment"
component={AddBarcodeEquipment}
title="Add Barcode to Equipment"
back={true}
backButtonTintColor="white"
/>
<Scene
key="addBarcodeParts"
component={AddBarcodeParts}
title="Add Barcode to Parts"
back={true}
backButtonTintColor="white"
/>
<Scene
key="addPrementive"
component={AddPrementive}
title="Add PM"
back={true}
backButtonTintColor="white"
/>
<Scene
key="addEquipment"
component={AddEquipment}
title="Add Equipment"
back={true}
backButtonTintColor="white"
/>
<Scene
key="addLocation"
component={AddLocation}
title="Add Location"
back={true}
backButtonTintColor="white"
/>
<Scene
key="addParts"
component={AddParts}
title="Add Parts"
back={true}
backButtonTintColor="white"
/>
<Scene
key="equipment"
component={Equipment}
title="Equipment"
/>
<Scene
key="location"
component={Location}
title="Locations"
/>
<Scene
key="parts"
component={Parts}
title="Parts"
/>
<Scene
key="login"
component={Login}
title="Login"
/>
<Scene
key="logout"
component={Logout}
title="Logout"
hideNavBar
/>
<Scene
key="dashboard"
component={Dashboard}
title="Dashboard"
/>
</Scene>
</Router>

Related

How to disable swipe back to login screen in react native using react-native-router-flux

I want to disable the swipe left feature from the home screen to the login screen. Right now I tried using
gestureEnabled = {false}
panHandlers={null}
type={ActionConst.RESET}
type={ActionConst.REPLACE}
drawerLockMode='locked-closed' gesturesEnabled={false}
This is my Router class
<Router>
<Scene key="root" hideNavBar={true}>
<Scene key="auth" >
<Scene key="login" component={LoginXScr} hideNavBar={true} initial/>
<Scene key="forgotPassword" component={FGPassword} hideNavBar={true}/>
</Scene>
<Scene key="main" >
<Scene key="homescr" component={Home} hideNavBar={true} initial/>
<Scene key="explorecr" direction="vertical" component={Explore} hideNavBar={true} />
</Scene>
<Scene key="loading">
<Scene key="loaderloading" component={LoadingXScr} hideNavBar={true} />
</Scene>
<Scene key="paymentconf">
<Scene key="confirmationscr" direction="vertical" component={ConfrmPage} hideNavBar={true} />
</Scene>
<Scene key="setuprec">
<Scene key="setuprescr" direction="vertical" component={RecurringConfPage} hideNavBar={true} />
</Scene>
</Scene>
</Router>
None of them are working for me. Can anyone guide me what should be the correct way to disable the left swipe so that the screen does not swipe back to the login screen. I need to implement both in iOS and Android the same.
<Drawer
type="reset"
key="drawer"
contentComponent={DrawerComponent}
drawerWidth={250}
drawerPosition='left'
hideNavBar={true}
>

Something went wrong page after after pressing on DeleteButton

Everytime I click on a delete button in a List component, the page shows this error page.
The deletion works though.
The error page
export const MaterialList = props => (
<List {...props}>
<Datagrid rowClick="edit">
<NumberField source="REGEL_ID" />
<DateField source="STAND" />
<NumberField source="MaterialID" />
<NumberField source="DruckstufenID" />
<TextField source="Bezeichnung" />
<TextField source="Bezeichnung2" />
<TextField source="pA_Artikel" />
<TextField source="Menge" />
<NumberField source="DefaultHaken" />
<NumberField source="Verdichten" />
<TextField source="pA_Artikel_Original" />
<EditButton />
<DeleteButton />
</Datagrid>
</List>
);
Is there someone who atleast understands the error message?
We noticed this bug a few days ago and it has been fixed in v3.3.3.

hide drawer in a specific screen

hey there i a mworking with a react native project using React router flux for navigation everything is ok except that i want to hide the drawer from signin Screen and tuto screen
here is my code bellow
const RouterRedux = connect()(Router);
<RouterRedux backAndroidHandler={() => {}}>
<Drawer
hideNavBar
open={false}
key="drawer"
contentComponent={SideBar}
drawerWidth={300}
// drawerLockMode={show ? 'locked-closed' : 'unlocked'}>
>
<Scene key="root" hideNavBar transitionConfig={transitionConfig}>
<Scene key="Tuto" component={Tuto} type={ActionConst.RESET} />
<Scene
initial
key="CheckAuth"
component={CheckAuth}
type={ActionConst.RESET}
/>
{/*<Scene key="WIP" component={WorkInProgress} />*/}
<Scene key="SignIn" component={SignIn} />
<Scene key="ResetPassword" component={ResetPassword} />
<Scene key="Visits" component={Visits} />
<Scene key="VisitDetails" component={VisitDetails} />
<Scene key="Statistiques" component={Statistiques} />
<Scene key="Notification" component={Notification} />
<Scene key="Sync" component={Sync} />
</Scene>
</Drawer>
</RouterRedux>
so how can i hide the drawer from signin screen and tuto screen ?
I found the way to lock the drawer, and doing some changes works with your show lock/unlock variable.
You need to separate the group of scenes with drawer locked and the other one (unlocked), something like that...
<RouterRedux backAndroidHandler={() => { }}>
<Drawer
hideNavBar
open={false}
key="drawer"
contentComponent={SideBar}
drawerWidth={300}
// drawerLockMode={show ? 'locked-closed' : 'unlocked'}>
>
<Scene
key="root" hideNavBar
transitionConfig={transitionConfig}
drawerLockMode='locked-closed'
>
<Scene key="Tuto" component={Tuto} type={ActionConst.RESET} />
<Scene
initial
key="CheckAuth"
component={CheckAuth}
type={ActionConst.RESET}
/>
</Scene>
<Scene
key="root2"
hideNavBar
transitionConfig={transitionConfig}
drawerLockMode='unlocked'
>
{/*<Scene key="WIP" component={WorkInProgress} />*/}
<Scene key="SignIn" component={SignIn} />
<Scene key="ResetPassword" component={ResetPassword} />
<Scene key="Visits" component={Visits} />
<Scene key="VisitDetails" component={VisitDetails} />
<Scene key="Statistiques" component={Statistiques} />
<Scene key="Notification" component={Notification} />
<Scene key="Sync" component={Sync} />
</Scene>
</Drawer>
</RouterRedux>

how to hide drawer in react router flux?

hey there i am working with react native project and i am using react router flux for navigation and i use Drawer so how can i disable the drawer in some screens ? like signin screen ?
i tried drawerLockMode={'lock-closed'} but it's not working
here is mycode
<RouterRedux backAndroidHandler={() => {}}>
<Drawer>
<Scene key="root" hideNavBar transitionConfig={transitionConfig}>
<Scene key="Tuto" component={Tuto} type={ActionConst.RESET} />
<Scene
initial
key="CheckAuth"
component={CheckAuth}
type={ActionConst.RESET}
/>
<Scene key="SignIn" component={SignIn} />
<Scene key="ResetPassword" component={ResetPassword} />
<Scene key="Visits" component={Visits} />
<Scene key="VisitDetails" component={VisitDetails} />
<Scene key="Statistiques" component={Statistiques} />
</Scene>
</Drawer>
</RouterRedux>
You need to write the drawerLockMode in the principal scene.. something like that
<RouterRedux backAndroidHandler={() => {}}>
<Drawer>
<Scene
key="root"
hideNavBar
transitionConfig={transitionConfig}
drawerLockMode='locked-closed' //New line
>
<Scene key="Tuto" component={Tuto} type={ActionConst.RESET} />
<Scene
initial
key="CheckAuth"
component={CheckAuth}
type={ActionConst.RESET}
/>
<Scene key="SignIn" component={SignIn} />
<Scene key="ResetPassword" component={ResetPassword} />
<Scene key="Visits" component={Visits} />
<Scene key="VisitDetails" component={VisitDetails} />
<Scene key="Statistiques" component={Statistiques} />
</Scene>
</Drawer>
</RouterRedux>
If you want to lock/unlock in different scenes you need to separate with a parent Scene each group of Scenes that you want to lock/unlock the drawer...
<RouterRedux backAndroidHandler={() => { }}>
<Drawer
hideNavBar
open={false}
key="drawer"
contentComponent={SideBar}
drawerWidth={300}
// drawerLockMode={show ? 'locked-closed' : 'unlocked'}>
>
<Scene
key="root" hideNavBar
transitionConfig={transitionConfig}
drawerLockMode='locked-closed'
>
<Scene key="Tuto" component={Tuto} type={ActionConst.RESET} />
<Scene
initial
key="CheckAuth"
component={CheckAuth}
type={ActionConst.RESET}
/>
</Scene>
<Scene
key="root2"
hideNavBar
transitionConfig={transitionConfig}
drawerLockMode='unlocked'
>
{/*<Scene key="WIP" component={WorkInProgress} />*/}
<Scene key="SignIn" component={SignIn} />
<Scene key="ResetPassword" component={ResetPassword} />
<Scene key="Visits" component={Visits} />
<Scene key="VisitDetails" component={VisitDetails} />
<Scene key="Statistiques" component={Statistiques} />
<Scene key="Notification" component={Notification} />
<Scene key="Sync" component={Sync} />
</Scene>
</Drawer>
</RouterRedux>
I hope I've helped ... :)

Actions.popTo(tabBarKey) breaks app. - React Native Router Flux

In my current app the user fills out a form that is made up of different Scenes and once the last Scene of the form is reached and the submit was successful, I want to "popTo" back to the initial Scene. However, this initial scene is within a <Tabs> tag and I think it is the reason why its breaking my app.
This is my Router.js:
const RouterComponent = () => {
return (
<Router>
<Scene key="root">
<Scene key="spinnerBucket">
<Scene
key="spinner"
component={SpinnerComponent}
initial
hideNavBar
panHandlers={null}
/>
</Scene>
<Scene key="authBucket">
<Scene
key="login"
component={LoginComponent}
initial
hideNavBar
panHandlers={null}
/>
</Scene>
<Tabs
lazy
headerMode="none"
key="tabBar"
navBar={NavigationComponent}
tabBarPosition={'bottom'}
>
<Scene
key="home"
initial
component={HomeComponent}
panHandlers={null}
/>
<Scene
key="profile"
component={ProfileComponent}
panHandlers={null}
/>
<Scene
key="activeJobs"
component={ActiveJobsComponent}
panHandlers={null}
/>
<Scene
key="favorites"
component={FavoritesComponent}
panHandlers={null}
/>
<Scene
key="inbox"
component={InboxComponent}
panHandlers={null}
/>
</Tabs>
<Scene
key="displayOffer"
hideNavBar
component={DisplayOffersComponent}
panHandlers={null}
/>
<Scene
key="selectJob"
hideNavBar
component={SelectJobComponent}
panHandlers={null}
/>
<Scene
key="createJob"
hideNavBar
component={JobScheduleComponent}
panHandlers={null}
/>
<Scene
key="define_title"
hideNavBar
component={DefineTitleComponent}
panHandlers={null}
/>
<Scene
key="requirements"
hideNavBar
component={RequirementsComponent}
panHandlers={null}
/>
<Scene
key="quantity_question"
hideNavBar
component={QuantityQuestionComponent}
panHandlers={null}
/>
<Scene
key="add_comments"
hideNavBar
component={AddCommentsComponent}
panHandlers={null}
/>
<Scene
key="multiple_choice"
hideNavBar
component={MultipleChoiceComponent}
panHandlers={null}
/>
<Scene
key="infoMissing"
hideNavBar
component={InfoMissingComponent}
panHandlers={null}
/>
<Scene
key="user_description"
hideNavBar
component={JobDetailsComponent}
panHandlers={null}
/>
<Scene
key="jobDetailsPhotos"
hideNavBar
component={JobTagsAndPhotosComponent}
panHandlers={null}
/>
<Scene
key="googlePlaces"
hideNavBar
component={GooglePlacesComponent}
panHandlers={null}
/>
<Scene
key="chat"
hideNavBar
component={ChatComponent}
panHandlers={null}
/>
<Scene
key="publicProfile"
hideNavBar
component={PublicProfileComponent}
panHandlers={null}
/>
</Scene>
</Router>
);
};
Now the issue arises when I am in the
<Scene
key="jobDetailsPhotos"
hideNavBar
component={JobTagsAndPhotosComponent}
panHandlers={null}
/>
and I call Actions.popTo("tabBar");. The app just freezes and breaks. My question is: Is the structure of my scenes the fault or is there a special way to popTo a Tab?
My goal is to go back to the <Scene key="home"/>.
You should use only 'leaf' scene keys for popTo.
Actions.popTo works fine, just use it like this:
Actions.popTo("sceneName");
Version:
"react": "16.0.0",
"react-native": "^0.51.0",
"react-native-router-flux": "^4.0.0-beta.28",
You cad add explicitly your scene to the stack by doing Actions.theNameForYourScene in the startup before the main scene, in order to be able to popTo it after. It's not recommended but it works.