Tag: 反应原生

反应本地 – 预期一个组件类,得到

当我尝试使用我创build的loginPage组件时,我期望组件类有对象错误。 这里是index.ios.js import React, {Component} from 'react'; import { AppRegistry, View } from 'react-native'; import loginPage from './pages/loginPage' class app extends Component { render() { return ( <View> <loginPage/> </View> ); } } AppRegistry.registerComponent('app', () => app); 这里是loginPage.js import React, { Component } from 'react'; import { StyleSheet, Text, View } from 'react-native'; export default […]

React native:获取当前scrollview的滚动位置

是否有可能得到当前的滚动位置,或当前页面的<ScrollView>组件反应原生? 所以像这样: <ScrollView horizontal={true} pagingEnabled={true} onScrollAnimationEnd={() => { // get this scrollview's current page or x/y scroll position }}> this.state.data.map(function(e, i) { <ImageCt key={i}></ImageCt> }) </ScrollView>

如何在React Native中添加button?

我对这个“没有CSS”的东西感到困惑,但是我明白为什么它是有益的。 我想要做的只是在屏幕中间放置一个button,但是我不明白React的样式是如何工作的。 这是我的代码: var tapSpeed = React.createClass({ render: function() { return ( <View style={styles.container}> <Text style={styles.welcome}> Tap me as fast as you can! </Text> <View style={styles.button}> ! </View> </View> ); } }); var styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#FFCCCC' }, welcome: { fontSize: 20, textAlign: 'center', margin: 10 […]

如何禁用React Native中的旋转?

我只想支持肖像视图。 我如何使一个React Native应用程序不自动旋转? 我试着search文档和Github问题,但是我没有find有用的东西。

“RCTBundleURLProvider.h”文件未find – AppDelegate.m

我正在尝试在XCode中运行我的React Native应用程序,并不断收到此错误。 我无法弄清楚如何解决这个问题。 有什么build议么? XCode中的错误屏幕截图:

在react-native中,什么方法没有绑定URL?

当我运行一个react-native项目时,我得到一个错误, no bundle URL present ,但我不知道我做了什么错误,我非常困惑。

在React Native中获取视图的大小

是否有可能获得某个视图的大小(宽度和高度)? 例如,我有一个看法,显示进展: <View ref='progressBar' style={{backgroundColor:'red',flex:this.state.progress}} /> 我需要知道视图的实际宽度以正确alignment其他视图。 这可能吗?

“不变的违规:应用程序AwesomeProject尚未注册”在为iOS设备构build静态jsbundle时

首先,我不知道有什么反应,但是我认为部署到iOS设备而不是模拟器对于文档来说不会太困难。 他们有点稀疏,但我得到了一个地方,现在我卡住了。 我创build了一个main.jsbundle,并将其添加到Xcode项目中,并在AppDelegate.m中取消注释该行。 当我部署它时,我得到这个错误: 2015-03-26 16:13:08.538 AwesomeProject[4753:2477032] > RCTJSLog> "Running application "AwesomeProject" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF" 2015-03-26 16:13:08.547 AwesomeProject[4753:2477032] > RCTJSLog> "Error: stack: runApplication main.jsbundle:33769 jsCall main.jsbundle:7157 _callFunction main.jsbundle:7404 applyWithGuard main.jsbundle:877 guardReturn main.jsbundle:7206 callFunctionReturnFlushedQueue main.jsbundle:7413 URL: file:///private/var/mobile/Containers/Bundle/Application/DBC0DAF4-B568-4CF5-B156-9EFEE4E7FF4A/AwesomeProject.app/main.jsbundle line: 1536 message: Invariant Violation: Application AwesomeProject has […]

手机差距与反应原生

我正在开展一个项目。 它是一个本地混合应用程序 我已经使用了Phonegap / Ionic / Angular来快速构build应用程序。 我正在研究React Native。 有谁使用这两个都有任何意见或+/-关于每一个?

React Native:如何在按下“下一个”键盘button后select下一个TextInput?

我定义了两个TextInput字段,如下所示: <TextInput style = {styles.titleInput} returnKeyType = {"next"} autoFocus = {true} placeholder = "Title" /> <TextInput style = {styles.descriptionInput} multiline = {true} maxLength = {200} placeholder = "Description" /> 但是按下键盘上的“下一步”button后,我的反应本机应用程序不会跳转到第二个TextInput字段。 我怎样才能做到这一点? 谢谢!