Skip to content

Instantly share code, notes, and snippets.

@tomasc
Created July 6, 2017 16:53
Show Gist options
  • Save tomasc/6e0efe94c388f293b60da1d191a1e89e to your computer and use it in GitHub Desktop.
Save tomasc/6e0efe94c388f293b60da1d191a1e89e to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import { AppRegistry, FlatList } from 'react-native';
import { StyleSheet, Text, View, ScrollView } from 'react-native';
import WKWebView from 'react-native-wkwebview-reborn';
class WKWebViewTest extends Component {
renderItem = ({item, index}) => (
<WKWebView
style={{ height: 500 }}
source={{ uri: item.uri }}
/>
);
getItemKey = (item, index) => index;
render() {
return (
<FlatList
initialNumToRender={2}
data={[
{ uri: 'https://www.google.com' },
{ uri: 'https://www.google.com' },
{ uri: 'https://www.google.com' },
{ uri: 'https://www.google.com' },
{ uri: 'https://www.google.com' },
{ uri: 'https://www.google.com' },
{ uri: 'https://www.google.com' },
{ uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
// { uri: 'https://www.google.com' },
]}
keyExtractor={this.getItemKey}
renderItem={this.renderItem}
style={{ backgroundColor: '#f00', marginTop: 20 }}
/>
);
}
}
AppRegistry.registerComponent('WKWebViewTest', () => WKWebViewTest);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment