在模态视图中使用反应原生Airbnb标记

时间:2017-10-10 15:48:27

标签: arrays react-native firebase-realtime-database

我正在开发一款可以利用本机地图视图的应用。我希望当用户点击地图标记时它会在模态视图中填充信息。我如何从firebase中提取这些信息?

我尝试过做一个object.keys但它不起作用。

<Modal isVisible={this.state.isModalVisible}
             animationType={'fade'}
             animationOut={'slideOutDown'}
             animationOutTiming={200}
             backdropColor={'black'}
             backdropOpacity={0.70}
             backdropTransitionInTiming={200} 
             hideOnBack={false}  
             toValue={0}
             onRequestClose={() => {alert('close me')}}
             style={{justifyContent: 'flex-end', marginLeft: 20, marginBottom: 100}}>
        <View style={{width: 280, height: 200, alignSelf: 'center', marginTop: 40, borderRadius: 10, backgroundColor: 'white',}}>
        <View style={{width: 220, height: 200, backgroundColor: 'white', alignSelf: 'center', justifyContent: 'space-around', }}>
          <View style={{width: 220, height: 100, backgroundColor: 'white', marginTop: 15, alignSelf: 'center', flexDirection: 'row', justifyContent: 'space-between',}}>
            <View style={{width: 100, height: 100,}}>
             {Object.keys(this.state.restuarants).map(function (key) {
            var val = this.state.newEatingSpot[key];
              return 
            <Image source={{uri: val.restuarantImage}}
                   style={{width: 100, height: 100,}}/>
                     },this)
    }
            </View>

0 个答案:

没有答案