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

464
Visualizações
Type Annotations can only be used in TypeScript Files and parsing error in REACT-NATIVE

I am currently learning react native and trying to create UBER CLONE. But i am facing certain issues regarding Type annotations and Parsing. Also whenever i rename my app.js into app.jsx it stops working and i have to switch it back to app.js. Error is in line number 30 and 31. Someone Help me to fix this.

Here is the code.

import React, {useState} from 'react';
import {View, TextInput, SafeAreaView} from 'react-native';
import {GooglePlacesAutocomplete} from 'react-native-google-places-autocomplete';

import styles from './styles';

const DestinationSearch = props => {
  const [fromText, setFromText] = useState({initalState: ''});
  const [destinationText, setDestinationText] = useState({initalState: ''});

  const [originPlace, setOriginPlace] = useState({initalState: 'null'});
  const [destinationPlace, setDestinationPlace] = useState({initalState:'null'});
  return (
    <SafeAreaView>
      <View style={styles.container}>
        <TextInput
          value={fromText}
          onChangeText={setFromText}
          style={styles.textInput}
          placeholder="From"
        />
        <TextInput
          value={destinationText}
          onChangeText={setDestinationText}
          style={styles.textInput}
          placeholder="Where to?"
        />
        <GooglePlacesAutocomplete
          placeholder="Where to?"
          onPress={(data:GooglePlaceData, details:GooglePlaceDetail | null = null) => {
            setDestinationPlace(value:{data, details});
          }}
          fetchDetails
          query={{
            key: 'AIzaSyB3rsn2ecpXZ8p9d8J_kLIH59rxt9KV6Rs',
            language: 'en',
          }}
        />
      </View>
    </SafeAreaView>
  );
};

export default DestinationSearch;

Error is :

Parsing error: Unexpected token, expected ":"

  29 |           placeholder="Where to?"
  30 |           onPress={(data:GooglePlaceData, details:GooglePlaceDetail | null = null) => {
> 31 |             setDestinationPlace(value:{data, details});
     |                                            ^
  32 |           }}
  33 |           fetchDetails
  34 |           query={{
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It's just some syntax error

setDestinationPlace({ value: { data, details } });
about 4 years ago · Juan Pablo Isaza Relatório
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