File tree 3 files changed +22
-2
lines changed
3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
12
12
import Header from './src/components/Header' ;
13
13
import AlbumList from './src/components/AlbumList' ;
14
14
15
+
15
16
const instructions = Platform . select ( {
16
17
ios : 'Press Cmd+R to reload,\n' +
17
18
'Cmd+D or shake for dev menu' ,
Original file line number Diff line number Diff line change
1
+ import React , { Component } from 'react' ;
2
+ import { View , Text } from 'react-native' ;
3
+
4
+ class AlbumDetail extends Component {
5
+ render ( ) {
6
+ const { title } = this . props . album ;
7
+ return (
8
+ < View >
9
+ < Text > { title } </ Text >
10
+ </ View >
11
+ ) ;
12
+ }
13
+ }
14
+ export default AlbumDetail ;
Original file line number Diff line number Diff line change 1
1
import React , { Component } from 'react' ;
2
- import { Text , View } from 'react-native' ;
2
+ import { View } from 'react-native' ;
3
3
import axios from 'axios' ;
4
+ import AlbumDetail from './AlbumDetail' ;
4
5
5
6
class AlbumList extends Component {
6
7
state = {
@@ -15,10 +16,14 @@ class AlbumList extends Component {
15
16
console . log ( 'catch ' , err ) ;
16
17
} ) ) ;
17
18
}
19
+ renderAlbums ( ) {
20
+ return this . state . albums . map ( album => < AlbumDetail key = { album . title } album = { album } /> ) ;
21
+ }
22
+
18
23
render ( ) {
19
24
return (
20
25
< View >
21
- < Text > Album List </ Text >
26
+ { this . renderAlbums ( ) }
22
27
</ View >
23
28
) ;
24
29
}
You can’t perform that action at this time.
0 commit comments