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

如何去掉边框?border 总有一点灰色的小边框 #71

Closed
1c7 opened this issue Jan 22, 2018 · 5 comments
Closed

如何去掉边框?border 总有一点灰色的小边框 #71

1c7 opened this issue Jan 22, 2018 · 5 comments

Comments

@1c7
Copy link

1c7 commented Jan 22, 2018

问题的截图(元素之间有一条浅色灰线):

screenshot_20180122-193243

代码:

import React, { Component } from 'react';
import { View, StyleSheet, Text } from 'react-native';
import { LargeList } from "react-native-largelist";

export default class LogsScreen extends React.Component {
  constructor(props) {
    super(props);
    this.haha = [{ key: 1, title: 'nice' }, { key: 2, title: 'hello' }, { key: 3, title: 'world' }]
  }
  render() {
    return (
      <View style={{flex: 1, backgroundColor:'#fff'}}>
        <LargeList
          style={{ flex: 1}}
          bounces={true}
          safeMargin={600}
          numberOfRowsInSection={section => 3}
          heightForCell={(section, row) => row % 2 ? 100 : 100}
          renderCell={this.renderItem.bind(this)}
          heightForSection={section => section % 2 ? 0 : 0}
        />
      </View>
    );
  }
  renderItem(section, row) {
    let food = this.haha[row];
    return (<View style={{flex: 1}}>
      <Text>{food.title}</Text>
    </View>)
  }

}
@1c7
Copy link
Author

1c7 commented Jan 22, 2018

react-native info

image

@1c7
Copy link
Author

1c7 commented Jan 22, 2018

图片中可以看到,item 之间有一条浅色的灰色线条,请问如何去除?谢谢

在用 React Native 0.52,react-native run-android 跑在安卓真机上(三星 Galaxy Note 5)

borderWidth:0 elevation:0 都不行

(以下代码无法去除灰色区隔线

  renderItem(section, row) {
    let food = this.haha[row];
    return (<View style={{flex: 1, elevation:0, borderWidth:0}}>
      <Text>{food.title}</Text>
    </View>)
  }

@bolan9999
Copy link
Owner

那是Item分隔器renderItemSeparator,看文档,不需要的话就设置成()=>null

@1c7
Copy link
Author

1c7 commented Jan 22, 2018

管用,感谢~

screenshot_20180122-194855

@1c7 1c7 closed this as completed Jan 22, 2018
@1c7
Copy link
Author

1c7 commented Jan 22, 2018

renderItemSeparator={()=>null}

        <LargeList
          style={{ flex: 1}}
          bounces={true}
          safeMargin={600}
          numberOfRowsInSection={section => 3}
          heightForCell={(section, row) => row % 2 ? 100 : 100}
          renderCell={this.renderItem.bind(this)}
          heightForSection={section => section % 2 ? 0 : 0}
          renderItemSeparator={()=>null}
        />

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