Skip to content

Commit 971653e

Browse files
committed
assert app has set the global bridge if it's using RNReactModuleCell's
1 parent eaf71ed commit 971653e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

RNTableView/RNTableView.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#import <UIKit/UIKit.h>
1010
@class RCTEventDispatcher;
11-
@class RCTBridge;
1211

1312
@protocol RNTableViewDatasource <NSObject>
1413

@@ -22,7 +21,7 @@
2221

2322
@interface RNTableView : UIView
2423

25-
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher bridge:(RCTBridge*) bridge NS_DESIGNATED_INITIALIZER;
24+
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher NS_DESIGNATED_INITIALIZER;
2625

2726
@property (nonatomic, copy) NSMutableArray *sections;
2827
@property (nonatomic, copy) NSArray *additionalItems;

RNTableView/RNTableView.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ - (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex
7070
}
7171
}
7272

73-
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher bridge:(RCTBridge*)bridge
73+
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher
7474
{
7575
RCTAssertParam(eventDispatcher);
7676

7777
if ((self = [super initWithFrame:CGRectZero])) {
78-
_bridge = [[RNAppGlobals sharedInstance] appBridge] ?: bridge;
78+
_bridge = [[RNAppGlobals sharedInstance] appBridge];
7979
_eventDispatcher = eventDispatcher;
8080
_cellHeight = 44;
8181
_cells = [NSMutableArray array];
@@ -286,7 +286,6 @@ - (void)setSections:(NSArray *)sections
286286
if(selectedIndex == -1)
287287
selectedIndex = [items count];
288288
itemData[@"selected"] = @YES;
289-
290289
found = YES;
291290
}
292291
[items addObject:itemData];
@@ -322,6 +321,9 @@ -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)
322321
}
323322

324323
-(UITableViewCell*)setupReactModuleCell:(UITableView *)tableView data:(NSDictionary*)data indexPath:(NSIndexPath *)indexPath {
324+
RCTAssert(_bridge, @"Must set global bridge in AppDelegate, e.g. \n\
325+
#import <RNTableView/RNAppGlobals.h>\n\
326+
[[RNAppGlobals sharedInstance] setAppBridge:rootView.bridge]");
325327
RNReactModuleCell *cell = [tableView dequeueReusableCellWithIdentifier:_reactModuleCellReuseIndentifier];
326328
if (cell == nil) {
327329
cell = [[RNReactModuleCell alloc] initWithStyle:self.tableViewCellStyle reuseIdentifier:_reactModuleCellReuseIndentifier bridge: _bridge data:data indexPath:indexPath reactModule:_reactModuleForCell];

RNTableView/RNTableViewManager.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ @implementation RNTableViewManager
1616
RCT_EXPORT_MODULE()
1717
- (UIView *)view
1818
{
19-
return [[RNTableView alloc] initWithEventDispatcher:self.bridge.eventDispatcher bridge:self.bridge];
19+
return [[RNTableView alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
2020
}
2121

2222
RCT_EXPORT_VIEW_PROPERTY(sections, NSArray)

examples/TableViewDemo/index.ios.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ class FirebaseExample extends React.Component {
186186
this.propPrefix = "dinosaur";
187187
}
188188
componentDidMount() {
189-
var dinData = null;
190189
var self = this;
191190
this.ref = new Firebase(this.firebaseLocation);
192191
this.ref.on('value', function(snapshot) {

0 commit comments

Comments
 (0)