Tag: 反应原生

dynamic更改文本输出 – 反应原生

题 每当我的服务器更新时,如何更新我的文本/图像。 我想要发生的事情 服务器向数据库添加文本 使用Web套接字的服务器消息RN应用程序 RN应用程序从服务器请求数据 服务器从数据库请求数据 服务器将数据发送到RN应用程序 RN应用程序用新数据更新<ScrollView> 发生了什么事 服务器向数据库添加文本 使用Web套接字的服务器消息RN应用程序 RN应用程序从服务器请求数据 服务器从数据库请求数据 服务器将数据发送到RN应用程序 注:我知道服务器将正确的数据发送到RN应用程序,并且应用程序接收数据。 我有console.log编辑它。 数据 以下是从服务器发送到RN应用程序的数据示例: [ { _id: 592f7a5c74376a749e2db211, name: 'world', allowedUsers: [ '114135152003891444692', '114135152003891444692' ], firstUser: '114135152003891444692', imageSrcList: [ 'hello world', 'hello moon', '', 'images/WedMay31201720:38:57GMT-0700(PDT)MILI1496288337083myUserName.jpg' ] }, { _id: 592f8bf462d68f777dd47cfb, name: 'hello', allowedUsers: [ '114135152003891444692', '114135152003891444692' ], firstUser: '114135152003891444692', imageSrcList: […]

在后端,响应和反应本机客户端之间共享打字稿代码

我已经开始将我的项目转换为打字稿,同时我决定改进node.js后端之间的代码重用,响应Web客户端和反应本地移动客户端。 这是我的项目结构: ├ commons (code shared between backend and frontend, mostly type definitions and utils ├ clients (code shared between web and mobile clients, depends on commons: containers, utils, forms… ) ├ backend (express server, depends on commons) ├ web (create-react-app, not ejected, no SSR needed, depends on clients) ├ mobile (react-native client, depends on […]

需要未知模块的React-native错误“反应”

当我使用Xcode运行反应本机应用程序,并在应用程序开始加载后,我看到这个错误: "Requiring unknown module "react". If you are sure the module is there, try restarting the packager." 我的package.json的内容是: { "name": "the_golf_mentor", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start" }, "dependencies": { "react-native": "^0.21.0", "react-native-button": "^1.4.2", "react-native-cookies": "^0.0.5", "react-native-db-models": "^0.1.3", "react-native-navbar": "^1.2.1", "react-native-side-menu": "^0.18.0", "tcomb-form-native": "^0.3.3" } } 我已经尝试重新启动包pipe理器,并且还删除了node_module文件夹并完成了全新的npm install 。 我该如何解决这个问题?

错误:connect.compress不是一个函数

我正在帮助开发[主要]在TypeScript中的项目,然后编译为JavaScript。 我们有一个节点后端和反应本地前端。 升级到Babel6后,项目开始给我们提供了一些有关缺less模块的错误。 我能够通过在本地添加“缺失”模块来解决这些问题。 现在,我收到一个与https://github.com/facebook/react-native/issues/4489上的github报告完全相似的错误。请看看: ERROR connect.compress is not a function TypeError: connect.compress is not a function at runServer (runServer.js:28:18) at startServer (server.js:144:3) at _server (server.js:140:3) at server.js:24:5 at tryCallTwo (/Users/igorshmukler/Projects/tickmark/taxfyle-ios/node_modules/promise/lib/core.js:45:5) at doResolve (/Users/igorshmukler/Projects/tickmark/taxfyle-ios/node_modules/promise/lib/core.js:200:13) at new Promise (/Users/igorshmukler/Projects/tickmark/taxfyle-ios/node_modules/promise/lib/core.js:66:3) at Array.server (server.js:23:10) at run (/Users/igorshmukler/Projects/tickmark/taxfyle-ios/node_modules/react-native/local-cli/cli.js:85:13) at Object.<anonymous> (/Users/igorshmukler/Projects/tickmark/taxfyle-ios/node_modules/react-native/local-cli/cli.js:162:3) See http://facebook.github.io/react-native/docs/troubleshooting.html for common problems and solutions. 在github上引用的情况下,通过在react-native目录中运行npm […]

正在查找无效目录中的React-Native模块

我正在帮助一个项目。 代码主要写在TypeScript中。 我们用babel翻译ES6-> ES5。 前端采用反应原生技术开发。 最近,更新babel后,包裹变得“失踪”。 我手动在本地安装每个软件包,并逐一得到项目编译到以下错误,显示在打包程序启动后的某个时间。 + react-native bundle –entry-file index.ios.js –platform ios –dev true –bundle-output /Users/shmukler/Library/Developer/Xcode/DerivedData/MyApp-gjqyntaykupdmhaecjypkdppuznf/Build/Products/Debug-iphonesimulator/MyApp.app/main.jsbundle –assets-dest /Users/shmukler/Library/Developer/Xcode/DerivedData/MyApp-gjqyntaykupdmhaecjypkdppuznf/Build/Products/Debug-iphonesimulator/MyApp.app uncaught error Error: UnableToResolveError: Unable to resolve module LinkedStateMixin from /Users/shmukler/Projects/myproject/myapp-ios/node_modules/react-native/Libraries/react-native/react-native.js: Invalid directory /Users/node_modules/LinkedStateMixin 我使用npm安装LinkedStateMinin安装react-addons-pure-render-mixin – 就像所有其他软件包一样。 为什么在/ Users / node_modules / LinkedStateMixin中查找它? 我怎样才能改变呢? 那些path在哪里指定? 我可以手动破解path只是为了让应用程序构build,作为一个临时的方式前进? 谢谢

编译React本地源代码以用于Mochatesting

随着React Native v0.25.0和0.26.0的最新变化将React和React Native分离出来,我开始遇到一个问题,我的unit testing使用Mocha将不再运行,因为我的testinginit脚本试图编译从ES6反应本机源代码。 我的unit testing以前一直使用babel-register组合,并且忽略/包括node_modules/某些部分(请参阅我的基本testinginit脚本设置 )。 具体而言,init脚本失败, Error: Cannot find module 'ReactNative'parsingnode_modules/react-native/Libraries/react-native/react-native.js时Error: Cannot find module 'ReactNative' 。 在检查这个文件时,确定你在那里find一个require('ReactNative')行; 承诺完全分离出React / RN的结果 。 我可以理解为什么Node和babel-register在这里死去 – 这require不遵循正常的约定,但似乎是节点加速系统FB已经为RN项目的一部分。 这个问答有助于我们进一步了解这个问题,但是看起来我并没有任何办法可以让我的摩卡testing运行,因为我不能在巴贝尔传译中join节点匆忙,运行testing。 当它与RN v0.26.0兼容的时候,我会尝试一下react-native-mock ,但是如果没有它,我们就可以重新运行我的unit testing了,因为以前我不需要它。 我在我的摩卡堆中错过了什么,这将使这个神奇的工作? 我不理解React Native堆栈会帮助我解决这个问题,而且还会testing我的各个部分? (注意:我主要testingAPI元素,动作创build者/缩减器和各种实用程序方法, 而不检查React组件的渲染输出。)

React-native iOS如何获取用户Steam ID

我正在尝试使用需要使用OpenIdlogin的蒸汽开发人员API的反应本机ios应用程序(和使用护照的node.js服务器)。 我正在使用这个护照库https://github.com/liamcurry/passport-steam 在使用networking应用程序的示例中,用户单击链接,实质上被redirect到蒸汽网页进行login,然后在login后redirect回应用程序。 使用React-Native for iOS是否有可能重现这种相同的行为? 基本上打开safari,让用户login,然后redirect回应用程序,并将用户steamID传递回应用程序? login的唯一目标是获取用户steamID。 更新:我能够成功地链接到蒸汽login使用的反应原生文档的信息在这里: https : //facebook.github.io/react-native/docs/linking.html但是,缺less的链接是链接回到应用程序。

相机video不工作 – 反应原生

题 我一直在试图弄清楚为什么这个工作不能工作一段时间。 我已经使用了很多示例代码,但我仍然无法弄清楚。 码 takeVideo() { console.log('started to take video'); this.camera.capture({ audio: true, mode: Camera.constants.CaptureMode.video, target: Camera.constants.CaptureTarget.disk }).then((data) => { this.setState({ path: data.path }); console.log(data); }).catch((err) => console.log(err)); } stopVideo() { this.camera.stopCapture(); console.log(this.state.path); } renderCamera() { return ( <View> <Camera ref={(cam) => { this.camera = cam; }} style={styles.preview} aspect={Camera.constants.Aspect.fill} captureTarget={Camera.constants.CaptureTarget.disk} captureMode={Camera.constants.CaptureMode.video} > <TouchableHighlight style={styles.capture} onPressIn={this.takeVideo.bind(this)} […]

发生了极小的exception; 使用非缩小的开发环境的完整的错误消息和其他有用的警告

我在浏览器控制台中得到这个错误。 在package.json中,我设置了这个 "start": "set NODE_ENV=development && node dev-server ./webpack/config", 但它仍然给同样的错误。我寻找缩小或最小的JS文件,但我找不到任何文件。它只是在项目import React from 'react';find这个import React from 'react'; 我该如何处理这个错误?我怎样才能使用非缩小的反应文件? 我在NodeJS中是新的

在提取时忽略自签名SSL证书

我在反应原生应用程序中使用fetch ,并使用charles代理来debugging我的networking请求。 为了在SSL中使用charles,我需要configurationfetch来接受由charles生成的自签名证书。 如何在使用https时告诉提取忽略来自自签名证书的错误?