Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Make the library compatible with iOS and Android #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]:react-native-web-community/react-native-web-lists.git"
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import FlatList from './FlatList';
import SectionList from './SectionList';

export default { FlatList, SectionList };
export {FlatList, SectionList};
1 change: 1 addition & 0 deletions src/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { FlatList, SectionList } from "react-native";