【问题标题】:Ionic React Page Transition离子反应页面转换
【发布时间】:2021-05-18 19:21:57
【问题描述】:

我有一个 Ionic React 项目,使用来自 ionic/cli 的 blank 模板:ionic start

出于参考目的,我还创建了一个conference 模板示例应用程序。经过一段时间的工作,我看到conference模板中的页面转换在换页时从右到左是平滑的。

我也想在我的应用程序中执行此操作,但我没有找到执行此操作的特定代码。有帮助吗?

更新

我的应用组件:

const App: React.FC = () => (
  <IonApp>
    <IonReactRouter>
      <IonRouterOutlet>
        <AuthenticationProvider>
          <Route path="/login" component={AuthenticationPage} exact />
          <Route path="/" exact render={() => <Redirect to="/login" />} />

          <SignupProvider>
            <Route path="/signup" component={SignupPage} exact />
          </SignupProvider>
        </AuthenticationProvider>
      </IonRouterOutlet>
    </IonReactRouter>
  </IonApp>
);

export default App;

我的注册页面:

const SignupPage: React.FC<RouteComponentProps> = ({ history }) => {
    return (
        <IonPage id='signup-page'>
            <Stuff/>
        </IonPage>
    );
};

export default SignupPage;

【问题讨论】:

  • 我的预感是您没有正确使用离子路由器,但确实需要查看代码示例
  • @AaronSaunders 当然,我添加了 App 组件和页面。如果还不够,请告诉我。我是反应/离子和路由器的新手,所以我肯定做错了什么。

标签: reactjs ionic-framework ionic-react


【解决方案1】:

试试这个...当我在 routerOutlet 中分解我的路由时,我看到了奇怪的行为

const App: React.FC = () => (
  <IonApp>
    <IonReactRouter>
      <IonRouterOutlet>
        <AuthenticationProvider>
          <SignupProvider>
            <Route path="/login" component={AuthenticationPage} exact />
            <Route path="/" exact render={() => <Redirect to="/login" />} />
            <Route path="/signup" component={SignupPage} exact />
          </SignupProvider>
        </AuthenticationProvider>
      </IonRouterOutlet>
    </IonReactRouter>
  </IonApp>
);

【讨论】:

  • 它不起作用。即使强制将所有路由放在所有提供程序中,对我来说听起来也不好。其他问题一定是问题
猜你喜欢
  • 2021-06-07
  • 2023-03-27
  • 2018-04-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多