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

[Android] overflow visible not working on SectionList #14416

Closed
lsps9150414 opened this issue Jun 9, 2017 · 6 comments
Closed

[Android] overflow visible not working on SectionList #14416

lsps9150414 opened this issue Jun 9, 2017 · 6 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@lsps9150414
Copy link

lsps9150414 commented Jun 9, 2017

Description

  • The View container is given overflow: visible
  • The vertical list (SectionList) is given a padding and overflow: visible
  • The horizontal sub list (FlatList) is given a negative marginHorizontal so the items won't be chopped by the padding when scrolled.

Rendered as expected on iOS:

asset

On Android the sub list is still chopped:

screenshot_20170609-165306

Code:

import PropTypes from 'prop-types';
import React, {
  Component,
} from 'react';
import {
  FlatList,
  SectionList,
  StyleSheet,
  View,
} from 'react-native';
import { Subtitle } from 'react-native-ui-toolbox';

import ChatAvatar from '../ChatAvatar';
import ChatListItem from '../ChatListItem';
import {
  SCENE_PADDING,
  globalLayout,
} from '../../styles';

const styles = StyleSheet.create({
  showOverflow: {
    overflow: 'visible',
  },
  horizontalList: {
    marginHorizontal: -SCENE_PADDING,
  },
  sectionTitle: {
    marginBottom: 10,
    color: '#888',
  },
});

const propTypes = {
  navigation: PropTypes.object.isRequired,
};

const defaultProps = {};

export default class Connection extends Component {
  handleSearch = () => {}

  keyExtractor = data => (data.key)

  subListKeyExtractor = data => (data.key)

  renderSectionHeader = ({ section }) => (
    <Subtitle style={[styles.sectionTitle]}>{section.title}</Subtitle>
  )

  renderHorizontalList = data => (
    <FlatList
      style={[globalLayout.sectionContainer, styles.horizontalList, { backgroundColor: 'red' }]}
      data={data.item}
      renderItem={this.renderCatAvatar}
      keyExtractor={this.subListKeyExtractor}
      horizontal
    />
  )

  renderCatAvatar = data => (
    <ChatAvatar {...data.item} />
  )

  renderChats = data => (
    <ChatListItem {...data.item} />
  )

  render() {
    const newConnections = [
      { key: '1', name: 'User 1', role: 'Role' },
      { key: '2', name: 'User 2', role: 'Role' },
      { key: '3', name: 'User 3', role: 'Role' },
    ];
    const actives = [
      { key: '1', name: 'Philip Chen', role: 'Full Stack Developer' },
      { key: '2', name: 'User 2', role: 'Role' },
      { key: '3', name: 'User 3', role: 'Role' },
      { key: '4', name: 'User 4', role: 'Role' },
      { key: '5', name: 'User 5', role: 'Role' },
    ];
    const chats = [
      { key: '1', name: 'Philip Chen', role: 'Full Stack Developer' },
      { key: '2', name: 'User 2', role: 'Role' },
      { key: '3', name: 'User 3', role: 'Role' },
      { key: '4', name: 'User 4', role: 'Role' },
      { key: '5', name: 'User 5', role: 'Role' },
    ];

    const newConnectionSectionData = {
      key: 'new-connection',
      title: 'New Connections',
      data: [newConnections],
      renderItem: this.renderHorizontalList,
    };

    const activeTraceSectionData = {
      key: 'active-trace',
      title: 'With Active Trace',
      data: [actives],
      renderItem: this.renderHorizontalList,
    };

    const chatSectionData = {
      key: 'chat',
      title: 'Chats',
      data: chats,
      renderItem: this.renderChats,
    };

    return (
      <View
        style={[
          globalLayout.sceneContainer,  // flex: 1
          styles.showOverflow,
        ]}
      >
        <SectionList
          style={[
            globalLayout.sceneContentContainer,  // padding: 10
            styles.showOverflow,
          ]}
          renderSectionHeader={this.renderSectionHeader}
          sections={[
            newConnectionSectionData,
            activeTraceSectionData,
            chatSectionData,
          ]}
          keyExtractor={this.keyExtractor}
          stickySectionHeadersEnabled={false}
        />
      </View>
    );
  }

}

