diff --git a/README.md b/README.md index 19d06a7..3658888 100755 --- a/README.md +++ b/README.md @@ -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] diff --git a/RNTableView/RNTableViewManager.m b/RNTableView/RNTableViewManager.m index 43f58cc..9f8ed41 100644 --- a/RNTableView/RNTableViewManager.m +++ b/RNTableView/RNTableViewManager.m @@ -12,6 +12,7 @@ #import #import #import +#import @implementation RNTableViewManager @@ -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 @@ -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 { @@ -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 { @@ -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 {