Skip to content

Failed prop type: Invalid prop children of type object supplied to IGNORE #1749

@riamon-v

Description

@riamon-v

Describe the bug

While using the Picker of this library I get the following warning every-time

Screenshot 2021-12-30 at 17 35 17

To Reproduce

  1. Creating a basic Picker
  2. Having a list of object, each object like so: {key: '..', label: '...', value: '...'}
  3. Creating a list of Picker.Item by maping my list of object. Without lodash library, just the standard JS map function

Expected behavior

The picker is actually working, but i can't find why it is sending me this warning everytime. I checked the code here, and it seems i did the same except for lodash use and the key prop added to each object.

Code snippet

<Picker
	ref={ref}
	title={`${props.label}Picker`}
	floatingPlaceholder
	// migrate={true}
	placeholder={props.placeholder}
	value={props.value}
	onChange={props.onValueChange}
	floatingPlaceholderStyle={{
		...Typography.normal,
		fontSize: 16,
		color: Colors.placeholder,
		// marginLeft: Spacings.S - 3,
	}}
	style={[
		{
		...Typography.normal,
		color: Colors.text,
		top: props.label ? -8 : 0,
		paddingBottom: 15,
		paddingTop: 5,
		textAlign: props.label ? 'right' : 'left',
	       },
                props.label && { width: '50%' },
	]}
	renderRightIcon={() => (
		<TouchableOpacity
			onPress={ref?.current?.toggleExpandableModal}
		>
                  <Text>Toggle</Text>
               </TouchableOpacity>
	)}
	hideUnderline
	useNativePicker={!props.search}
	showSearch={props.search}
	wheelPickerProps={{
		items: props.items,
		textStyle: {
			fontSize: 15,
		},
	}}
>
	{props.items.map((option) => (
		<Picker.Item
			key={option.key}
			value={option.value}
			label={option.label}
			inputLabel={option.inputLabel ?? undefined}
			disabled={false}
			labelStyle={{
				...Typography.title,
				color: Colors.primary,
			}}
			selectedIconColor={Colors.highlight}
		/>
	))}
</Picker>

HERE is what I pass to my items props when using my custom component using the picker

items={itemsFromSomwhere.map((m) => ({
	value: m,
	label: m,
	key: m,
}))}

Screenshots

Device (please complete the following information)

IOS Emulator: Iphone 8

Additional context

Metadata

Metadata

Assignees

Labels

buga bug in one of the components

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions