Skip to content

Commit

Permalink
feat: Enable compatibility with React Native 0.60 (#203)
Browse files Browse the repository at this point in the history
The method `[sendInputEventWithName:body]` is removed in react-native 0.60. To enable compatibility the suggested fix is to use `RCTComponentEvent` - see facebook/react-native@41343f6

BREAKING CHANGE: This will not be compatible with <0.60.0
  • Loading branch information
robertying authored and iRoachie committed Aug 30, 2019
1 parent 20a4f31 commit bd65e1a
Showing 1 changed file with 8 additions and 4 deletions.
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 bd65e1a

Please sign in to comment.