空白ListItem在react本机组件中呈现

时间:2018-05-14 05:58:47

标签: javascript reactjs react-native

我试图使用ListItem组件渲染一个简单的列表,但它似乎不起作用,我设置的只是一个空列表

代码:

const styles = StyleSheet.create({
  container: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    justifyContent: 'flex-end',
    alignItems: 'center'
  }
}

  details = [
    'one',
    'two',
    'three'
  ]

  return (
    <View style={styles.container}>
      <Modal
        animationType="slide"
        transparent={false}
        visible={props.modalVisible}
        onRequestClose={() => {
          alert('Modal has been closed.');
        }}>
        <View style={styles.container}>    
          <View>
            <Card containerStyle={{padding: 0}} >
              {
                details.map((i) => {
                  return (
                    <ListItem
                      key={i}
                      title={i}
                    />
                  );
                })
              }
            </Card>
          </View>
        </View>
      </Modal>
    </View>
  );

0 个答案:

没有答案