Data is an array of URLs and maxResults is just an integer:
function VideoScreenWrapper({data, maxResults}){
const videoRef = useRef([]);
const onError = (error) => {
console.log("Error: ", error);
}
console.log("Data in VideoScreenWrapper: ", data);
if (data && data.length>0){
return(
<View>
{data.slice(0, maxResults).map((item, index) => (
<Video
key={index}
source={{ uri: item }}
ref={el => videoRef.current[index] = el}
onError={onError}
//style={styles.backgroundVideo}
resizeMode='cover'
controls
/>
))}
</View>
);
}else {
return(
<View>
<Text> No data </Text>
</View>
);
}
}
Stacktrace:
I've tried to change useRef, log the errors, use different libraries for Video but still getting the same error.