Connection.propTypes = propTypes;
Connection.defaultProps = defaultProps;

Env Info:

"expo": "^17.0.0",
"react": "16.0.0-alpha.6",
"react-native": "https://github.com/expo/react-native/archive/sdk-17.0.0.tar.gz",

@michals
Copy link

michals commented Jul 10, 2017

seems to be caused by #6802 that was closed without a fix :-/

@RichardLindhout
Copy link

RichardLindhout commented Sep 5, 2017

Give your flatlist a padding header and footer. Overflow:visible does not work at the moment. It's hard to implement but should be fixed in the future with the new layout engine on Android.

@pull-bot
Copy link

@facebook-github-bot no-template

1 similar comment
@pull-bot
Copy link

@facebook-github-bot no-template

@facebook-github-bot
Copy link
Contributor

Hey, thanks for reporting this issue! It looks like your description is missing some necessary information, or the list of reproduction steps is not complete. Can you please add all the details specified in the Issue Template? This is necessary for people to be able to understand and reproduce the issue being reported. I am going to close this, but feel free to open a new issue with the additional information provided. Thanks! See "What to Expect from Maintainers" to learn more.

@facebook-github-bot facebook-github-bot added the Ran Commands One of our bots successfully processed a command. label Oct 10, 2017
@facebook-github-bot
Copy link
Contributor

Hey, thanks for reporting this issue! It looks like your description is missing some necessary information, or the list of reproduction steps is not complete. Can you please add all the details specified in the Issue Template? This is necessary for people to be able to understand and reproduce the issue being reported. I am going to close this, but feel free to open a new issue with the additional information provided. Thanks! See "What to Expect from Maintainers" to learn more.

@facebook-github-bot facebook-github-bot added Needs more information Ran Commands One of our bots successfully processed a command. labels Oct 10, 2017
facebook-github-bot pushed a commit that referenced this issue Sep 24, 2018
Summary:
ScrollView always clipping children on Android even when `overflow: visible` was specified.
This change just omits the clipping during draw if `overflow: visible` is passed in.
The default is not changed (from hidden to visible) in case there is a performance impact.
Android now matches iOS in behavior. This helps with issue #21116 and resolves #14416.

Reviewed By: shergin

Differential Revision: D9952096

fbshipit-source-id: 367afe33ee7ff0fdc5aa1074d239883aa289888a
grabbou pushed a commit that referenced this issue Oct 2, 2018
Summary:
ScrollView always clipping children on Android even when `overflow: visible` was specified.
This change just omits the clipping during draw if `overflow: visible` is passed in.
The default is not changed (from hidden to visible) in case there is a performance impact.
Android now matches iOS in behavior. This helps with issue #21116 and resolves #14416.

Reviewed By: shergin

Differential Revision: D9952096

fbshipit-source-id: 367afe33ee7ff0fdc5aa1074d239883aa289888a
@facebook facebook locked as resolved and limited conversation to collaborators Oct 10, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 10, 2018
20051231 pushed a commit to 20051231/react-native that referenced this issue Nov 13, 2018
Summary:
ScrollView always clipping children on Android even when `overflow: visible` was specified.
This change just omits the clipping during draw if `overflow: visible` is passed in.
The default is not changed (from hidden to visible) in case there is a performance impact.
Android now matches iOS in behavior. This helps with issue facebook#21116 and resolves facebook#14416.

Reviewed By: shergin

Differential Revision: D9952096

fbshipit-source-id: 367afe33ee7ff0fdc5aa1074d239883aa289888a
t-nanava pushed a commit to microsoft/react-native-macos that referenced this issue Jun 17, 2019
Summary:
ScrollView always clipping children on Android even when `overflow: visible` was specified.
This change just omits the clipping during draw if `overflow: visible` is passed in.
The default is not changed (from hidden to visible) in case there is a performance impact.
Android now matches iOS in behavior. This helps with issue facebook#21116 and resolves facebook#14416.

Reviewed By: shergin

Differential Revision: D9952096

fbshipit-source-id: 367afe33ee7ff0fdc5aa1074d239883aa289888a
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants