第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

在 React Native 中將 JSON 數(shù)據(jù)傳遞到下一頁(yè)

在 React Native 中將 JSON 數(shù)據(jù)傳遞到下一頁(yè)

素胚勾勒不出你 2021-07-06 13:01:47
我是初學(xué)者,仍在學(xué)習(xí)如何對(duì)本機(jī)做出反應(yīng)。在我的本機(jī)應(yīng)用程序中,我有 2 個(gè)屏幕。在第一頁(yè),我有 JSON 數(shù)據(jù) [從實(shí)時(shí)服務(wù)器獲取];我想將此 JSON 數(shù)據(jù)傳遞到下一頁(yè)。我使用 react-navigation 在頁(yè)面之間導(dǎo)航。我將一個(gè)數(shù)據(jù)[手機(jī)號(hào)碼] 傳遞到下一頁(yè)。但我想不通,如何將 JSON 數(shù)據(jù)傳遞到下一頁(yè)!第一頁(yè)代碼:[其中包含 JSON 數(shù)據(jù)]constructor(props) {     super(props)     this.state = {    UserMNO: ''    }   }  UserLoginFunction = () =>{ const { UserMNO } = this.state; const {firstname} = this.state; const {lastname} = this.state; const {email} = this.state; const {profession} =this.state;fetch('http://demo.weybee.in/react/User_Login.php', {  method: 'POST',  headers: {    'Accept': 'application/json',    'Content-Type': 'application/json',  },  body: JSON.stringify({  mobileno: UserMNO,      })}).then((response) => response.json())      .then((responseJson) => {        // If server response message same as Data Matched       if(responseJson != 'Enter valid phone number' )        {               console.log(responseJson[0]);            console.log(responseJson[1]);            console.log(responseJson[2]);            console.log(responseJson[3]);            //Then open Profile activity and send user email to profile activity.            this.refs.toast.show('Login successful', 500, () => {            const { navigation } = this.props;            const { UserMNO }  = this.state ;            navigation.navigate("Profile",              {mobileno : UserMNO},              );    });        }        else{          Alert.alert(responseJson);        }      }).catch((error) => {        console.error(error);      });  }
查看完整描述

1 回答

?
拉丁的傳說(shuō)

TA貢獻(xiàn)1789條經(jīng)驗(yàn) 獲得超8個(gè)贊

您可以像這樣發(fā)送響應(yīng) JSON:


navigation.navigate(

              "Profile", 

              {mobileno: UserMNO, myJSON: responseJson} 

);

并在第二個(gè)屏幕中獲取它:


const responseJson = this.props.navigation.getParam("myJSON");


查看完整回答
反對(duì) 回復(fù) 2021-07-08
  • 1 回答
  • 0 關(guān)注
  • 263 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)