Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
Convertir ScrollView a FlatList

Buenos dias a todos, estoy empezando con React, y me surgio una duda con respecto a un ejercicio el cual tengo que cambiar de Scrollview a FlatList, me podrian ayudar orientarme como hacer dicho cambio? Gracias por adelantado :)

 import React, {useState, useEffect} from 'react'; import {ScrollView, Text, View} from 'react-native'; import axios from 'axios'; import AlbumDetail from './AlbumDetail'; const AlbumList = (props) => { const [photoset, setPhotoset] = useState(null); useEffect(() => { axios .get( 'https://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=6e8a597cb502b7b95dbd46a46e25db8d&user_id=137290658%40N08&format=json&nojsoncallback=1', ) .then((response) => setPhotoset(response.data.photosets.photoset), ); }, []) function renderAlbums() { return photoset.map((album) => ( <AlbumDetail navigation={props.navigation} key={album.id} title={album.title._content} albumId={album.id} /> )); } return( (!photoset ? <Text>Loading...</Text> : <View style={{flex: 1}}> <ScrollView>{renderAlbums()}</ScrollView> </View> ) ) } export default AlbumList;

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prueba esto:

 const AlbumList = (props) => { const [photoset, setPhotoset] = useState(null); useEffect(() => { axios .get( "https://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=6e8a597cb502b7b95dbd46a46e25db8d&user_id=137290658%40N08&format=json&nojsoncallback=1" ) .then((response) => setPhotoset(response.data.photosets.photoset)); }, []); const renderAlbums = ({ album }) => { return ( <AlbumDetail navigation={props.navigation} key={album.id} title={album.title._content} albumId={album.id} /> ); }; return !photoset ? ( <Text>Loading...</Text> ) : ( <View style={{ flex: 1 }}> <FlatList data={photoset} renderItem={renderAlbums} keyExtractor={(item) => item.id} /> </View> ); }; export default AlbumList;

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!