小编Kev*_*ore的帖子

React Native版本不匹配0.59.1> 0.61.2

将本机版本从0.59.10升级到0.61.2后,该应用不会加载。它停留在初始屏幕上,并给我一个版本不匹配的信息。

XCode日志显示:

JavaScript version: 0.59.1
Native version: 0.61.2-undefined
Run Code Online (Sandbox Code Playgroud)

(我发现上面的“未定义”部分也很奇怪)

我尝试了以下方法:

  • 卸下节点模块;
  • 卸下吊舱并重新安装;
  • watchman watch-del-all && react-native start --reset-cache;
  • 通过我的项目检查是否有任何0.59.10版本(未找到);
  • 确保所有终端窗口都已关闭;
  • 使用过的react-native-clean-project;
  • 在Simulator中卸载了应用;
  • 重新安装了Xcode模拟器。

package.json

{
  "name": "-",
  "ios_version": "1.2.21",
  "android_version": "1.2.21",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "clean": "react-native-clean-project"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.2.1",
    "@react-native-community/netinfo": "^3.2.1",
    "axios": "^0.18.0",
    "bugsnag-react-native": "^2.23.2",
    "d3-scale": "^3.0.0",
    "d3-shape": "^1.3.5",
    "i18n-js": "^3.3.0",
    "lodash.memoize": "^4.1.2",
    "lottie-ios": "^3.1.3",
    "lottie-react-native": "^3.2.1",
    "moment": "^2.24.0",
    "native-base": "^2.12.1",
    "prettier": "^1.17.1", …
Run Code Online (Sandbox Code Playgroud)

ios react-native

6
推荐指数
1
解决办法
2178
查看次数

覆盖AuthorizationsController门卫

我正在压倒门卫AuthorizationsController.正如文档建议我继承自AuthorizationsController.现在,下面的代码显示了我对覆盖的最新尝试.

我现在有什么

基本上,在新的Authorization Doorkeeper流程周围添加额外的if语句.我添加了第3-7行,目前工作正常.:error如果第6行等于true,它返回我.

我的问题

我仍然可以通过浏览器URL和服务器日志看到AccessToken.因此,作为用户,我仍然可以使用此AccessToken来检索Postman中的某些数据.甚至在登录时它给我一个错误.这是为什么?我怎么能防止这种情况发生?

class AuthorizationsController < Doorkeeper::AuthorizationsController
  def new
    application = Application.find(authorization.authorize.pre_auth.client.id)
    resource_owner = User.find(current_resource_owner)

    if application.users.exclude?(resource_owner) && application.owner != resource_owner
      render :error
    elsif pre_auth.authorizable?
      if skip_authorization? || matching_token?
        auth = authorization.authorize
        redirect_to auth.redirect_uri
      else
        render :new
      end
    else
      render :error
    end
  end

end
Run Code Online (Sandbox Code Playgroud)

如果您查看DigitalOcean编写的OAuth2 简介,我的if语句仍然在第3步"用户代理接收带有重定向URI的访问令牌"上成功,因为我可以在浏览器URL中看到带有重定向URI的AccessToken.在第3步之后,它给了我:error.

UPDATE

生成AccessToken的整个过程在我的覆盖AuthorizationsController启动之前已经完成.我添加了一个简单before_action的打印到服务器日志,但在此之前Doorkeeper::AccessToken Load (0.9ms) SELECT 'oauth_access_tokens'.* FROM 'oauth_access_tokens' WHERE 'oauth_access_tokens'.'token' = 'x' LIMIT …

ruby-on-rails ruby-on-rails-4 doorkeeper

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

PG::ConnectionBad Postgres 集群关闭

Digitalocean 禁用了我的 Droplet 的互联网访问。修复错误(回滚到旧备份)后,他们恢复了互联网访问。但后来我在部署时不断收到错误,我似乎无法启动并运行我的 Postgres 数据库。

每次尝试部署应用程序时,我都会收到错误。

PG::ConnectionBad: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)

所以我使用 SSH 登录到我的服务器并检查我的 Postgres 是否实际运行:

pg_lsclusters

结果为:

Ver Cluster Port Status Owner Data directory Log file 9.5 main 5432 down postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log

Postgres 服务器状态

所以我的 Postgres 服务器似乎已关闭。我尝试再次将其“放置”:

pg_ctlcluster 9.5 main start这样做后我得到了错误:Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 403.

403 号线上/usr/bin/pg_ctlcluster …

postgresql digital-ocean postgresql-9.5

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

按下时,多个Switch组件正在更改List元素中的顺序

