Giter VIP home page Giter VIP logo

react-native-material-dropdown's People

Contributors

n4kz avatar pavex avatar slorber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-material-dropdown's Issues

Drops Refs in Example

I'm not a fan of using refs in RN unless as a last resort as somewhat evidenced by the complexity of the example for what should be easy to accomplish.

Wouldn't it just be easier to pass the label or anything really to the onChangeText function like so:

<Dropdown
  ...
  data={nameData}
  onChangeText={(value, i, data) => this._onChangeText(value, i, data, 'name')}
/>
_onChangeText(value, i, data, field) {
  this.setState({[field]: data[i]._value})
}

Bottom Border

How to remove Border-bottom from dropdown Please help...

includeFontPadding is not a valid style property

includeFontPadding does not work in older versions of react-native. I am running 0.36 and I think includeFontPadding is included in 0.40. I tried to upgrade react-native, but ran into a world of hurt. Would you be able to put a fix up for this?

This style is in the react-native-material-buttons package.

screenshot_20170803-092418

Disable the dropdown

Is it in any way possible to disable the use of the dropdown?
I already tried with the Text Input prop "editable= {false}" with no affect.
Thanks in advance!

Failed prop type: Invalid prop `data[0].label`

I am using the Dropdown with data such as:

const dropDownValues = [
    { value: "value1", label: "Label one" },
    { value: "value2", label: "Label two" },
];

The dropdown renders and functions fine, however I am getting a react-native warning:

Warning: Failed prop type: Invalid prop data[0].label of value Label one supplied to Dropdown, expected one of [null, null].

I suspect this is just a problem with the prop type definitions?

Older versions of react native break

ViewPropTypes on dropdown/index and item/index break older versions of react-native because ViewPropTypes is undefined.

I forked this repo, removed ViewPropTypes and the component now works. Running 0.36 version of react-native.

Dropdown appears overtop of status bar

When I have the last option selected in the dropdown and then open the dropdown the options get cut off by the top of the app.

iOS Simulator
screen shot 2017-08-18 at 11 39 25 am

Android
screenshot_20170818-115050

Any way to make it so that the dropdown goes down if there is not enough room at the top of the app?

Dropdown position on RTL devices

On right to left devices when a dropdown control doesn't span the whole screen width and the control is clicked the dropdown appears on the opposite side of the screen.

Are there any ways to create dropdown with no text in TextField?

