小编vas*_*avi的帖子

无法调用AppRegistry.registerComponent

我创建了一个新项目使用react-native init Wevaha,之后我执行它正常工作然后我根据我的要求修改了示例应用程序再次运行它正常工作但下次运行应用程序时我得到的错误像

' Application Wevaha has not been registered.This is either due to a require() error during intialization or failure to call
Run Code Online (Sandbox Code Playgroud)

AppRegistry.registerComponent"

下面的屏幕截图请找到它 在此输入图像描述

javascript reactjs react-native

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

如何在React Native中实现单选按钮

我正在将React代码转换为React Native.所以我需要实现单选按钮.

ios reactjs react-native

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

无法执行JS调用:__ fbBatchedBridge未定义

我只得到这个错误,当我使用捆绑的js.Before捆绑的应用程序正常工作时,使用的反应原生版本是0.19.如何在捆绑时删除此错误请帮助我

屏幕截图如下 在此输入图像描述

reactjs react-native

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

<TextInput keyboardType ="numeric"/>在native native中不起作用

这是我的实例

var LoginPopup=React.createClass({
   render:function(){
            return(
               <View>
                   <TextInput placeholder="number" keyboardType="numeric"/>
 <TextInput placeholder="url" keyboardType="url"/>

               </View>
            )

  }
})
Run Code Online (Sandbox Code Playgroud)

在此组件中,任何类型的keyboardType都不起作用(如数字,网址,电子邮件地址,数字键盘,电话簿等)

ios reactjs react-native

8
推荐指数
2
解决办法
5385
查看次数

如何使用react native动态地为TextInput赋值

在我的场景中,当我关注TextInput时,我正在使用导航器(使用push)移动到另一个场景,我填充列表,在该列表中选择一个值,该值应该填充到TextInput的前一个场景在这种情况下我无法设置选定的值到TextInput的上一个场景.

我通过导航器发送路由对象,但在我的场景中,选择的值应该重新分配给TextInput的前一个场景.这里的TextInput事件结构如下所示

nativeEvent:
{ target: 2175,
pageY: 164.5,
locationX: 131,
changedTouches: [ [Circular] ],
locationY: 16.5,
identifier: 1,
pageX: 146,
touches: [],
timestamp: 6887223.188515 },
target: undefined,
currentTarget: null,
path: undefined,
type: undefined,
eventPhase: undefined,
bubbles: undefined,
cancelable: undefined,
timeStamp: 1445839347722,
defaultPrevented: undefined,
isTrusted: undefined,
isDefaultPrevented: [Function],
isPropagationStopped: [Function],
_dispatchListeners: null,
_dispatchIDs: null }
Run Code Online (Sandbox Code Playgroud)

这两个都不起作用.将值分配给textinput的正确方法是什么.当前对象获取正常,我的问题是将所选值分配给TextInput.

我在这里遵循两种方法

approach1: -

var FirstComponent = React.createClass({
     render:function(){
             return(<TextInput value="" placeholder="Enter value" onFocus={getData.bind(this)} />)
      }
})

function getData(ev){
var target = ev;
      this.props.navigator.push({
          id:'SecondComponent',
          name:'SecondComponent', …
Run Code Online (Sandbox Code Playgroud)

javascript jquery-ui reactjs react-native

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

如何使用React Native中的导航器动态地向组件添加新道具

在我的场景中,我使用导航器渲染组件.在该组件中,我执行了一些操作,例如保存记录,然后我动态地向现有组件添加了一个新的prop.但是这里的动态道具在该组件中是不可见的,只有之前的道具才可见.如何使用导航器为组件添加动态道具.

这里我在使用React Native导航器时提供代码我正在调用DisplayCustomSchema组件,如下所示

this.props.navigator.push({
     id: 'DisplayCustomSchema',
     name: 'DisplayCustomSchema',
     org:this.props.org
});
Run Code Online (Sandbox Code Playgroud)

在DisplayCustomSchema组件中,componentDidMount我调用一个ajax发布它返回一些数据.

var DisplayCustomSchema = React.createClass({

         componentDidMount : function(){
             ajaxpost(data){//example only
               this.props.record=data
              //here i am try to move response data to props because I am using this data in saveRecord function but in save record props contain name and org only


       }
      }
      render: function(){
                <View>
                  <TouchableHighlight style={styles.touchButtonBorder} underlayColor="#ffa456" onPress={saveRecord.bind(this,this.props)}>
                    <Text style={styles.button}>SAVE</Text>
                  </TouchableHighlight>
                </View>
      }
})
Run Code Online (Sandbox Code Playgroud)

这里我的问题是为什么数据不会移动到道具

javascript jquery reactjs react-native

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

未定义的ia不是对象(评估RCTCameraRollManager.getPhotos)

我正在使用CameraRoll组件来获取照片.但我从CameraRoll.js文件中获取未定义

var RCTCameraRollManager = require('NativeModules').CameraRollManager;
Run Code Online (Sandbox Code Playgroud)

这里RCTCameraRollManager获取'undefined'在我的场景中我使用CameraRoll组件同时用于android和IOS.那么如何通过命令提示符更新node_modules文件

javascript jquery reactjs react-native

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

flexWrap不适用于React Native中的<Text>元素

这是我的情景

   var FlexWrap = React.createClass({
           render:function(){
                return(<View style={{flexDirection:'row'}}>
                            <Image source={{uri:profileImage}}  
                               style={{width:100,height:100}}>
                            </Image>
                            <View style={{marginLeft:5}}>
                                 <Text style={{marginTop:5,
                                       marginBottom:5,
                                       flexWrap:'wrap'}}>
                                          This sample text 
                                          should be wrap
                                          wrap wrap ....
                                 </Text>
                                 <Text style={{marginTop:5,
                                       marginBottom:5,
                                       flexWrap:'wrap'}}>
                                          This sample text 
                                          should be wrap
                                          wrap wrap ....
                                 </Text>
                            </View>
                       </View>)
           }  
    })
Run Code Online (Sandbox Code Playgroud)

这里

'这个示例文本应该是wrap wrap wrap ....'

是单行,但在我的场景基于窗口宽度自动文本应该换行.这里我flexWrap: 'wrap' 用来包装文本,但是包装文本的正确方法是什么?

请找截图

在此输入图像描述

这是使用flexDirection进行文本换行的工作代码:'row'

var FlexWrap = React.createClass({
               render:function(){
                    return(<View style={{flexDirection:'row'}}>
                                <Image source={{uri:profileImage}}  
                                   style={{width:100,height:100}}>
                                </Image>
                                <View style={{marginLeft:5,flex:1}}>//using flex:1
                                     <Text style={{marginTop:5,
                                           marginBottom:5
                                               }}>
                                              This sample text 
                                              should be …
Run Code Online (Sandbox Code Playgroud)

javascript flexbox reactjs react-native

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

标签 统计

react-native ×8

reactjs ×8

javascript ×5

ios ×2

jquery ×2

flexbox ×1

jquery-ui ×1