简体   繁体   中英

credit card style issue

I am trying to change the border color of credit card input, yet it is not working

Here is documentation for creditcardinput. Here is a demo where green custom border color is applied. Here is hosted on codesandbox

  <CreditCardInput
    cardNumberInputProps={{  }}
    cardExpiryInputProps={{  }}
    cardCVCInputProps={{  }}
    style={ { border: '2px solid yellow' } }
 />

You need to use the fieldStyle or containerStyle prop instead of the style prop. Using either seems to produce the same results at least in the codesandbox example you've shared, though there may be differences between the two as your code changes.

From the available props documentation :

 containerStyle | object (optional) | {} | Style for the field container fieldStyle | object (optional) | {} | Style for the field 

Example:

function App() {
  return (
    <div className="App">
      <CreditCardInput
        cardNumberInputProps={{  }}
        cardExpiryInputProps={{  }}
        cardCVCInputProps={{  }}
        fieldStyle={ { border: '2px solid yellow' } }
/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM