ɵIJ

ҳ

Һܶأֻһҡ

react-native ˵ ѡ ʵ

2019330

˵

 

        ʵͼʾЧȰװreact-native-modal-dropdown

        1. npmװ npm install react-native-modal-dropdown --save

        2. װϺ˰  import ModalDropdown from 'react-native-modal-dropdown';

        3. renderд

        <ModalDropdown        style={{paddingLeft17paddingTop6}}        

                        textStyle={{fontSize16}}        

                        defaultValue={'ѡ'}        

                        options={['ѹ''·''''''']}        

                        onSelect={this.onSelectType}/></View>

        4. УonSelectԽܵһfuncѡijһʱҴֱѡidvalue

        onSelectType(index, value){

            if(value == '')

                DeviceEventEmitter.emit('Visible'true);

            else        

                DeviceEventEmitter.emit('Visible'false);

         }

        5. ϵonSelectTypeʵֵѡСѡʱһѡзǡѡʱЧ

        õǴ   Ҫд2ڹ캯componentDidMount()е  componentDidMount()С

    componentDidMount() {

        this.subscription DeviceEventEmitter.addListener('Key2', ()=>{        isLogin 'yes';

        this._bootstrapAsync(); //Ϊʾ¼û

        this.componentWillUnmount();

    });

           this.subscription DeviceEventEmitter.addListener('Visible', (i)=>{

            if(i)  //ʾ            

                this.setState({visible:50});

            else            

                this.setState({visible:0});

            this.forceUpdate(); //ǿˢҳ       

            this.componentWillUnmount();

        }); };

 

    componentWillUnmount() {  //ͷż    

        this.subscription.remove();

    };

 

ѡ

 

    1. װreact-native-check-box

    2. import CheckBox from 'react-native-check-box';

    3. renderд

        <CheckBox onClick={()=>{    this.setState({isChecked_1:!this.state.isChecked_1}); }}

        isChecked={this.state.isChecked_1}

        isIndeterminate={false}

        rightText={"ѹ"}/>

    4. ǵҪstateӶӦѡ״̬isChecked_1

 

ҳ

ICP 18034075   33011802001497

i