rebassjs / rebass

:atom_symbol: React primitive UI components built with styled-system.
https://rebassjs.org
MIT License
7.95k stars 658 forks source link

Select showing option values #251

Closed navmalc closed 7 years ago

navmalc commented 7 years ago

I'm using a Select box to show some timezone values, but the options aren't appearing in the dropdown. My app is created using CreateReactApp, not ejected so using all the defaults you get there. Code is below.

When I switch from Select to the standard select, it works - so I think I must be missing some subtlety of the code. The issue persists if I straight copy in the examples from the demo.

import React, { Component } from 'react';
import { Heading, Select } from 'rebass';
import { getZones } from '../utils/External';

function TzPicker(props){
  var zones = getZones();
  return(
    <Select label='select' name='select'>
    {zones.map(function(zone, index){
      return(
        <option key={index} value={zone}>{zone}</option>
        )}
      )}
    </Select>
  )
}
jxnblk commented 7 years ago

You're example looks mostly correct, though please not that the <Label /> component is no longer wrapped together with the <Select /> component so you should add that separately. You can see in the docs that the Select component should work: http://jxnblk.com/rebass/#Select - it's hard to tell what's happening in your particular case without more context

jxnblk commented 7 years ago

Closing this without further context