Javascript React Native Background Color属性工作不正常

Javascript React Native Background Color属性工作不正常,javascript,css,react-native,stylesheet,Javascript,Css,React Native,Stylesheet,在React Native中更改视图的背景色时出现问题,backgroundColor属性在除我的页脚元素之外的其他元素中工作正常 在中,您可以在页脚元素的两个顶部边框中看到白色。如何从那里去除白色 </View> </ScrollView> <View style={styles.footer}> </View> </View> footer:{ flexDirec

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

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

</View>

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

        </View>
</View>

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

页脚:{
flexDirection:“行”,
身高:80,
borderTopLeftRadius:20,
BorderTopRight半径:20,
背景颜色:“黑色”,
}

使用下面的道具将react原生元素中的背景设置为红色

buttonStyle={{backgroundColor: 'red'}}
您应该使用prop buttonStyle在react原生元素中编辑按钮的样式

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

export default class App extends React.Component {

  constructor(props) {
    super(props);
  }

  render() {
    return (
      <View>
        <Button
            title='Login' 
            buttonStyle={{
              backgroundColor:'red'
            }}
            />
      </View>
    );
  }
}
导出默认类App扩展React.Component{
建造师(道具){
超级(道具);
}
render(){
返回(
);
}
}

这是一个工作代码,

用另一个与俯视图组件具有相同背景的视图包装您的页脚

像这样:

<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",
  },
});
返回(
{props.title}
);
};
导出默认CategoryGridTitle;
const styles=StyleSheet.create({
网格项目:{
弹性:1,
差额:15,
身高:150,
边界半径:10,
溢出:“隐藏”,
},
容器:{
弹性:1,
边界半径:10,
阴影颜色:“黑色”,
阴影不透明度:0.26,
阴影偏移:{宽度:0,高度:2},
阴影半径:10,
标高:3,
填充:15,
辩护内容:“柔性端”,
对齐项目:“柔性端”,
背景颜色:“#ff6f00”
},
标题:{
fontFamily:“开放式无边框”,
尺码:18,
textAlign:“对”,
},
});

我不是在询问样式按钮。请查看我在上面添加的快照,供大家参考。不是边框半径吗?页脚元素位于橙色容器上方,因此在页脚元素中指定边框半径后,剩余空间从左上角和右上角应为橙色,但显示为白色。