1

I'm currently using stylesheet for my style in react-native. I found a css style that I need for my component unfortunately it has an :after and :before in css. How to use :after and :before in stylesheet in react-native. Here's the sample css code that I'm trying to convert into react-native style sheet:

.ticket:before,
.ticket:after {
  content: '';
  display: block;
  position: absolute;
  top: 130px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  z-index: 2;
}

.ticket:before {
  background: white;
  left: -30px;
}

.ticket:after {
  right: -30px;
  background: white;
}
Adrian Alejo
  • 91
  • 10

1 Answers1

0

Css pseudo selectors such as ::after or ::before do not work in react-native, but if you want your styles to look as close to css as possible I would recommend using something like Styled Components. It works on both web and react-native.

Acode
  • 507
  • 5
  • 14