小编Roe*_*pan的帖子

Expo Google Login 独立重定向到 google.com

我的应用程序与 Expo 一起使用,我import * as Google from "expo-google-app-auth";用于来自谷歌的登录用户。在开发模式下,它的工作正常。 在独立模式下,

它重定向我以选择电子邮件,在我选择它之后将我重定向到 google.com 主页而不是返回到我的应用程序

问题:为什么将我重定向到谷歌,我该如何处理(再次 - 在开发模式下它的工作)

  1. 我的谷歌登录应用

    try {
    const result = await Google.logInAsync({
        androidClientId: "556835760268-jm5v5u3h1bu4rcontent.com",
        androidStandaloneAppClientId: "556835760268-jm5v5u3h1bu4uea3jr788tent.com",
        scopes: ["profile", "email"],
    });
    
    Run Code Online (Sandbox Code Playgroud)
  2. 我的 app.json 文件:

    {
    "expo": {
    "name": "Lior",
    "slug": "Lior",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "scheme": "myapp",
    "splash": {
    "image": "./assets/splash.png",
    "resizeMode": "contain",
     "backgroundColor": "#ffffff"
      },
    
     "updates": {
     "fallbackToCacheTimeout": 0
     },
      "assetBundlePatterns": [
     "**/*"
     ],
      "ios": {
      "bundleIdentifier": "com.roei.liorApp",
       "buildNumber": "1.0.0"
         },
          "web": {
          "favicon": …
    Run Code Online (Sandbox Code Playgroud)

react-native appauth expo

9
推荐指数
1
解决办法
369
查看次数

如何在 Next.js 中获取可重用布局组件的数据

我需要将 slugs 放入 Header 组件中,该组件可在布局内的所有网站中重复使用:

const Layout = ({ children }) => {
  return (
    <>
      <Header />//////////this one.
      {children}
      <Footer />
     </>
  );
};
Run Code Online (Sandbox Code Playgroud)

我的 slugs 来自服务器端,我只需要在标头中动态获取它们一次。

标题内部类似:

categoriesLinks.map(category=> {
  return <div>{category.SLUG}</div>
})
Run Code Online (Sandbox Code Playgroud)

但因为它是一个可重用的组件,我不知道如何以及在哪里调用getServerSidePropsor getStaticProps

  • 例如,如果我使用索引组件,我需要在每个组件中获取数据
  • getInitialProps如果我尝试在 中获取它_app,它不会获取它(获取undefined

处理这个问题的正确方法是什么?这似乎是一个非常大的问题,我找不到合适的解决方案。

reactjs next.js

5
推荐指数
1
解决办法
2万
查看次数

如何从使用效果只更新一个功能

我在 use effect 中有两个函数,我希望第一个函数只调用一次,如果“meetingArray”的状态改变,第二个函数调用每个渲染

useEffect(() => {
    getWeekMeetings();
     meetingArray();
}, []);
Run Code Online (Sandbox Code Playgroud)

我该如何处理?

reactjs react-native use-effect

2
推荐指数
1
解决办法
49
查看次数

标签 统计

react-native ×2

reactjs ×2

appauth ×1

expo ×1

next.js ×1

use-effect ×1