[fix] Picker.Item label text

Render the label as a child of 'option' rather than using the 'label'
attribute.

Fix #774
This commit is contained in:
Nicolas Gallagher
2018-01-17 17:59:05 -08:00
parent a9342daee2
commit b7adfd5f32
3 changed files with 15 additions and 1 deletions

View File

@@ -20,6 +20,6 @@ export default class PickerItem extends Component<Props> {
render() {
const { label, testID, value } = this.props;
return createElement('option', { label, testID, value });
return createElement('option', { testID, value }, label);
}
}

View File

@@ -1,5 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`components/Picker prop "children" items 1`] = `
<option
value="value-1"
>
label-1
</option>
`;
exports[`components/Picker prop "children" renders items 1`] = `
<select
className="rn-fontFamily-poiln3 rn-fontSize-7cikom rn-marginTop-1mnahxq rn-marginRight-61z16t rn-marginBottom-p1pxzi rn-marginLeft-11wrixw"

View File

@@ -16,6 +16,12 @@ describe('components/Picker', () => {
const component = shallow(picker);
expect(component).toMatchSnapshot();
});
test('items', () => {
const pickerItem = <Picker.Item label="label-1" value="value-1" />;
const component = shallow(pickerItem);
expect(component).toMatchSnapshot();
});
});
describe('prop "enabled"', () => {