Created
December 21, 2017 12:47
-
-
Save orYoffe/1f5d1651bab5d477730aec317ed405fc to your computer and use it in GitHub Desktop.
React Native Web starter app WebPicker Component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { createElement } from 'react-native-web'; | |
const Option = ({ | |
label, | |
value, | |
}) => createElement('option', { | |
children: label, | |
value, | |
}); | |
export const WebPicker = ({ | |
style, | |
currentValue, | |
onChange, | |
options, | |
}) => ( | |
createElement('select', { | |
value: currentValue, | |
className: style, | |
onChange: (event) => onChange(event.target.value), | |
children: options.map(option => ( | |
<Option key={`${option.label}_${option.value}`} {...option} /> | |
)), | |
}) | |
); | |
export default WebPicker; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment