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

70
Views
Dropdown show default view if not yet pick section React Natice

So i been thinking how to show default view if not yet pick dropdown value, so when user not yet choose the value you see the default value, i don't know if i am wrong using the null or !!selected but its still not showing the default screen

Snack Expo: https://snack.expo.dev/@mikess/react-native-select-dropdown

The Code:

App.js

import React, { FC, useState } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import Dropdown from './components/Dropdown';

const App: FC = () => {
  const [selected, setSelected] = useState(undefined);
  const data = [
    { label: 'One', value: '1' },
    { label: 'Two', value: '2' },
    { label: 'Three', value: '3' },
    { label: 'Four', value: '4' },
    { label: 'Five', value: '5' },
  ];

  return (
    <View style={styles.container}>
      <Dropdown label="Select Item" data={data} onSelect={setSelected} />
      {null && (
        <View> 
          <Text> asdasdasda </Text>
        </View>
      ) && selected.value == 1 ?  (
        <View> 
          <Text> Hallo </Text>
        </View>
      ) : !!selected && selected.value == 2 ? (
        <View> 
          <Text> Chiken </Text>
        </View>
      ):null}
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
    flexDirection: 'column',
  },
});

export default App;

it's there another method if yes what method should i use, but if you can fix it thank you very much

about 4 years ago · Santiago Gelvez
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!