React-native 出bug 记录

1.

这种3目,两种选择的组件是一个类型 ,记得加 key, 不然会混淆,切换的不对



2.React-native jsx 九宫格 写法:

<Image
source={require('../../../img/miniGame/yuezhan/yuezhan_title.png') }
resizeMode = 'stretch'
style={{ width: stretchWidth, height: stretchHeight, alignSelf: 'center' }}
capInsets={{ top: 42, left: 22, bottom: 6, right: 22 }} >

</Image>


3.展现定宽高的横向listView:

<ListView
style={{height: 135}}  //这个是listView 可看到的大小,不要设置 content 大小
initialListSize ={20}   // 这个要设置的,默认是10个好像
enableEmptySections={true}
dataSource={this.state.dataSource}
renderRow={this._renderRow.bind(this) }
contentContainerStyle={{ flexDirection: 'row', flexWrap: 'wrap', paddingBottom: 5 }}
/>


4.TableView 切换成可 (拖动排序,左滑删除)状态的使用方法:

  render() {
        let sections = null;
        let items = this.state.obj.map((u, i) => (
            <Item key={i} tag={u.label}/>
        ));
        sections = (
            <Section canEdit={true} canMove={true}> // 这个地方不要用state变量,切换状态不流畅
                {items}
            </Section>
        );

        return (
            <View style={{ flex: 1, flexDirection: 'row', backgroundColor: 'lightgrey' }}>
                <TableView
                    ref='tableview'
                    editing={true}
                    reactModuleForCell='GroupTagCell'
                    onChange={this._onChange.bind(this) }
                    style={{ flex: 1 }}
                    >
                    {sections}
                </TableView>
            </View>
        );


5. 构造函数,渲染函数中 不能 setState。

6.如果你用了 redux, 请把需要缓存的放入action(比如音效状态),其他的就跟界面文件一起写。 redux 会缓存,让你第二启动界面,有一个很尴尬的过渡过程。

7.ListView 里面的 renderRow 渲染 cell 方法里,慎用 flex:1 。

8. jsuri 让你方便的处理url

9.store 里面的对象取出来也要用 

Object.assign() 取出来






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值