我想像以下的本土反应那样,制造一种下降的菜单。 请建议采取这种做法。
仅安装react-native-popup-menu,并使用该软件,如 docs所解释。
可以通过使用react-native-elements与本法典(Just for 3 dots):
import { Icon } from react-native-elements ;
.
.
.
<Icon
name={ dots-three-vertical }
type={ entypo }
size={20}
color= #FFF
/>
I think you can use Picker
component from react native and for the details you can read picker documentation:
编码实例:
import {View,Text,Picker} from react-native ;
//in your render method
return (
<View>
<Text}>Choose</Text>
<Picker
selectedValue={this.state.menu}
onValueChange={(itemValue, itemIndex) => this.setState({menu:emValue})}
mode="dropdown">
<Picker.Item label="Add Note" value="addnote" />
<Picker.Item label="Share" value="share" />
<Picker.Item label="Vault" value="vault" />
</Picker>
</View>
);
我希望这一答案能够帮助你。
在一些人仍然寻求这种选择的情况下,我现在就把这一选择落实到我自己的肩上,首先,你们都需要在-Menu-Provider-Component和当你(你需要做这一100%,否则不工作, pls读! docs)做的是,这里的门。
import { Feather } from @expo/vector-icons ;
import { Menu, MenuOptions, MenuOption, MenuTrigger} from react-native-popup-menu ;
<Menu style={{marginRight:5}}>
<MenuTrigger>
<Feather name="menu" size={30} color="white" />
</MenuTrigger>
<MenuOptions>
<MenuOption onSelect={() => alert(`pressed1`)} >
<Text style={{color: green }}>Option1</Text>
</MenuOption>
<MenuOption onSelect={() => alert(`pressed2`)} >
<Text style={{color: red }}>Option2</Text>
</MenuOption>
<MenuOption onSelect={() => alert(`pressed3`)} >
<Text style={{color: yellow }}>Option3</Text>
</MenuOption>
</MenuOptions>
</Menu>
Like you see, I used an Icon which I placed inside the MenuTrigger component. I wanted to have an Icon which I click upon and after that the menu opens, exactly how the creator of this question wanted.
OnSelect executes a function which will be called if you choose the option in the dropdown menu, basicly its nothing else then onPress with a button.
This is my first question, and english is not my first language, sorry if my question is hard to understand I was trying to make simple CRUD app with mysql database and react as the frontend, and i ...
I have two react apps, parent app and child app. and child app have an hash router. I have build the child app using npm run build, It creates build folder. That build folder moved into inside the ...
这是我的第一个问题,请与我一起回答。 I m从事一项SPA React项目,该项目跟踪农场及其相关床位,并可使用一些帮助。 我愿就......提供一些数据。
I want to print the selected value, and below is my option list: const vesselName = [ { value: 0 , label: ALBIDDA , }, { value: 1 , label: ALRUMEILA , }, { value: 2 ,...
I have this custom filter for date , filter button is working as expected but reset button is not working, can anyone help me,what s wrong here? Below is my code which contain handlesearch,handlereset ...
I am using react. I want to add a line break <br> between strings No results and Please try another search term. . I have tried No results.<br>Please try another search term. but ...
I am trying to make a POC with Rails5, action Cable, React and Rails and React DnD. The purpose is to make an app like trello but for an recruitment process. My front is in ReactJS. I have 3 ...
- winforms
- combobox
- fogbugz
- java
- date
- internationalization
- asp.net
- iis
- url-rewriting
- urlrewriter
- c#
- enums
- ocaml
- haxe
- algorithm
- string
- viewstate
- .net
- c++
- c
- symbol-table
- mysql
- database
- postgresql
- licensing
- migration
- vb.net
- vb6
- declaration
- vb6-migration
- python
- psycopg2
- backup
- vmware
- virtualization
- gnu-screen
- authentication
- desktop
- excel
- xll
- cultureinfo
- regioninfo
- oracle
- client
- session
- download
- html
- virtual
- constructor
- scenarios
- perl
- full-text-search
- javascript
- ajax
- testing
- oop
- inheritance
- vim
- encapsulation
- information-hiding