From bd65e1aeba25cb96e18ee17de1ef43e1bc60f79d Mon Sep 17 00:00:00 2001 From: Rui Ying Date: Fri, 30 Aug 2019 00:18:46 -0700 Subject: [PATCH 1/2] feat: Enable compatibility with React Native 0.60 (#203) The method `[sendInputEventWithName:body]` is removed in react-native 0.60. To enable compatibility the suggested fix is to use `RCTComponentEvent` - see https://github.com/facebook/react-native/commit/41343f6a7305cc82c412898139c46c01047f3399 BREAKING CHANGE: This will not be compatible with <0.60.0 --- RNTableView/RNTableViewManager.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 { From 5fb84ed057e9de1db135bef53b3e9f443d1a4c10 Mon Sep 17 00:00:00 2001 From: Kyle Roach Date: Fri, 30 Aug 2019 03:39:19 -0400 Subject: [PATCH 2/2] docs: Add instructions concerning react-native > 0.60.0 --- README.md | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-) 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]