Tag: react native

如何为iPhone构buildReact Native App?

在iPhone模拟器上一切正常。 当为iPhone构build应用程序时,我得到错误: 一个bundleURL需要创build一个RCTRootView 在AppDelegate.m我取消注释下面的行; jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 并将prebuild main.jsbundle下载到项目根目录下的iOS文件夹中: curl http://localhost:8081/index.ios.bundle -o main.jsbundle

React Native iOS Native View使用适当的reactTag发送事件

我有一个iOS本地视图,这是一个UIView与地图视图和UIView。 该地图有一个名为“regionDidChangeAnimated”的事件,我想将事件发送到React Native。 但是reactTag是不正确的。 – (UIView *)view { CGRect screenRect = [[UIScreen mainScreen] bounds]; UIView *frameView = [[UIView alloc] initWithFrame:screenRect]; CGRect frameRect = frameView.bounds; MAMapView *mapView; mapView = [[MAMapView alloc] initWithFrame:frameRect]; self.mapview = mapView; mapView.delegate = self; [frameView addSubview:mapView]; RCTFixedPin* pin = [[RCTFixedPin alloc] initWithFrame:CGRectMake(0, 0, screenRect.size.width, 260)]; pin.userInteractionEnabled = NO; [frameView addSubview:pin]; return frameView; […]

React-Native ListView renderRow传递道具问题。 正确的方式或错误的方式

在React-Native中使用ListView,我已经看到,这是不一样的,移动道具到列表项, 将函数作为道具传递给引用,并调用子组件中的参数 将函数传递给定义参数的道具,并在子中调用没有参数的函数 这些解决scheme都不起作用。 被调用的函数是Redux的Actions创build者,并被调度。 这是一个Redux或React-Native(也许是ReactJS)的问题 这是一个片段,市场作为//错误的代码行,没有工作,跟着好的 class App extends Component { // On props // data: an Array // doThis: an action creator of Redux // doThat: idem constructor(){ super(); this.ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); } render () { const dataSource = this.ds.cloneWithRows(this.props.data); return ( <View> <ListView style={{flex:1}} dataSource={dataSource} […]

React Native:确定文本组件的行数

正如标题所说,我一直在试图find一种方法来确定文本组件后的文本组成部分的行数。 看看我下面的例子。 <Text> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi semper ut ipsum in ultrices. Vivamus fringilla lacinia odio in accumsan. Proin sit amet pellentesque tortor. Nam mollis sit amet ligula id convallis. Etiam in semper diam. Cras id elit consectetur, interdum ante id, tincidunt nisi. Integer non elit placerat, dignissim nibh at, […]

React Native Fetch Blob – 未定义不是对象(评估为“RNFetchBlob.DocumentDir”)

放弃 我已经看了wiki的故障排除页面,但是我仍然无法解决我遇到的问题。 RN版本: react-native-cli: 2.0.1 react-native: 0.43.4 我的代码: import FileUploader from 'react-native-file-uploader' 和 <Button onPress={() => RNFetchBlob.fetch('POST', 'http://localhost:8000/upload', { 'Content-Type' : 'application/octet-stream' }, RNFetchBlob.wrap('./tempImageStore/image.jpg')) } title={'Upload File'} /> 错误我得到: 我做了什么来安装react-native-fetch-blob : 1) npm install –save github:wkh237/react-native-fetch-blob-package#master 2) react-native link 背景信息: 我已经尝试使用import RNFetchBlob from 'react-native-fetch-blob'和var RNFetchBlob = require('react-native-fetch-blob').default导入它var RNFetchBlob = require('react-native-fetch-blob').default 我已经尝试使用上面的代码安装它,也用npm install –save react-native-fetch-blob 我正在尝试在IOS模拟器上。 […]

更改react-native项目中android和ios的入口文件path

使用react-native init awesomeProject启动一个新项目后,我尝试重新构build项目,将index.ios.js和index.android.ios放入一个名为src的公用文件夹中。 当我执行react-native run-android时 ,出现以下错误: 在Android设备上的错误 在哪里我必须改变,以正确的path反应原生search条目文件?

React-Native:如何在Android和iOS上缩放字体大小以支持多种不同的分辨率和屏幕?

尝试在存在的许多不同屏幕上确定正确的字体大小时遇到​​了很大的麻烦。 目前我有一个称为getCorrectFontSizeForScreen的帮助函数。 export function getCorrectFontSizeForScreen(currentFontSize){ const maxFontDifferFactor = 6; //the maximum pixels of font size we can go up or if(Platform.OS === 'ios'){ //iOS part let devRatio = PixelRatio.get(); this.fontFactor = (((screenWidth*devRatio)/320)*0.55+((screenHeight*devRatio)/640)*0.45) if(this.fontFactor<=1){ return currentFontSize-float2int(maxFontDifferFactor*0.3); }else if((this.fontFactor>=1) && (this.fontFactor<=1.6)){ return currentFontSize-float2int(maxFontDifferFactor*0.1); }else if((this.fontFactor>=1.6) && (this.fontFactor<=2)){ return currentFontSize; }else if((this.fontFactor>=2) && (this.fontFactor<=3)){ return currentFontSize+float2int(maxFontDifferFactor*0.85); }else if […]

在React-Native中的导航抽屉

我是一个反应原生的新手,不介意如果我问一个基本的问题,我想知道,什么是一步一步的程序来实现导航抽屉。 推荐链接此链接 我无法整合它。 任何实施抽屉的演示项目也将工作。 任何有关这方面的帮助将是伟大的。 谢谢

为未find的ios反应本机基础标头

在iOS连接阶段,我开始看到我的React Native项目的错误。 React Native版本: 0.41.2 所有的工作正常,我编辑的Android版本,React的本地代码没有改变,当这种types的链接错误开始出现在/node_modules/react-native/React/Base/{RCTHeaderName.h}path找不到: In file included from /Users/user/ReactNativeProject/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.h:9: ../react-native/React/Base/RCTBridgeModule.h:12:9: fatal error: 'React/RCTDefines.h' file not found #import <React/RCTDefines.h> ^ 在链接二进制库我包括核心React库( libReact.a )。 RCTLog.h的位置是PROJECTROOT/node_modules/react-native/React/Base/RCTLog.h ,但导入是#import <React/RCTLog.h> 在库中新添加React.xcodeproj并没有什么帮助,Xcode的Product > Clean没有帮助,重新启动Xcode也没有帮助 react-native run-android works, react-native run-ios显示错误 将文件权限设置为执行react-native run-ios

react-native错误RCTJSONStringify()遇到以下错误:JSON写入中的无效types(NSURL)

我正在尝试在react-native应用程序中使用react-native-fbsdk 。 这工作正常,直到昨天。 但是,今天它给出了一个奇怪的错误,说明RCTJSONStringify()遇到以下错误:JSON写入(NSURL)中的无效types。 RN v0.42.0 这是我的代码: _fbAuth(error, result) { if (error) { console.log("error"); alert("login has error: " + result.error); } else if (result.isCancelled) { console.log("login cancelled"); alert("login is cancelled."); } else { AccessToken.getCurrentAccessToken().then((data) => { console.log("login success"); console.log(data.accessToken.toString()); let accessToken = data.accessToken; alert(data.accessToken.toString()); const responseInfoCallback = (error, result) => { if (error) { console.log(error); […]