React Native 背景颜色 属性 无法正常工作

React Native Background Color property is not working properly

我在 React Native 中更改视图的背景颜色时遇到问题,backgroundColor 属性 在除我的页脚元素之外的其他元素中工作正常。

Image Snapshot 中,您可以在页脚元素的两个顶部边框中看到白色。如何去除那里的白色

</View>

        </ScrollView>
        <View style={styles.footer}>

        </View>
</View>

footer:{
        flexDirection:"row",
        height:80,
        borderTopLeftRadius:20,
        borderTopRightRadius:20,
        backgroundColor:"black",
}

使用下面的道具使react-native-elements中的背景变红

buttonStyle={{backgroundColor: 'red'}}

您应该使用 buttonStyle 属性在 react-native-elements 中编辑按钮的样式。

这是工作代码。这里的按钮是红色的。

export default class App extends React.Component {

  constructor(props) {
    super(props);
  }

  render() {
    return (
      <View>
        <Button
            title='Login' 
            buttonStyle={{
              backgroundColor:'red'
            }}
            />
      </View>
    );
  }
}

这是一个工作代码,https://snack.expo.io/BkRgH0_HE

用另一个与顶部视图组件具有相同背景的视图包裹页脚。

像这样:

<View style={{backgroundColor: "orange"}}>
  <View style={styles.footer}>
  ...
  </View>
</View>

可以使用

return (
    <View style={styles.gridItem}>
      <TouchableOpacity style={{ flex: 1 }} onPress={props.onSelect}>
        <View style={styles.container} >
          <Text style={styles.title} numberOfLines={2}>
            {props.title}
          </Text>
        </View>
      </TouchableOpacity>
    </View>
  );
};

export default CategoryGridTitle;

const styles = StyleSheet.create({
  gridItem: {
    flex: 1,
    margin: 15,
    height: 150,
    borderRadius: 10,
    overflow: "hidden",
  },
  container: {
    flex: 1,
    borderRadius: 10,
    shadowColor: "black",
    shadowOpacity: 0.26,
    shadowOffset: { width: 0, height: 2 },
    shadowRadius: 10,
    elevation: 3,
    padding: 15,
    justifyContent: "flex-end",
    alignItems: "flex-end",
    backgroundColor: '#ff6f00'
  },
  title: {
    fontFamily: "open-sans-bold",
    fontSize: 18,
    textAlign: "right",
  },
});