从抽屉中导航以响应本机路由器流量

我已使用react-native-router-flux在react应用程序中进行导航。我已经在路线中实现了Drawer。

这是我的

Routes.js

<Router>

    <Scene key="app" hideNavBar={true} initial={this.props.isLoggedIn}>

        <Drawer key="drawer" drawer={true} contentComponent={SideMenu} initial={true}>
                 <Scene key="homeScreen" component={HomeScreen} hideNavBar={false} navBar={() => <HeaderDrawer title="Home" />} />
                 <Scene key="paymentScreen" component={PaymentScreen} hideNavBar={false} navBar={() => <HeaderDrawer title="Payment" />} />
                 <Scene key="activityScreen" component={activityStatement} hieNavBar={false} navBar={() => <HeaderDrawer title="activity Statements" />} />
         </Drawer>

        <Scene key="forgotPassword" hideNavBar={false} component={ForgotPasswordScreen} navBar={() => <Header title="Forgot Password" />} />

    </Scene>

<Router>

现在,我可以使用forgotPassword从抽屉选项卡之一移至actions.forgotPassword(),但是我不能使用{{1}从forgotPassword回到抽屉}。有人可以告诉我这是怎么回事吗?

谢谢。

yingcaiiacgniy 回答:从抽屉中导航以响应本机路由器流量

也许您可以尝试以下方法:

 import React from "react";

import { Line } from "react-chartjs-2";
import Chart from "./Chart";

export default class Symbols extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      items: [],isLoaded: false,symbolsdateforchart: [],closingdateforchart: [],search: "",symbol: this.props.location.symbol,//here I am making my chart

      chartData: {
        labels: ["how to add the data of symbolsdateforchart here"],//and here I know the data is not yet assigned to symbolsdateforchart: [],so not sure how to make it work
        datasets: [
          {
            label: "Closing price",data: ["how to add the data of closingdateforchart here"],//and here I know the data is not yet assigned to closingdateforchart: [],so not sure how to make it work
            fill: false,backgroundColor: [
              "rgba(255,99,132,0.6)","rgba(54,162,235,"rgba(255,206,86,"rgba(75,192,"rgba(153,102,255,159,64,],},};
  }

  componentDidMount() {
    let symbolsdate = [];
    let closingprice = [];

    fetch(`http://131.181.190.87:3001/history?symbol=${this.state.symbol}`)
      .then((res) => res.json())

      .then((json) => {
        console.log(json);
        for (const dataobj of json) {
          let tempsymbolsDate = dataobj.timestamp.split("T")[0];
          let tempclosingPrice = dataobj.close;
          let tempArray = tempsymbolsDate.split("-");
          tempsymbolsDate =
            tempArray[2] + "/" + tempArray[1] + "/" + tempArray[0];

          symbolsdate.push(tempsymbolsDate);
          closingprice.push(tempclosingPrice);
        }
        this.setState({
          isLoaded: true,items: json,//here the value get assigned for them
          symbolsdateforchart: symbolsdate,closingdateforchart: closingprice,});
      });

  }


  render() {

    return (
      //here I just print the table using the api I fetched in omponentDidMount()

    );
  }
}
openDrawer = () => {
    Actions.refresh({key: 'drawer',open: true });
}
本文链接:https://www.f2er.com/2385671.html

大家都在问