Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

518
Views
Cambiar el color de un componente SVG en React Native

Tengo un componente SVG que es como el siguiente:

 <Svg width={svgSize} height={svgSize}> <Defs> <LinearGradient x1="0%" y1="100%" x2="100%" y2="0%" id="gradient"> { linearGradient.map((item, index) => ( <Stop key={index} offset={item.stop} stopColor={item.color} /> )) } </LinearGradient> </Defs> <Path strokeWidth={strokeWidth} stroke={backgroundTrackColor} fill="none" strokeLinecap="round" d={`M${startPoint.x},${startPoint.y} A ${radius},${radius},0,${startRadian - openingRadian >= Math.PI ? '1' : '0'},1,${endPoint.x},${endPoint.y}`} /> <Path strokeWidth={strokeWidth} stroke="url(#gradient)" fill="none" strokeLinecap="round" d={`M${startPoint.x},${startPoint.y} A ${radius},${radius},0,${startRadian - currentRadian >= Math.PI ? '1' : '0'},1,${curPoint.x},${curPoint.y}`} /> <Circle cx={curPoint.x} cy={curPoint.y} r={buttonRadius} fill={buttonFillColor || buttonBorderColor} stroke={buttonBorderColor} strokeWidth={buttonStrokeWidth} {...this._panResponder.panHandlers} /> </Svg>

Ahora, esto se parece a lo siguiente:

ingrese la descripción de la imagen aquí

Pero no quiero usar el color LinearGradient en este control deslizante. Quiero colores fijos como este:

ingrese la descripción de la imagen aquí

¿Cómo puedo lograr lo siguiente con un color fijo?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

¿De dónde viene su componente LinearGradient ?

Si usa react-native-linear-gradient , puede usar el apoyo de locations para asignar paradas de color y agregar una parada adicional para cada una para que no se desvanezca, algo así como:

 <LinearGradient start={{x: 0.0, y: 0.0}} end={{x: 1.0, y: 1.0}} locations={[0, 0.1, 0.1, 0.2, 0.2, 0.3, 0.3]} colors={['#000', '#000', '#111', '#111', '#222' '#222', '#333']} > ... </LinearGradient>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!