React Native 仿美團下拉篩選菜單控件
演示效果如下:
使用方法如下:
1、安裝
npm install react-native-dropdownmenus --save
react-native link react-native-dropdownmenus
2、使用
import React, {Component} from 'react'; import Dropdownmenu from 'react-native-dropdownmenus'; export default class App extends Component { render() { let conditionData = [ ["地區", "廣州", "深圳", "北京", "上海", "西安"], ["面積", "100平以內", "100-200平"], ["類型", "五星酒店", "四星酒店", "三星酒店", "二星酒店", "會展中心", "餐廳"], ]; return ( <Dropdownmenu style={{flex: 1}} bgColor={'white'} tintColor={'#666666'} activityTintColor={'green'} // arrowImg={} // checkImage={} // optionTextStyle={{color: '#f00'}} // titleStyle={{color: '#0f0'}} // maxHeight={300} handler={(selection, row) => console.log(selection,row) } data={conditionData} // selectIndex={[0,2,0]} /> ) } }
附:
筆者在link 過程中出現 Error: Cannot find module 'asap/raw' 錯誤!
解決方法參考: https://www.cnblogs.com/wukong1688/p/10911182.html
插件作者Github:
https://github.com/WheelerLee/react-native-dropdown-menu
本博客地址: wukong1688
本文原文地址:https://www.cnblogs.com/wukong1688/p/10911222.html
轉載請著名出處!謝謝~~