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

Inactive tab will not update #2434

Closed
wayne1203 opened this issue Sep 26, 2017 · 6 comments
Closed

Inactive tab will not update #2434

wayne1203 opened this issue Sep 26, 2017 · 6 comments

Comments

@wayne1203
Copy link

wayne1203 commented Sep 26, 2017

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.21
  • react-native v0.48.3

Expected behaviour

Tab will be show normally

Actual behaviour

Tab got blank

Steps to reproduce

Load data when tab inactive

I recorded an GIF to explain the issue
video-to-gif

@wayne1203 wayne1203 changed the title Inactive tab will blank if updated Inactive tab will not update Sep 26, 2017
@windwang
Copy link

see #2225

@wayne1203
Copy link
Author

Thanks for reply, I have tried "lazy" before.
I think it's not fully work.
In my situation, "Tab 1" is loading some data and in the same time I go to "Tab 3". "Tab 3" show normally now. But I back to "Tab 1", will see blank page

@wayne1203
Copy link
Author

I made a workaround for this issue,
just scroll by program when tab force

const reducerCreate = params => {
  const defaultReducer = new Reducer(params);
  return (state, action) => {
    //console.log("ACTION:", action);

    // Special handle for iOS tab blank bug
    if (action.type == "REACT_NATIVE_ROUTER_FLUX_FOCUS" && Platform.OS === "ios") {
      if (action.routeName == "chat" || action.routeName == "mainPostList" ) {
        if (typeof Utils.a_listView[action.routeName] != "undefined") {

          const scrollPosition = Utils.a_listView[action.routeName].scrollProperties.offset;
          Utils.a_listView[action.routeName].scrollTo({y: scrollPosition+0.5});
          Utils.a_listView[action.routeName].scrollTo({y: scrollPosition-0.5});
        }
      }
    }
    return defaultReducer(state, action);
  };
}; 

@SuperBesse
Copy link

Maybe the problem comes from listview, not from router : https://stackoverflow.com/questions/44022857/listview-not-displayed-unless-i-scroll-on-it

@onrige
Copy link
Collaborator

onrige commented Oct 25, 2017

It's definitely the problem of ListView. At least it was so in my case. Try to add removeClippedSubviews={false}

@wayne1203
Copy link
Author

I found this solution too and I trued before it will slow when too much items.

@aksonov aksonov closed this as completed Jan 5, 2018
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

5 participants