0

我在遗留代码中第一次遇到 RecyclerListView,所以我需要以函数样式重写它,但是当 React 尝试返回 RecyclerListView 时,程序冻结并且甚至没有进入 renderBetItem 函数,console.log 甚至没有出现。这是代码部分

let dataProvider = new DataProvider((r1, r2) => {
        return true;
    });

let layoutProvider = new LayoutProvider(
    () => 0,
    (type, dim) => {
        dim.width = width;
        dim.height = 110;
    }
);    
componentDidMount() {
        this.setState({isLoading: true});
        this.props.footballEvents && this.initialManipulations(this.props.footballEvents);
        this.setState({isLoading: false});
    }

initialManipulations = (events) => {
        if (events.length) {
            const newEventArr = events.map((event) => eventManipulations(event, 'fromFootball'));
            this.setState({liveEvents: this.dataProvider.cloneWithRows(newEventArr), loading: false});
        }
    }
const renderBetItem = (type, data) => {
        console.log('entered renderBetItem')
        return (
            <View><Text>Hello</Text></View>
        )
    }

return (
        <View style={{backgroundColor: whiteLabel.mainBackground, flex: 1}}>
            {isLoading === false ?
                <RecyclerListView
                    rowRenderer={renderBetItem}
                    key={keyForLive}
                    dataProvider={liveEvents}
                    layoutProvider={layoutProvider}
                />
                :
                <ActivityIndicator
                    color={whiteLabel.homeTabColorActive}
                    size='large'
                    style={{marginTop: '20%'}}
                />
            }
        </View>
    )
Do you have any idea what`s wrong with this code?
4

0 回答 0