React-native-picker-select: Consider supporting react-native-web

Created on 29 Jul 2019  路  3Comments  路  Source: lawnstarter/react-native-picker-select

Is your feature request related to a problem? Please describe.
react-native-web is a new tool for creating web apps from react-native code. It would be awesome if this library supported web as well.

Describe the solution you'd like
My thought would that there could be an index.web.js file that implements the web version of this functionality. My first stab at this would be something like this (in typescript):

export const Dropdown = (props: PickerProps) => {
  const inputStyles = props.style && props.style.inputWeb
  return (
    <select
      onChange={e =>
        props.onValueChange(e.target.value, e.target.selectedIndex)
      }
      style={inputStyles}
    >
      <option disabled selected={!props.value} value="">Select an item...</option>
      {props.items.map(item => {
        return (
          <option key={item.key} value={item.value} selected={props.value === item.value}>
            {item.label}
          </option>
        )
      })}
    </select>
  )
}

I would be happy to make a PR for this functionality if it's something that would be accepted.

Edit: I'm working on this snippet for an app that will see production usage, so I'll update here as I make changes to it.

enhancement

Most helpful comment

sounds interesting - i'll need to do some reading up on react-native-web to familiarize myself with it so i can help qa the result and/or need assistance from others in the community who want to help.

i'd like to avoid typescript though as the rest of the library doesn't utilize it.

All 3 comments

sounds interesting - i'll need to do some reading up on react-native-web to familiarize myself with it so i can help qa the result and/or need assistance from others in the community who want to help.

i'd like to avoid typescript though as the rest of the library doesn't utilize it.

closing as this'll live on the feature request board.

handled by #316

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luizParreira picture luizParreira  路  8Comments

alexborton picture alexborton  路  6Comments

ltsharma picture ltsharma  路  3Comments

sidraval picture sidraval  路  9Comments

sebqq picture sebqq  路  9Comments