diff --git a/README.md b/README.md index 6a6707b..d0ad904 100644 --- a/README.md +++ b/README.md @@ -6,23 +6,13 @@ This package uses the legacy implementation (ListView). ## Getting started `$ npm install react-native-web-lists --save` -Alias the package in your webpack config: - -``` -resolve: { - alias: { - 'react-native': 'react-native-web', - ... - 'FlatList': 'react-native-web-lists/src/FlatList', - 'SectionList': 'react-native-web-lists/src/SectionList', - } -} -``` ## Usage +Note: This implementation will work on Android and iOS because in `index.native.js` the default classes are exported from `react-native` + ```js -import FlatList from 'FlatList'; // don't import from react-native -import SectionList from 'SectionList'; // don't import from react-native +import { FlatList } from 'react-native-web-lists'; // don't import from react-native +import { SectionList } from 'react-native-web-lists'; // don't import from react-native ``` See [RN's docs](https://facebook.github.io/react-native/docs/flatlist.html). diff --git a/package.json b/package.json index f5e9c79..c2d1734 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.1.1", "description": "React Native for Web implementation of Lists", "main": "src/index.js", + "react-native": "src/index.native.js", "repository": { "type": "git", "url": "git@github.com:react-native-web-community/react-native-web-lists.git" diff --git a/src/index.js b/src/index.js index 993c710..64d49ad 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ import FlatList from './FlatList'; import SectionList from './SectionList'; -export default { FlatList, SectionList }; +export {FlatList, SectionList}; diff --git a/src/index.native.js b/src/index.native.js new file mode 100644 index 0000000..74addc0 --- /dev/null +++ b/src/index.native.js @@ -0,0 +1 @@ +export { FlatList, SectionList } from "react-native"; \ No newline at end of file