react-native三级城市联动选择

省市数据链接https://download.csdn.net/my/uploads/3/1

以下是省市数据的截图

react-native三级城市联动选择_第1张图片

然后在react-native代码中实现省市的选择,实现如下:

import areaData from '../../common/citydata';

export default class EditAddress extends Component<{}> {
    constructor(props) {
        super(props);

        this.state={
            
        };
    }

    //创建省市数据
    _createAreaData() {
        let that = this;
        let area =  areaData[0]["children"];
        console.log(area[0]["children"],"编辑地址获取到的结果");

        let data = [];
        let len = area.length;
        for(let i=0;i {
                console.log('area', pickedValue);
            },
            onPickerCancel: pickedValue => {
                console.log('area', pickedValue);
            },
            onPickerSelect: pickedValue => {
                console.log('area', pickedValue);
            }
        });
        Picker.show();
    }
}

    

 

你可能感兴趣的:(react-native三级城市联动选择)