I'm trying to create a dropdown menu, which drops when you press icon on the toolbar. But i can't find a legal way to don't render text in TextField, or set it empty after selection. Is it possible without editing lib source files?
P.S. Sorry for my english :(

An 'Other' option?

Love this design! For one of my options, I'd like the user to be able to input something they write. Is there that option currently possible with the dropdown?

Question about the data json array

Hi,

I was wondering if their a way to access the test value of the json array below from the onChangeText?

<Dropdown
  error={props.phoneTypeError}
  label='Type of number'
  value={props.phoneType}
  onChangeText={(data) => console.log(data.test)}
  data={[{
    value: 'Call',
    test: 'call',
   }, {
     value: 'SMS',
     test: 'sms',
   }]}
/>

Thank you and continue your great work!

How can I reset the value and text of dropdown?

I am using two dropdowns on the single screen and I have to reset the second dropdown when the value of first dropdown is changed. I tried to use the value prop and bound it to a state variable but the text of the dropdown does not change when state changes.
Am I missing out something here?

Event is undefined on focus()

In index.js, line ~119, event is undefined when the dropdown is opened via the focus() function. This is because onPress() is never called. We fixed the issue by wrapping
event.nativeEvent.locationY -= 16; this.ripple.startRipple(event);

with if(event != undefined){

Unnecessary label required

I'm getting this warning if not enter the label parameter, but the component works fine without it. I think it should be optional.

Btw, thanks for a great component it helps me a lot.

Missing RCTAnimation and libRCTAnimation

Wasn't working in ios, had to bring in the RCTAnimation library from react-native and libRCTAnimation.a. Not sure if this is the same for everyone else. If so, might be worth noting in the read me.

Label Display

Is there a way to keep the field label above the field?

What I mean by this is that when there is no value set on the drop down, the label is inside the dropdown field, but when you select a value, the label then shows up above the field.

I would like it to always be above the field, because my other fields which are not dropdowns have labels above the field.
screen shot 2017-11-09 at 11 19 16 pm
screen shot 2017-11-09 at 11 19 45 pm

Example does not run

I found two issues, one of which I was able to fix with reference to facebook/react-native#14935 (the location of a critical script has changed from the packager folder to the scripts folder).

The second issue is beyond me. I get a successful build,

** BUILD SUCCEEDED **

Installing build/Build/Products/Debug-iphonesimulator/example.app
Launching org.reactjs.native.example.example

and the packager is running OK, but I get this error in the simulator when launching the app,

Failed to load bundle... index.ios.bundle

because of an

Invalid or unexpected token (While processing preset: ".../example/node_modules/babel-preset-react-native/index.js")

remove bottom border

how to remove bottom border of picker, i am applying in pickerStyle but it won't reflacting
please help
thank you

null is not an object (evaluating 't.scroll.scrollTo')

This crash can be reproduced by rapidly clicking a dropdown menu. Using RN: 0.45.1, react-native-material-dropdown 0.5.0.

The issue can be fixed by adding an additional condition to the if statement on line: 241 of src/components/dropdown/index.js so the setTimeout so it looks like this:
if (this.mounted && this.scroll !== null) {

Question about items value

Items value and label are the same thing in this package? what to do when there are duplicated labels?

Dropdown data?

Is it possible add React Object / Component instead of labels?

Different textAlign on iOs & Android

On iOs the text of the item is set left to right and if the text is longer than component width it makes the text truncate (ellipsis), instead of android, on android the text is set right to left and don't truncate the text.

Android
image

iOs
image

I have the same code to both platforms

Underline highlighting.

I have a need to control the color of the highlighting. Customize to be different from the floating label.

Also, customize different colors when it is active/inactive.

How to use id and value together

I want to show value in select box. After selecting, I want to pass id of selected field.

I want like,
Name

How can I do this ?

Disable dynamic position option?

Thank you so much for making this library, the material design fits really well into android apps. However I feel like the dynamic positioning is rather irritating. I feel like a user would expect a dropdown to appear at the same position every time. An option to turn this off would be splendid. The dynamic positioning also sometimes causes the drop down list to go underneath the status bar.

Sorry if this option is already present but I couldn't find anything about it in the docs. Alternatively if you can find a way to just prevent the dropdown from going under the status bar that would great as well.

How to determine a default value

Here is my problem: The first time my component is loaded I want to make a default value of the dropdown. I.E 'date' 'campaign' 'user' is my data with a label: group by. When the component first loaded, the label is showing in dropdown but I want to show one of my datas. How can I do this ?

Get a selected value in drop down list

I am using this module. It's all working fine. I am running a sample react-native app. In this app i am displaying 1-100 years in drop down list. My question is how to get a selected value in drop down list.
Here is my code:

import { View, ScrollView, Text, TextInput, TouchableOpacity, Image, Keyboard, LayoutAnimation, Alert } from 'react-native';
import { Dropdown } from 'react-native-material-dropdown';
var data = [];
class AddPatients extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
          value: ''
             }
           }
componentWillMount() {
    for (var i = 1; i <= 100; i++) {
      data.push({ value: i.toString() });
    }
  }
  selectedYear(value, index, data) {
    this.setState({
      value: data[value]
    });
  }
render() {
    return (
  <View style={{ flex: 0.027, alignItems: 'flex-start', justifyContent: 'center' }}>
                        <Dropdown
                          label="Select Year"
                          data={data}
                          baseColor={'black'}
                          containerStyle={{ width: 130 }}
                          selectedItemColor={'black'}
                          value={this.state.value}
                          onChangeText={this.selectedYear.bind(this)}
                        />
                      </View>
)
}
        }

Here is my screenshot:
screen shot 2017-11-15 at 10 56 28 am

Picker View Styling

Picker view is shown from the position last selected.
For example, if the last item is selected, the picker view would be bottom to up, next time.
How can I adjust this view fixed as top to bottom all time?

SyntaxError: Missing class properties transform

Hi I am having trouble adding this lib to my project, could someone please assist

react-native-cli: 2.0.1
react-native: 0.49.3

screenshot

import {Dropdown} from 'react-native-material-dropdown';

...
<Dropdown label={Strings.COMMISSION_HEADING} data={channelOptions}/>
...

crashed when lock to landscape mode

when using react-orientation, app crashes when I lock to landscape mode.

Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [RCTModalHostViewController shouldAutorotate] is returning YES'

similar issue:
xgfe/react-native-datepicker#28

labelFontSize has no effect

Hey!
Thanks for this good work, very useful :)
Just wanted to tell you that there is an error on the README. You have labelFontSize but that property does not exist (or at least I was not able to find it) I think that you meant to write fontSize.
Is that right?

pickerStyle seem to have no effect!

Thanks for the great library. It's really easy to use. However, I am having trouble styling the actual dropdown component. I want to change it's background colour and add a top border. The prop that came to mind that could achieve this is pickerStyle. However, it doesn't seem to have any effect on the styling. Any help on this would be greatly appreciated. Cheers!

<Dropdown textColor='#efe1db' baseColor="#efe1db" itemColor='#efe1db' selectedItemColor='#000' value={data[0].value} data={data} dropdownPosition={0} label="" labelHeight={10} // inputContainerStyle={ // {backgroundColor: "red"} // } pickerStyle={{ width: 300, borderTopWidth: 2, borderTopColor: '#78818a', backgroundColor: '#3c3d3e', }} />

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.