Skip to content

Commit a0e4934

Browse files
authored
Provide default leading nav button icon on iOS (#156)
* Add close icon image (ic_close_black_24px.png) to the iOS project asset catalog * Fall back to iOS UIBarButtonItem.SystemItem.close for the leading nav button if no valid image path is provided * Bump version number
1 parent b1aecaa commit a0e4934

File tree

8 files changed

+65
-22
lines changed

8 files changed

+65
-22
lines changed

example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,52 @@
22
"images" : [
33
{
44
"idiom" : "iphone",
5-
"size" : "29x29",
6-
"scale" : "2x"
5+
"scale" : "2x",
6+
"size" : "20x20"
77
},
88
{
99
"idiom" : "iphone",
10-
"size" : "29x29",
11-
"scale" : "3x"
10+
"scale" : "3x",
11+
"size" : "20x20"
1212
},
1313
{
1414
"idiom" : "iphone",
15-
"size" : "40x40",
16-
"scale" : "2x"
15+
"scale" : "2x",
16+
"size" : "29x29"
1717
},
1818
{
1919
"idiom" : "iphone",
20-
"size" : "40x40",
21-
"scale" : "3x"
20+
"scale" : "3x",
21+
"size" : "29x29"
2222
},
2323
{
2424
"idiom" : "iphone",
25-
"size" : "60x60",
26-
"scale" : "2x"
25+
"scale" : "2x",
26+
"size" : "40x40"
2727
},
2828
{
2929
"idiom" : "iphone",
30-
"size" : "60x60",
31-
"scale" : "3x"
30+
"scale" : "3x",
31+
"size" : "40x40"
32+
},
33+
{
34+
"idiom" : "iphone",
35+
"scale" : "2x",
36+
"size" : "60x60"
37+
},
38+
{
39+
"idiom" : "iphone",
40+
"scale" : "3x",
41+
"size" : "60x60"
42+
},
43+
{
44+
"idiom" : "ios-marketing",
45+
"scale" : "1x",
46+
"size" : "1024x1024"
3247
}
3348
],
3449
"info" : {
35-
"version" : 1,
36-
"author" : "xcode"
50+
"author" : "xcode",
51+
"version" : 1
3752
}
38-
}
53+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"info" : {
3-
"version" : 1,
4-
"author" : "xcode"
3+
"author" : "xcode",
4+
"version" : 1
55
}
66
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "ic_close_black_24px.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "ic_close_black_24px@2x.png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "ic_close_black_24px@3x.png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
}
23+
}
151 Bytes
Loading
215 Bytes
Loading
275 Bytes
Loading

ios/RNTPTDocumentView.m

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,15 @@ - (void)loadDocumentViewController
215215

216216
if (self.showNavButton) {
217217
UIImage *navImage = [UIImage imageNamed:self.navButtonPath];
218-
UIBarButtonItem *navButton = [[UIBarButtonItem alloc] initWithImage:navImage
219-
style:UIBarButtonItemStylePlain
220-
target:self
221-
action:@selector(navButtonClicked)];
218+
UIBarButtonItem *navButton;
219+
if (navImage == nil) {
220+
navButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(navButtonClicked)];
221+
}else{
222+
navButton = [[UIBarButtonItem alloc] initWithImage:navImage
223+
style:UIBarButtonItemStylePlain
224+
target:self
225+
action:@selector(navButtonClicked)];
226+
}
222227
self.documentViewController.navigationItem.leftBarButtonItem = navButton;
223228
}
224229

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-native-pdftron",
33
"title": "React Native Pdftron",
4-
"version": "2.0.1-beta.20",
4+
"version": "2.0.1-beta.21",
55
"description": "React Native Pdftron",
66
"main": "index.js",
77
"scripts": {

0 commit comments

Comments
 (0)