Giter Club home page Giter Club logo

Comments (7)

xwenliang avatar xwenliang commented on August 26, 2024

demo只是几个picker的使用例子,不能直接运行,需要在具体项目中才能使用

from react-native-picker.

xuefengyang avatar xuefengyang commented on August 26, 2024

var PageContainer = React.createClass ({

getInitialState :function(){
    return({
        pickerData: [{
          '北京': {
            '北京': ['朝阳区']
          }
        }],
      selectedValue: ['北京', '北京', '朝阳区']
    });
},
_onPressHandle :function(){
    this.picker.toggle();
  },
render :function(){
    return (
      <View style={{height: Dimensions.get('window').height}}>
          <TouchableOpacity style={{marginTop: 20}} onPress={this._onPressHandle}>
          <Text>点我</Text>
        </TouchableOpacity>
          <Picker
            ref={picker => this.picker = picker}
            pickerHeight={320}
            showDuration={300}
            pickerData={this.state.pickerData}
            selectedValue={this.state.selectedValue}
            onPickerDone={(pickedValue) => {
            console.log(pickedValue);
            }}/>
      </View>
 );
}

from react-native-picker.

xuefengyang avatar xuefengyang commented on August 26, 2024

我是这样写的

from react-native-picker.

xuefengyang avatar xuefengyang commented on August 26, 2024

道理说应该没有问题啊

from react-native-picker.

xwenliang avatar xwenliang commented on August 26, 2024

@xuefengyang
Cascade 模式下, pickerData 是个json而不是数组...

getInitialState :function(){
    return({
        pickerData: {
          '北京': {
            '北京': ['朝阳区']
          }
        },
        selectedValue: ['北京', '北京', '朝阳区']
    });
}

from react-native-picker.

xuefengyang avatar xuefengyang commented on August 26, 2024

必须是数组类型的才可以吗? @xwenliang

from react-native-picker.

xwenliang avatar xwenliang commented on August 26, 2024

必须是key:value的object... 这块数据格式写的比较死

from react-native-picker.

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.