虚线边框样式在react本地纸张按钮中不起作用

9w11ddsr  于 6个月前  发布在  React
关注(0)|答案(1)|浏览(62)

我试图为文档选取器容器创建一个按钮,我希望按钮的属性为dashed border。但是,我遇到了一个问题,纸张按钮的属性似乎偏离了边框cutting。我该怎么办?

<Text>Select Document:</Text>
   <Button
        mode="text"
        icon={"plus"}
        onPress={pickDocument}
        contentStyle={{
          height: 50,
          borderWidth: 1, 
          borderStyle: "dashed",
          borderColor:'#060d60'
        }}
    >
        Select Document{" "} 
  </Button>

字符串
这就是我的代码的样子

taor4pac

taor4pac1#

增加borderRadius:50与高度值相同

示例:

import {View, Text} from 'react-native';
import {Button} from 'react-native-paper';
const ButtonView = () => {
  const buttonHeight = 50
  return (
    <View style={{flex:1,justifyContent:'center',alignContent:'center',width:'90%',alignSelf:'center'}}>
    <Text>Select Document:</Text>
    <Button
      mode="text"
      icon={"plus"}
      onPress={()=>{}}
      contentStyle={{
        height: buttonHeight,
        borderWidth: 1,
        borderRadius: buttonHeight,
        borderStyle: "dashed",
        borderColor:'#060d60'
      }}>
      Select Document{" "}
    </Button>
    </View>
  );
};
export default ButtonView;

字符串

相关问题