Skip to content

Commit b8a9a68

Browse files
authored
2.5.0 #197
2 parents b76367d + 6535889 commit b8a9a68

File tree

5 files changed

+14
-1
lines changed

5 files changed

+14
-1
lines changed

RNTableView/RNTableView.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,13 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
530530
newValue[@"target"] = self.reactTag;
531531
newValue[@"selectedIndex"] = [NSNumber numberWithInteger:indexPath.item];
532532
newValue[@"selectedSection"] = [NSNumber numberWithInteger:indexPath.section];
533+
534+
CGRect selectedCellRect = [tableView rectForRowAtIndexPath:indexPath];
535+
selectedCellRect = CGRectOffset(selectedCellRect, -tableView.contentOffset.x, -tableView.contentOffset.y);
536+
newValue[@"selectedOrigin"] = @{
537+
@"x": @(selectedCellRect.origin.x),
538+
@"y": @(selectedCellRect.origin.y)
539+
};
533540

534541
/*
535542
* if allowToggle is enabled and we tap an already selected row, then remove the selection.

RNTableView/RNTableViewManager.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ - (NSArray *)customDirectEventTypes
4747
RCT_EXPORT_VIEW_PROPERTY(additionalItems, NSArray)
4848
RCT_EXPORT_VIEW_PROPERTY(selectedIndex, NSInteger)
4949
RCT_EXPORT_VIEW_PROPERTY(selectedSection, NSInteger)
50+
RCT_EXPORT_VIEW_PROPERTY(selectedOrigin, CGPoint)
5051
RCT_EXPORT_VIEW_PROPERTY(cellHeight, float)
5152
RCT_EXPORT_VIEW_PROPERTY(footerHeight, float)
5253
RCT_EXPORT_VIEW_PROPERTY(headerHeight, float)

example/ios/TableViewDemo.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D16E6891FA4F8E400B85C8A /* libReact.a */; };
3737
2DCD954D1E0B4F2C00145EB5 /* TableViewDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* TableViewDemoTests.m */; };
3838
2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; };
39+
3D208C0121F04B5000FB8812 /* states.json in Resources */ = {isa = PBXBuildFile; fileRef = 3D208BDA21F04B5000FB8812 /* states.json */; };
3940
3D8FFBDC215DE29400E6B088 /* libRNTableView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D8FFBDB215DE27E00E6B088 /* libRNTableView.a */; };
4041
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
4142
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
@@ -347,6 +348,7 @@
347348
2D02E47B1E0B4A5D006451C7 /* TableViewDemo-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "TableViewDemo-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
348349
2D02E4901E0B4A5D006451C7 /* TableViewDemo-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "TableViewDemo-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
349350
2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; };
351+
3D208BDA21F04B5000FB8812 /* states.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = states.json; path = ../src/assets/states.json; sourceTree = "<group>"; };
350352
3D8FFBD6215DE27E00E6B088 /* RNTableView.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNTableView.xcodeproj; path = "../node_modules/react-native-tableview/RNTableView.xcodeproj"; sourceTree = "<group>"; };
351353
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
352354
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
@@ -591,6 +593,7 @@
591593
83CBB9F61A601CBA00E9B192 = {
592594
isa = PBXGroup;
593595
children = (
596+
3D208BDA21F04B5000FB8812 /* states.json */,
594597
13B07FAE1A68108700A75B9A /* TableViewDemo */,
595598
832341AE1AAA6A7D00B99B32 /* Libraries */,
596599
00E356EF1AD99517003FC87E /* TableViewDemoTests */,
@@ -1082,6 +1085,7 @@
10821085
files = (
10831086
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
10841087
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
1088+
3D208C0121F04B5000FB8812 /* states.json in Resources */,
10851089
);
10861090
runOnlyForDeploymentPostprocessing = 0;
10871091
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-tableview",
3-
"version": "2.4.1",
3+
"version": "2.5.0",
44
"description": "Native iOS TableView wrapper for React Native",
55
"main": "src/index.js",
66
"types": "src/index.d.ts",

src/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ interface OnPressCallBack extends CallBack {
3333
children: string
3434
selectedIndex: number
3535
selectedSection: number
36+
selectedOrigin: PointPropType
3637
footerLabel?: string
3738
label?: string
3839
}

0 commit comments

Comments
 (0)