我使用的是自定义登录插件,因此在单击“登录”按钮之前,我必须确保所有链接都将用户正确重定向到他们所在的位置。为此,我的登录链接如下所示:
import React from 'react';
import Root from "native-base";
import { createAppContainer } from '@react-navigation/native';
import { createStackNavigator } from 'react-navigation-stack';
import { createDrawerNavigator } from 'react-navigation-drawer';
import Home from "./screens/home/index";
import Email from "./screens/email/index";
import ProfileScreen from "./screens/ProfileScreen";
import SideBar from "./screens/SideBar/SideBar";
const Drawer = createDrawerNavigator(
{
Home: { screen: Home},
//Email: { screen: Email},
ProfileScreen: { screen: ProfileScreen}
},
{
initialRouteName: "Home",
contentOptions: {
activeTintColor: "#e91e63"
},
contentComponent: props => <SideBar {...props}/>
}
);
const AppNavigator = createStackNavigator (
{
Drawer: {screen: Drawer}
},
{
initialRouteName: "Drawer",
headerMode: "none"
}
);
const AppContainer = createAppContainer(AppNavigator);
export default () =>
<Root>
<AppContainer/>
</Root>
为了实现这一点,我不得不在functions.php中创建一个简码
<a href="[print_login_redirect]">CONTENT</a>
问题在于它仅返回固定链接
function print_login_redirect_shortcode() {
global $post;
return '/login?redirect_to='.get_permalink($post->id);
}
add_shortcode( 'print_login_redirect', 'print_login_redirect_shortcode' );
注意,它在前面显示两个斜杠。当我从回车中取下'/ login?redirect_to ='时,它不会在前面显示这些斜杠。
有什么想法吗?