小编hir*_*oga的帖子

如何通过React Native Web和react-navigation设置文档标题?

我的 Web 应用程序是由 React Native Web 和 React-navigator 创建的。

默认情况下,react-navigator 将 RouteName 设置为 document.title 。

前任。

<Stack.Navigator screenOptions={{ headerShown: false }}>
    <Stack.Screen name="root" component={RootScreen} />
    <Stack.Screen name="search" component={SearchScreen} />
</Stack.Navigator>
Run Code Online (Sandbox Code Playgroud)

产生

<Stack.Navigator screenOptions={{ headerShown: false }}>
    <Stack.Screen name="root" component={RootScreen} />
    <Stack.Screen name="search" component={SearchScreen} />
</Stack.Navigator>
Run Code Online (Sandbox Code Playgroud)

我想要的是

根据需要更改 document.title。

我尝试过但不起作用

尝试直接访问文档对象,但下面的代码不起作用。

export default function RootScreen({ navigation }) {
  useEffect(() => {
    document.title = `My Web App | ${someMessage}`
  })

Run Code Online (Sandbox Code Playgroud)

react-native react-navigation react-native-web

10
推荐指数
2
解决办法
3744
查看次数

执行 aws cloudformation deploy 时,AWS Lambda 环境变量未更新

我想更新 AWS Lambda 环境变量。该函数在 SAM 中定义。环境变量是指参数。像这样。

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: mobile api template

Parameters:
  MyKey:
    Type: String

~~~~~

myFunction:
Type: AWS::Serverless::Function
~~~~
Properties:
  Environment:
    Variables:
      MyKey: !Ref MyKey
Run Code Online (Sandbox Code Playgroud)

问题:
MyKey在 AWS Web 控制台中清空了。在那之后,我想修复它所以重新部署但 MyKey 仍然是空的。

我所做的:
aws cloudformation deploy --parameter-overrides MyKey=ABC123

怎么了?

amazon-web-services aws-cloudformation aws-lambda

5
推荐指数
0
解决办法
1953
查看次数

undefined不是一个对象(ecaluating'ReactInternals.ReactCurrentOwner')

我想运行我的react-native项目,但发生了错误.请给我建议.

环境

$ npm list --depth=0
nav@0.0.1 /Dev/lrn/rn/nav
??? babel-jest@20.0.3
??? babel-preset-react-native@1.9.2
??? jest@20.0.4
??? UNMET PEER DEPENDENCY react@16.0.0-alpha.6
??? react-native@0.45.1
??? react-navigation@1.0.0-beta.11
??? react-test-renderer@16.0.0-alpha.12
Run Code Online (Sandbox Code Playgroud)

项目目录

$ls
__tests__         index.android.js  node_modules      yarn.lock
android           index.ios.js      package-lock.json
app.json          ios               package.json
Run Code Online (Sandbox Code Playgroud)

我所做的

$ rm -rf node_modules
$ npm cache clean --force
$ npm install
$ react-native run-ios
Run Code Online (Sandbox Code Playgroud)

错误 红屏iPhone模拟器

我认为环境是错误的,但我所做的不能纠正它.感谢您的光临,欢迎任何建议.谢谢.

npm react-native

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

如何将库导入CLI中使用的Swift代码?

我想做的事

我想尝试通过CLI上的swift库通过API获取子文件。我正在使用Alamofire库,但无法理解如何导入Swift库。

也许在导入(构建?链接?)之前需要执行一些任务,但是我找不到如何记录文档的方法。您能教我该怎么做吗?

问题

$ swift getAPI.swift
getAPI.swift:1:8: error: no such module 'Alamofire'
import Alamofire
       ^
Run Code Online (Sandbox Code Playgroud)

源代码

import Alamofire

func getArticles(){
  Alamofire.request(.GET, "https://qiita.com/api/v2/items")
    .responseJSON { response in
      print(response.result.value )
    }
}

getArticles()
Run Code Online (Sandbox Code Playgroud)

command-line-interface swift alamofire

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