I first defined an array of data:
const testData = [
{value: 1, label: '1'},
{value: 2, label: '2'},
{value: 3, label: '3'},
];
Then I included the Picker component in the render method:
<Picker
data={testData}
values={[1]}
cols={1}>
<List.Item arrow="horizontal">Option</List.Item>
</Picker>
The Picker would pop up from the bottom of the screen when I press the 'Option' field.
The Picker didn't show up. Actually, nothing happened, not even a warning.
Interestingly, though, when I put the DatePicker component in the render method simply like this:
<DatePicker>
<List.Item>Pick a Date</List.Item>
</DatePicker>
The DatePicker did pop up from the bottom when pressed.
Not sure if I used the component correctly.
@subject17 add prop triggerType="onClick"
<Picker data={testData} values={[1]} cols={1} triggerType="onClick">
<List.Item arrow="horizontal">Option</List.Item>
</Picker>
@warmhug picker 文档没有描述 triggerType,这个内置到 Piker 里?
@warmhug 建议内置进去,新手比较容易踩坑
已经内置
我踩到这个坑了
Most helpful comment
@subject17 add prop
triggerType="onClick"