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.

View Doesn't render if it was a out of screen on Android

See original GitHub issue

View doesn’t render if it was a out of screen. It works fine on iOS.


<Animated.View
          style={[styles.wrap, { transform: [{ translateX: left }] }]}
        >
          {newPostExpected && (
            <PostingLoaderBar />
          )}
          <Animated.View
            style={[
              styles.wrap,
              { paddingTop, transform: [{ translateY: listViewTop }] },
              hasNavBar && { paddingTop: 60 },
            ]}
            {...this.listViewResponder.panHandlers}
          >
            <ListView
              ref={ref => this.listView = ref}
              dataSource={posts}
              renderRow={this.renderRow}
              renderSectionHeader={this.renderHeader}
              onEndReachedThreshold={2000}
              pageSize={10}
              onScroll={this.handleScroll}
              onEndReached={this.getPosts}
              enableEmptySections={true}
              scrollEnabled={canScroll}
              onChangeVisibleRows={(visibile, changed) => {
                let lowestKey = null;
                Object.keys(visibile).forEach((key, i) => {
                  if (i === 0) {
                    lowestKey = key;
                  } else if (key < lowestKey) {
                    lowestKey = key;
                  }
                });
                const notVisibleRows = Object.keys(changed).filter(key => !changed[key][0]);
                if (notVisibleRows.length > 0) {
                  notVisibleRows.forEach(row => {
                    this[`feedItem${row}`].getWrappedInstance().resetOverlays();
                  });
                }
                if (this.state.postBlob[lowestKey]) {
                  this.topRowVoting = this.state.postBlob[lowestKey][0].voting;
                }
              }}
              refreshControl={requiresRefresh && !singlePost ? (
                  <RefreshControl
                    refreshing={refreshing && !this.props.refreshing}
                    onRefresh={this.onRefresh}
                  />
                ) : null}
              onMomentumScrollBegin={() => {
                this.hasMomentum = true;
              }}
              onMomentumScrollEnd={() => {
                this.hasMomentum = false;
              }}
            />
          </Animated.View>
          {hasComments && (
            this.renderComments() // on Android it's render's an empty blank
          )}
          {singlePost && <View style={{ height: 60 }} />}
        </Animated.View>

this.renderComments just renders the following:


<CommentContainer
        ref={ref => this.commentRef = ref}
        comments={comments.data}
        commentCount={comments.total}
        routeBack={this.animateBack}
        handleMove={this.handleMove}
        animateForward={this.animateForward}
        activePost={activePost}
        parentId={null}
        routeScene={this.props.routeScene}
        incrementCommentCount={(increment) => this.incrementCommentCount(activePost.id, increment)}
        refreshPost={() => this.refreshPost(activePost.id)}
      />

It works fine on iOS but on Android i’m getting empty blank instead of comments container

ios

Additional information React Native version: 0.35.0 Platform(s) (iOS, Android, or both?): Android 5.1.1 Operating System (macOS, Linux, or Windows?): macOS

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
satya164commented, Nov 7, 2016

@shahen94

You can set container size to 2 * WINDOW_WIDTH

So the issue isn’t that it doesn’t render view out of screen, it’s just that overflow: hidden is default on Android and can’t be changed. So anything which is outside the view bounds (not the screen) will get hidden since the overflow is hidden. I think the issue title is misleading.

0reactions
shahen94commented, Nov 6, 2016

@satya164 man I think you don’t understand issue correctly. I have no time to read what you did in your library. Try to read Android specification and you’ll find it out there.

Try to create empty app. create any view and move it out of the screen. It never will create. there are many solutions.

  1. You can use ViewPagerAndroid
  2. You can use ScrollView
  3. You can set container size to 2 * WINDOW_WIDTH. (if you haven’t dynamic growing list).

If you think that’s a bug, then report it to android. Because all realworld apps faced with this issue, WhatsApp/PicsArt/Momentum and solved it as i said

Read more comments on GitHub >

github_iconTop Results From Across the Web

My WebView does not render an HTML page if the screen is ...
WebView successfully renders html page even if the screen is off on android version pre 8.0/8.1 But it doesn't on Android 8.1. I...
Read more >
Slow rendering - Android Developers
If your app suffers from slow UI rendering, then the system is forced to skip frames and the user will perceive stuttering in...
Read more >
Android Player settings - Unity - Manual
Render outside safe area, Indicates whether the application should use all available screen space to render, including areas of the display that are...
Read more >
Stack Navigator | React Navigation
If you set it to false , the screen won't animate when pushing or popping. Defaults to true on iOS and Android, false...
Read more >
Common Flutter errors
The error is often caused when a ListView (or other kinds of scrollable widgets such as GridView ) is placed inside a Column...
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