javascript - React Native Background Color 属性无法正常工作

标签 javascript css react-native stylesheet

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

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

</View>

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

        </View>
</View>

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

最佳答案

您可以使用

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",
  },
});

enter image description here

关于javascript - React Native Background Color 属性无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57603357/

相关文章:

javascript - 当两行与另一列的总和相同时返回数组中的单行

html - Visual Studio 尝试将 HTML 页面转换为 ASP.NET

android - React Native on Android : Cannot run program "node": error=2, 没有这样的文件或目录

reactjs - 操作必须是 redux 中的普通对象

javascript - 我怎么知道 indexedDB 请求循环是否已经结束?

javascript - 使 if else 语句的结果超出 Javascript 的范围

javascript - 在 Webkit/Chrome 中检测 HTML5 数字控件更改的事件?

css - 使用 Angular UI Bootstrap 时如何防止文本溢出

PHP 简单表单验证

react-native - getExpoPushTokenAsync 不适用于独立应用程序