question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Actions.refresh issue .. not updating scene.

See original GitHub issue

Hi, I am attempting to update my scene to add renderRightButton via Actions.refresh however I cannot seem to get it to work.

"react-native-router-flux": "4.0.6"

Even if I try this:

componentDidMount = () => {
    Actions.refresh({rightTitle: 'TEST'});
}

I cannot even change the Title of the scene, let alone renderRightButton.

I have tried:

componentDidMount = () => {
    Actions.refresh({renderRightButton: this.renderRightButton()});
  }

and

renderRightButton = (props) => {
    return (
      <TouchableOpacity
        style={{ paddingRight: 10, paddingLeft: 20 }}
        onPress={() => Actions.refs.home.wrappedInstance.getNextGames()}>
        <Ionicons name="ios-arrow-forward" size={25} {...DefaultProps.icons} />
      </TouchableOpacity>
    );
  }

The only way I can make it work is if I declare it with the static function…

static renderRightButton = (props) => {
    return (
      <TouchableOpacity
        style={{ paddingRight: 10, paddingLeft: 20 }}
        onPress={() => Actions.refs.home.wrappedInstance.getNextGames()}>
        <Ionicons name="ios-arrow-forward" size={25} {...DefaultProps.icons} />
      </TouchableOpacity>
    );
  }

However using the static function make its more difficult to control the functionality (I need to disable the button if there are no next games etc…

My navigation is set up as follows:

<Stack hideNavBar>
    <Tabs
      key="tabbar"
      swipeEnabled
      type="replace"
      showLabel={true}
      {...DefaultProps.tabProps} >

      <Stack
        key="gameday"
        icon={() => <SimpleLineIcons name="rocket" size={20} {...DefaultProps.icons} />}
        {...DefaultProps.navbarProps}>
        <Scene
          key="home"
          component={GameDayContainer}
          initial
          />
      </Stack>

The “home” scene is the one I am trying to refresh.

Any help would be much appreciated.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
adelowocommented, Nov 25, 2018

I have downgraded to 4.0.0-beta.31. Actions.refresh works with that version though.

I will most likely be migrating to react-native-nagivation later on in the week.

6reactions
eduardo-schorkcommented, Feb 20, 2019

You have to wrap refresh with setTimeout if you use it from componentDidMount

this solution doesn’t work for me

so, this is my solution to render my right button:

class Companies extends Component {

    componentDidMount(){
        this.props.navigation.setParams({
          right: () => (
              <MaterialIcons
                name={'mail'}
                size={48}
                color={'black'} />
          )
        })
     } 

    render(){
      ...
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native router-flux reload the current scene
Simply use this: Actions.refresh({key: Math.random()});.
Read more >
How to refresh screen of reactive app? - OutSystems
In reactive web you do not need to refresh the screen because as soon as variables/aggregates are updated the screen refresh to show...
Read more >
KASA app scenes broken after update : r/TPLinkKasa - Reddit
I tried creating a new scene but that doesn't work either. Is this a known bug that needs fixing? What can I do?...
Read more >
How to use the react-native-router-flux.Actions.refresh function ...
sorted("timestamp", true); // When the list of projects change, React won't know about it because the Result object itself did not change. projects.addListener( ......
Read more >
Prevent automatic opening of scene for users after new update
It doesn't appear that this indicates to the user there is a newer version of the model for them to reload however? So...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found