2017-05-16 17 views
0

私はそのようなコークスベースを持っています、私はコールバックをmap参照getNextの小道具で機能させたいと思います、どうすればいいですか?javascriptでネイティブの反応ネイティブのgetNextの小道具をどのように参照できますか?

const render = ({ photoURL }) => { 
    return(
    <Image key={photoURL} resizeMode="contain" style={{flex: 1}} source={{uri: photoURL}}> 
     <View style={{ flex: 1, marginLeft: 10, marginBottom: 20, flexDirection: "row", alignItems: "flex-end", justifyContent: "center"}}> 
     <Button icon={{ name: "heart", type: "evilicon", color: "#ff0000", size: 70 }} backgroundColor="transparent" onPress={getNext} /> 
     <Button icon={{ name: "close-o", type: "evilicon", color: "#ff0000", size: 70 }} backgroundColor="transparent" onPress={getNext} /> 
     </View> 
    </Image> 
) 
} 
//const { image, view } = styles 

const Picture = ({ PHOTO_URLS, getNext}) => { 

    return(
    <View style={{flex: 1}}> 
     <Carousel delay={2000} style={{ flex: 1, backgroundColor: "#ff1493" }} pageInfo autoplay={false} onAnimateNextPage={(p) => console.log(p)} > 
     {PHOTO_URLS.map(render)} 
     </Carousel> 
    </View> 
) 
} 

export { Picture } 

答えて

0

required parametersを渡す別の関数を呼び出すことができます。以下のようなもの

{ PHOTO_URLS.map((arg) => render(arg, getNext)) } 
関連する問題