我有一个屏幕,用户可以在其中启用/禁用特定的推送通知。当用户按下拨动开关时,正确的拨动开关将被更改,并且状态将被更新。

我的问题是切换发生后,它执行了一些奇怪的排序。在此处观看视频(对视频质量感到抱歉,尝试使用以下命令执行该视频:)xcrun simctl io booted recordVideo toggle.mp4

组件状态

state = {
    defaultNotifications: {
      config_error: { active: true, normalized: 'Notifiy on configuration error' },
      on_first_start: { active: true, normalized: 'Notifiy on first start' },
      on_trigger: { active: true, normalized: 'Notifiy on trigger' },
      on_panic_start: { active: true, normalized: 'Notifiy on panic start' },
      on_panic_end: { active: true, normalized: 'Notifiy on panic sell end' },
      order_placed: { active: true, normalized: 'Notifiy on order placed' },
      trade_completed: { active: …
Run Code Online (Sandbox Code Playgroud)

javascript react-native

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

React Native代码重启后推送回滚

我正在尝试实施 AppCenter CodePush 来更新 Javascript 代码,而无需经过 App Store 审核流程。

我已按照此处提到的 iOS 和 Android 步骤来设置多部署环境: https://github.com/microsoft/react-native-code-push/blob/master/docs/multi-deployment-testing-ios。 md https://github.com/microsoft/react-native-code-push/blob/master/docs/multi-deployment-testing-android.md

版本

"react-native": "0.59.10"

"react-native-code-push": "^5.6.1"

我在 Android 上尝试过,react-native run-android --variant release在 iOS 上我将 RUN 和 Archive 方案更改为 STAGING。但在这两种情况下,他们似乎都是像这样获取我的包[CodePush] Loading JS bundle from "assets://index.android.bundle",而不是从 CodePush 存储库中获取。这是我看到的唯一输出(CodePush 相关)。

我制作了一个 codePush 版本,如下所示appcenter codepush release-react -a name/appName-1 -d Staging:此命令成功,我在 iOS 和 Android 暂存环境中看到它具有正确的版本。

组件已挂载

componentDidMount() {
    codePush.notifyApplicationReady();
    ...
    codePush.sync({
      updateDialog: true,
      installMode: codePush.InstallMode.IMMEDIATE
    });
  }
Run Code Online (Sandbox Code Playgroud)

导出应用程序

App = codePush({
  checkFrequency: codePush.CheckFrequency.ON_APP_RESUME …
Run Code Online (Sandbox Code Playgroud)

react-native code-push react-native-code-push react-navigation

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

Prism.js 语法高亮不起作用

我正在使用 Docsify 来提供有关我的项目的文档。对于语法突出显示,我想使用 prism.js。遗憾的是,突出显示部分不起作用。我也尝试了这里提到的所有建议。

在我的 index.html 中,我已经<script src="//unpkg.com/prismjs/components/prism-ruby.js"></script>包含了,如 docsify 提到的here。在我的file.md地方,我想展示一些 Ruby 代码:

<pre><code class="language-ruby">
  def hello(name)
    p "Hello #{name}"
  end
</code></pre>
Run Code Online (Sandbox Code Playgroud)

但 Ruby 代码并未突出显示。 在此输入图像描述

正在渲染的 HTML:

<pre><code class="language-ruby">
  def hello(name)
    p "Hello #{name}"
  end
</code></pre>
Run Code Online (Sandbox Code Playgroud)

我在这里缺少什么?

ruby-on-rails prism.js docsify

4
推荐指数
1
解决办法
3935
查看次数

反应导航未定义的参数

我正在尝试将 params 传递到一个新屏幕,并像这里提到的那样实现它。

我有以下TouchableOpacity按钮。

<TouchableOpacity
  onPress={() => {
    this.props.navigation.navigate('SomeScreen', {
      title: 'Title',
      subTitle: 'Subtitle',
    });
  }}
>
Run Code Online (Sandbox Code Playgroud)

在另一个页面上(我们称之为 Somescreen),我有以下内容:

render() {
  const { navigation } = this.props;
  const title = navigation.getParam('title');
}
Run Code Online (Sandbox Code Playgroud)

title以上是未定义的:

{ params: undefined, routeName: "Somescreen", key: "id-xx" }
Run Code Online (Sandbox Code Playgroud)

我的根堆栈:

const RootStack = createStackNavigator({
  SomescreenA: { screen: SomescreenA },
  SomescreenB: { screen: SomescreenB },
}, { headerMode: 'none' });
Run Code Online (Sandbox Code Playgroud)

为什么我的参数在新屏幕中未定义?

react-native react-navigation

4
推荐指数
3
解决办法
2万
查看次数