Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't navigate to new Scene #2840

Closed
schlaegerz opened this issue Jan 30, 2018 · 7 comments
Closed

Can't navigate to new Scene #2840

schlaegerz opened this issue Jan 30, 2018 · 7 comments

Comments

@schlaegerz
Copy link

Version

Tell us which versions you are using:

"react-native-router-flux": "^4.0.0-beta.27",
"react-native": "^0.52.2",

Expected behaviour

Be able to navigate between two scenes with Actions.Loading2()

Actual behaviour

If I add a reducer can see if the reducer is called, but nothing happens

Steps to reproduce

Here is my whole app:


import React, { Component }  from 'react';

import {
  Scene,
  Router,
  Stack,
  Reducer,

} from 'react-native-router-flux';

import {Text} from 'react-native'

import {
    Actions,
    
  } from 'react-native-router-flux';
class Loading extends Component{
    render(){
      return (
        <Text
          onPress={Actions.Loading2}>LOADING</Text>
      );
    }
  }
  
  class Loading2 extends Component{
    render(){
      return (
        <Text
          onPress={Actions.Loading2}>LOADING2</Text>
      );
    }
  }

const reducerCreate = params => {
  const defaultReducer = new Reducer(params);
  return (state, action) => {
    console.warn('ACTION:', action);
    return defaultReducer(state, action);
  };
};



 class App extends Component{
  
  render()
  {
    return (
      <Router
      createReducer={reducerCreate}>
  
      <Stack
          key="root">
          <Scene key="Loading" component={Loading} title="Loading" />
          <Scene key="Loading2" component={Loading2} title="Loading2" />
        
      </Stack>
          
  
    </Router>
    )
  }
}


export default App

I would expect clicking on the text to switch the scene, but nothing ever happens. I have tried every iteration of Actions.Loading, Actions["Loading"], etc that I can think of and nothing seems to work

I have also switched out the Stack with a Scene, with no effect.

I feel like I must be missing something super basic, but I cannot figure this out.

@schlaegerz schlaegerz changed the title Can't switch navigate to new Scene Can't navigate to new Scene Jan 30, 2018
@schlaegerz
Copy link
Author

Really confused by this, I was playing around with my installed packages and then it just started to work, there must be some weird caching that prevented it from working, I had been trying this on and off for months and never got it to work until now.

@Blapi
Copy link
Collaborator

Blapi commented Jan 30, 2018

Have a look at the Example project next time, it will be very helpful in your case !

@Blapi Blapi closed this as completed Jan 30, 2018
@schlaegerz
Copy link
Author

I was basing it off the example. There does appear to be a weird caching thing that prevented it from working. I don't understand why.

@schlaegerz
Copy link
Author

So it was working for me, then after I was messing with packages again and trying to get a production build of my app, it completely stopped working again.

My code didn't change at all, I only updated some unrelated packages.

@Blapi
Copy link
Collaborator

Blapi commented Jan 31, 2018

Be careful with your packages that you clean the cache before reinstalling them, you might have some troubles.
Anyway, what is your situation? The Example project is the true example of what you should follow to use this library, especially to just change scenes..

@schlaegerz
Copy link
Author

Yeah I was using the Example project, the issue is entirely a caching issue which is very weird. It has happened to me multiple times, and is probably happening to other people. What commands would you suggest to clear the cache?

@Blapi
Copy link
Collaborator

Blapi commented Feb 1, 2018

rm -rf node_modules
rm yarn.lock
yarn cache clean
yarn install

If you're on Android : cd android && ./gradlew clean

Then run on your device

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants