Skip to content

Instantly share code, notes, and snippets.

@orYoffe
Created December 21, 2017 12:47
Show Gist options
  • Save orYoffe/1f5d1651bab5d477730aec317ed405fc to your computer and use it in GitHub Desktop.
Save orYoffe/1f5d1651bab5d477730aec317ed405fc to your computer and use it in GitHub Desktop.
React Native Web starter app WebPicker Component
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