Code Monkey home page Code Monkey logo

Comments (4)

iamaluckyman avatar iamaluckyman commented on July 29, 2024

不好意思,已经选中了。通过参考example中的右下角的例子:
1.获取到dropdown控件的引用
2. 选择索引为-1的项select(-1)

但是,如果我不知道idx,只知道option的文字列,该怎么选中呢,
只能循环options拿到对应的Idx?

另外:能否让option的显示的是描述,而实际拿到的是value呢,就像html中的下拉框那样

from react-native-modal-dropdown.

sohobloo avatar sohobloo commented on July 29, 2024

但是,如果我不知道idx,只知道option的文字列,该怎么选中呢,
只能循环options拿到对应的Idx?

我的建议是options的列表(如果是一组对象)由您来维护,将这组对象map成string的数组作为options传给控件,这样您可以更方便的对对象列表进行查询等操作,您认为呢?

另外:能否让option的显示的是描述,而实际拿到的是value呢,就像html中的下拉框那样

onSelect方法中可以得到value和idx两个值,不知道是否满足您的需求。

from react-native-modal-dropdown.

iamaluckyman avatar iamaluckyman commented on July 29, 2024

其实需要的效果是“界面上显示name,而程序拿到的是code”。
不过目前的版本也只能绕一下,再变成code了。
谢谢您的回答。

from react-native-modal-dropdown.

sohobloo avatar sohobloo commented on July 29, 2024

You are welcome.

from react-native-modal-dropdown.

Related Issues (20)

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.