Skip to content

Commit

Permalink
3.0.0 #209
Browse files Browse the repository at this point in the history
  • Loading branch information
iRoachie authored Aug 30, 2019
2 parents 20a4f31 + 5fb84ed commit b5c4853
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 18 deletions.
47 changes: 33 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,39 @@

## Installation

1. Installation
- Using npm: `npm install react-native-tableview --save`
- Using yarn: `yarn add react-native-tableview`
2. Link
- `react-native link react-native-tableview`
- If fails, follow manual linking steps below
3. (optional) If you will use JSON file, add it to iOS application bundle
4. Import it in your JS:

```js
import TableView from 'react-native-tableview';
```

### Manual Linking
Using npm:

```bash
npm install react-native-tableview --save
```

or using yarn:

```bash
yarn add react-native-tableview
```

> ⚠️ If you are on React Native < 0.60.0, you must use version 2.x.x of this library
### Pods

> If using CocoaPods or React Native version >= 0.60.0
```bash
cd ios && pod install && cd ..
```

### Linking

> For React Native <= 0.59 only
```bash
react-native link react-native-tableview
```

If fails, follow manual linking steps below,

#### Manual Linking

1. In XCode, in the project navigator, right click Libraries ➜ Add Files to
[your project's name]
Expand Down
12 changes: 8 additions & 4 deletions RNTableView/RNTableViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import <React/RCTConvert.h>
#import <React/RCTFont.h>
#import <React/RCTUIManager.h>
#import <React/RCTComponentEvent.h>

@implementation RNTableViewManager

Expand Down Expand Up @@ -253,7 +254,10 @@ - (NSDictionary *)constantsToExport {

RCT_EXPORT_METHOD(sendNotification:(NSDictionary *)data)
{
[self.bridge.eventDispatcher sendInputEventWithName:@"onItemNotification" body:data];
RCTComponentEvent *event = [[RCTComponentEvent alloc] initWithName:@"onItemNotification"
viewTag:nil
body:data];
[self.bridge.eventDispatcher sendEvent:event];
}

RCT_EXPORT_METHOD(scrollTo:(nonnull NSNumber *)reactTag
Expand All @@ -276,7 +280,7 @@ - (NSDictionary *)constantsToExport {
[self.bridge.uiManager addUIBlock:
^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry){
RNTableView *tableView = viewRegistry[reactTag];

if ([tableView isKindOfClass:[RNTableView class]]) {
[tableView startRefreshing];
} else {
Expand All @@ -290,7 +294,7 @@ - (NSDictionary *)constantsToExport {
[self.bridge.uiManager addUIBlock:
^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry){
RNTableView *tableView = viewRegistry[reactTag];

if ([tableView isKindOfClass:[RNTableView class]]) {
[tableView stopRefreshing];
} else {
Expand All @@ -307,7 +311,7 @@ - (NSDictionary *)constantsToExport {
[self.bridge.uiManager addUIBlock:
^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry){
RNTableView *tableView = viewRegistry[reactTag];

if ([tableView isKindOfClass:[RNTableView class]]) {
[tableView scrollToIndex:index section:section animated:animated];
} else {
Expand Down

0 comments on commit b5c4853

Please sign in to comment.