Here’s my dropdown using react-native-element-dropdown library. It’s working fine, but I’d like to be able to select one of the elements by default when a page renders. Instead of showing a placeholder, it shows a selected category.
<Dropdown
style={styles.dropdown}
placeholderStyle={styles.placeholderStyle}
selectedTextStyle={styles.selectedTextStyle}
inputSearchStyle={styles.inputSearchStyle}
iconStyle={styles.iconStyle}
data={categoriesData}
search
maxHeight={300}
labelField="name"
valueField="id"
placeholder="Select or create a category"
searchPlaceholder="Start typing to search..."
containerStyle={{ borderRadius: 8 }}
value={categoryId}
onChange={(category) => {
setCategoryId(category.id);
}}
/>