0

how to style in react-native css like this? border-width: 5px 5px 5px 5px

I've tried: borderWidth:{5,5,5,5} and borderWidth:'5px 5px 5px 5px' but no luck

2 Answers 2

1

Try:

borderBottomWidth:5 borderTopWidth:5

etc.

Sign up to request clarification or add additional context in comments.

2 Comments

darns thanks. so this question was actually hoping to answer a bigger one. Im trying to use styling like transform: translate(x,y) how would one do that?
Check out the react native docs here: link. transform([{ skewX: '45deg' }]);
1

In react-native you cannot use border-width: 5px 5px 5px 5px. Instead of that you have to use following properties.

 1. borderTopWidth, 
 2. borderBottomWidth,  
 3. borderLeftWidth
 4. borderRightWidth

But if you want implement some thing like borderWidth then you can write your own function.

function borderWidth(top,right,bottom,left){
  let styles;
  styles['borderTopWidth'] = top
  styles['borderRightWidth'] = right
  return styles
}

then in Stylesheet you can use it

container : {
    ...borderWidth(5,5,5,5)
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.