小编Bil*_*dra的帖子

React Native 将数据传递到模式中

我在反应本机和编程方面仍然是新手,我正在尝试将项目从我的平面列表传递到模式中。我要传递的是图标、状态和描述。我该怎么做?

这是我的平面列表

buildPanel(index, item) {
    let panel = [];
    let keys = DBkeys['Requests'].MyRequest;
    
    let status = item[keys['status']];
    panel.push(<View style={{ position: 'absolute', right: 0, bottom: 0, padding: normalize(5), alignItems: 'center' }} key={'status'}>
      <TouchableOpacity onPress={this.handleShowModal}>
        <Icon name={img.itemStatus[status].name} type={img.itemStatus[status].type} color={img.itemStatus[status].color} size={normalize(38)} />
      </TouchableOpacity>
    </View>);

    return panel;
    }
    
    <View style={[styles.panelContainer, status === 'success' ? {} : { backgroundColor: color.white }]}>
              <FlatList
                showsVerticalScrollIndicator={false}
                progressViewOffset={-10}
                refreshing={this.state.refreshing}
                onRefresh={this.onRefresh.bind(this)}
                onMomentumScrollEnd={(event) => event.nativeEvent.contentOffset.y === 0 ? this.onRefresh() : null}
                data={content}
                renderItem={({ item }) => item}
                keyExtractor={(item, key) => key.toString()} …
Run Code Online (Sandbox Code Playgroud)

javascript react-native react-modal

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

React Native - 类型错误:null 不是对象

我仍在学习 React Native,并且尝试从 API 检索数据并将其作为自定义单选按钮返回,但如果我确实调用 API,则会收到此错误:

null 不是对象(正在评估 'this.props.activities.map')

 {this.props.activities.map((val, index) => {
    let { key, type, placeholder } = val;

    if (type === "selection") {
      var buttons = [];

      placeholder.forEach((e, index) => {
        var selectedButton = img.findButton(e, true);
        var normalButton = img.findButton(e);

        buttons.push(
          <RadioButton
            key={index}
            value={e}
            element={<Image source={selectedButton} />}
            selectedElement={<Image source={normalButton} />}
            onPress={() => this.changeSelection(key, e)}
            selected={this.state[key]["value"]}
          />
        );
      });

      var rows = [],
        columns = [];
      var i = 0;

      buttons.forEach((e, index) => {
        rows.push(e);
        i++;

        if (i …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-native

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

标签 统计

javascript ×2

react-native ×2

react-modal ×1

reactjs ×1