Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

259
Visualizações
React native error: Binding invalid left-hand side in object destructuring pattern, what does this mean?

I am doing a React Native project as a beginner, while creating a button component, I'm getting the error regarding destructuring. I have checked multiple times but am not able to resolve it. Please help.

Here is my code:

   import React from 'react';
   import {TouchableOpacity, Text, StyleSheet} from 'react-native';
    
   export const RoundedButton = ({
      style: {},
      textStyle: {},
      size: 125,
      ...props
    }) => {
      return (
        <TouchableOpacity style ={[styles(size).radius, style]}>
          <Text style = {[styles(size).text, textStyle]}>{props.title}</Text>
        </TouchableOpacity>
      )
    
    };
    
    const styles = (size) => StyleSheet.create({
      radius: {
        borderRadius: size/2,
        width: size,
        height: size,
        alignItems: 'center',
        borderColor: '#fff',
        borderWidth: 2,
      },
    
      text: {
        color: '#fff',
        fontSize: size/3,
      },
    })

Here is the error shown in my Expo snack:

src/components/RoundedButton.js: Binding invalid left-hand side in object destructuring pattern (8:8)
   6 |   style: {},
   7 |   textStyle: {},
>  8 |   size: 125,
     |         ^
   9 |   ...props
  10 | }) => {
  11 |   return (
  Evaluating src/components/RoundedButton.js
  Evaluating src/features/focus/Focus.js
  Evaluating App.js
  Loading App.js
Error: /src/components/RoundedButton.js: Binding invalid left-hand side in object destructuring pattern (8:8)

   6 |   style: {},
   7 |   textStyle: {},
>  8 |   size: 125,
     |         ^
   9 |   ...props
  10 | }) => {
  11 |   return (
    at Object.eval (src/components/RoundedButton.js:1:113)
    at eval (src/components/RoundedButton.js:2:4)
    at eval (src/components/RoundedButton.js:3:3)
    at eval (<anonymous>)
    at [snack internals]
    at Object.a ([snack internals]
    at e.evaluate ([snack internals]
    at Ze ([snack internals]
    at [snack internals]
    at https://snack-web-player.s3.us-west-1.amazonaws.com/v2/43/static/js/app.82f7ca86.chunk.js:1:14450
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda