Priya
Priya

Reputation: 1470

React Native: react-native-router-flux type Property issue

I am using react-native-router-flux react native library for navigation but type Property not working

<Route name="error" component={Error} title="Error"  type="reset"/>

it give error like

_this2[type] is not a function.

react-native-router-flux version 4.0.0-beta.28

Upvotes: 1

Views: 1437

Answers (2)

Saloni Parikh
Saloni Parikh

Reputation: 154

you can pass js files as

<Router hideNavBar={true}>
            <Stack key="root" hideNavBar={true}>
                <Scene key="splashscreen" component={SplashScreen} title="SplashScreen" initial={true}></Scene>

            </Stack>
        </Router>

and whichever page you want to go you can pass Actions.splashscreen() (need to pass key written in scene)

Upvotes: 0

Sagar Chavada
Sagar Chavada

Reputation: 5269

The thing is type should use in <Scene> not in <Route>

here the working example

import { Router, Scene, Actions } from 'react-native-router-flux';
<Router>
      <Scene key="root">
        <Scene key="login" component={LoginForm} hideNavBar={'true'} initial={true} />
        <Scene key="signin" component={SigninForm} />
        <Scene
          type="reset"
          key="dashboard"
          component={NavigationView}
          initial={props.isLogin}
          hideNavBar={'true'}
        />
      </Scene>
    </Router>

well there is other way: remove type from scene and use it as a param when moving to other screen.

Actions.error({ type:'reset' });
or
Actions.reset('KEY'); // this one is work, i just tested now. 

or you can replace see this https://github.com/aksonov/react-native-router-flux/issues/467

Upvotes: 1

Related Questions