Skip to content

Commit 8a1f5cb

Browse files
committed
Refactor
1 parent 4bee561 commit 8a1f5cb

File tree

12 files changed

+231
-182
lines changed

12 files changed

+231
-182
lines changed

example/index.android.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/**
2-
* Sample React Native App
3-
* https://github.com/facebook/react-native
4-
* @flow
5-
*/
6-
71
import React, { Component } from 'react';
82
import {
93
AppRegistry,
@@ -92,17 +86,17 @@ export default class Example extends Component {
9286
}
9387

9488
errorOccur() {
95-
this.openGoogle({
89+
this.openGoogle('https://www.google.com', {
9690
//toolbarColor: '607D8B', // <--- Invalid toolbar color.
9791
enableUrlBarHiding: '#607D8B', // <-- Type Error.
9892
})
9993
}
10094

10195
openGoogle(option) {
102-
CustomTabs.openURL('https://www.google.com', option).then((launched: boolean) => {
96+
CustomTabs.openURL('https://www.google.com', option).then((launched) => {
10397
console.log(`Launched custom tabs: ${launched}`);
10498
}).catch(err => {
105-
console.error(err)
99+
console.warn("An error occurred", err);
106100
});
107101
}
108102
}

example/index.ios.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/**
2-
* Sample React Native App
3-
* https://github.com/facebook/react-native
4-
* @flow
5-
*/
6-
71
import React, { Component } from 'react';
82
import {
93
AppRegistry,
@@ -33,10 +27,10 @@ export default class Example extends Component {
3327
}
3428

3529
openGoogle() {
36-
CustomTabs.openURL('https://www.google.com').then((launched: boolean) => {
30+
CustomTabs.openURL('https://www.google.com').then((launched) => {
3731
console.log(`Launched custom tabs: ${launched}`);
3832
}).catch(err => {
39-
console.error('An error occurred', err)
33+
console.warn('An error occurred', err)
4034
});
4135
}
4236
}

example/ios/example.xcodeproj/project.pbxproj

Lines changed: 165 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
2626
2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
2727
2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
28-
2D02E4C21E0B4AEC006451C7 /* libRCTAnimation-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */; };
28+
2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
2929
2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */; };
3030
2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */; };
3131
2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */; };
@@ -229,6 +229,76 @@
229229
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
230230
remoteInfo = RCTText;
231231
};
232+
DA6F6DA32122B1A400EED9AA /* PBXContainerItemProxy */ = {
233+
isa = PBXContainerItemProxy;
234+
containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
235+
proxyType = 2;
236+
remoteGlobalIDString = 3DBE0D001F3B181A0099AA32;
237+
remoteInfo = fishhook;
238+
};
239+
DA6F6DA52122B1A400EED9AA /* PBXContainerItemProxy */ = {
240+
isa = PBXContainerItemProxy;
241+
containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
242+
proxyType = 2;
243+
remoteGlobalIDString = 3DBE0D0D1F3B181C0099AA32;
244+
remoteInfo = "fishhook-tvOS";
245+
};
246+
DA6F6DB72122B1A400EED9AA /* PBXContainerItemProxy */ = {
247+
isa = PBXContainerItemProxy;
248+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
249+
proxyType = 2;
250+
remoteGlobalIDString = EBF21BDC1FC498900052F4D5;
251+
remoteInfo = jsinspector;
252+
};
253+
DA6F6DB92122B1A400EED9AA /* PBXContainerItemProxy */ = {
254+
isa = PBXContainerItemProxy;
255+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
256+
proxyType = 2;
257+
remoteGlobalIDString = EBF21BFA1FC4989A0052F4D5;
258+
remoteInfo = "jsinspector-tvOS";
259+
};
260+
DA6F6DBB2122B1A400EED9AA /* PBXContainerItemProxy */ = {
261+
isa = PBXContainerItemProxy;
262+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
263+
proxyType = 2;
264+
remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7;
265+
remoteInfo = "third-party";
266+
};
267+
DA6F6DBD2122B1A400EED9AA /* PBXContainerItemProxy */ = {
268+
isa = PBXContainerItemProxy;
269+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
270+
proxyType = 2;
271+
remoteGlobalIDString = 3D383D3C1EBD27B6005632C8;
272+
remoteInfo = "third-party-tvOS";
273+
};
274+
DA6F6DBF2122B1A400EED9AA /* PBXContainerItemProxy */ = {
275+
isa = PBXContainerItemProxy;
276+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
277+
proxyType = 2;
278+
remoteGlobalIDString = 139D7E881E25C6D100323FB7;
279+
remoteInfo = "double-conversion";
280+
};
281+
DA6F6DC12122B1A400EED9AA /* PBXContainerItemProxy */ = {
282+
isa = PBXContainerItemProxy;
283+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
284+
proxyType = 2;
285+
remoteGlobalIDString = 3D383D621EBD27B9005632C8;
286+
remoteInfo = "double-conversion-tvOS";
287+
};
288+
DA6F6DC32122B1A400EED9AA /* PBXContainerItemProxy */ = {
289+
isa = PBXContainerItemProxy;
290+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
291+
proxyType = 2;
292+
remoteGlobalIDString = 9936F3131F5F2E4B0010BF04;
293+
remoteInfo = privatedata;
294+
};
295+
DA6F6DC52122B1A400EED9AA /* PBXContainerItemProxy */ = {
296+
isa = PBXContainerItemProxy;
297+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
298+
proxyType = 2;
299+
remoteGlobalIDString = 9936F32F1F5F2E5B0010BF04;
300+
remoteInfo = "privatedata-tvOS";
301+
};
232302
DA97D5B01E90D3D100971B6A /* PBXContainerItemProxy */ = {
233303
isa = PBXContainerItemProxy;
234304
containerPortal = C477472CEAD5496695E92315 /* ReactNativeCustomTabs.xcodeproj */;
@@ -300,7 +370,7 @@
300370
buildActionMask = 2147483647;
301371
files = (
302372
2D02E4C91E0B4AEC006451C7 /* libReact.a in Frameworks */,
303-
2D02E4C21E0B4AEC006451C7 /* libRCTAnimation-tvOS.a in Frameworks */,
373+
2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */,
304374
2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */,
305375
2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */,
306376
2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */,
@@ -393,6 +463,8 @@
393463
children = (
394464
139FDEF41B06529B00C62182 /* libRCTWebSocket.a */,
395465
3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */,
466+
DA6F6DA42122B1A400EED9AA /* libfishhook.a */,
467+
DA6F6DA62122B1A400EED9AA /* libfishhook-tvOS.a */,
396468
);
397469
name = Products;
398470
sourceTree = "<group>";
@@ -422,6 +494,14 @@
422494
3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */,
423495
3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */,
424496
3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */,
497+
DA6F6DB82122B1A400EED9AA /* libjsinspector.a */,
498+
DA6F6DBA2122B1A400EED9AA /* libjsinspector-tvOS.a */,
499+
DA6F6DBC2122B1A400EED9AA /* libthird-party.a */,
500+
DA6F6DBE2122B1A400EED9AA /* libthird-party.a */,
501+
DA6F6DC02122B1A400EED9AA /* libdouble-conversion.a */,
502+
DA6F6DC22122B1A400EED9AA /* libdouble-conversion.a */,
503+
DA6F6DC42122B1A400EED9AA /* libprivatedata.a */,
504+
DA6F6DC62122B1A400EED9AA /* libprivatedata-tvOS.a */,
425505
);
426506
name = Products;
427507
sourceTree = "<group>";
@@ -430,7 +510,7 @@
430510
isa = PBXGroup;
431511
children = (
432512
5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */,
433-
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */,
513+
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */,
434514
);
435515
name = Products;
436516
sourceTree = "<group>";
@@ -479,6 +559,7 @@
479559
832341AE1AAA6A7D00B99B32 /* Libraries */,
480560
00E356EF1AD99517003FC87E /* exampleTests */,
481561
83CBBA001A601CBA00E9B192 /* Products */,
562+
DA6F6D8F2122B19E00EED9AA /* Recovered References */,
482563
);
483564
indentWidth = 2;
484565
sourceTree = "<group>";
@@ -495,6 +576,14 @@
495576
name = Products;
496577
sourceTree = "<group>";
497578
};
579+
DA6F6D8F2122B19E00EED9AA /* Recovered References */ = {
580+
isa = PBXGroup;
581+
children = (
582+
7F8661559E90436499C60EDF /* libDBCustomTabs.a */,
583+
);
584+
name = "Recovered References";
585+
sourceTree = "<group>";
586+
};
498587
DA97D5941E90D3D100971B6A /* Products */ = {
499588
isa = PBXGroup;
500589
children = (
@@ -831,10 +920,10 @@
831920
remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
832921
sourceTree = BUILT_PRODUCTS_DIR;
833922
};
834-
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */ = {
923+
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */ = {
835924
isa = PBXReferenceProxy;
836925
fileType = archive.ar;
837-
path = "libRCTAnimation-tvOS.a";
926+
path = libRCTAnimation.a;
838927
remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
839928
sourceTree = BUILT_PRODUCTS_DIR;
840929
};
@@ -852,6 +941,76 @@
852941
remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
853942
sourceTree = BUILT_PRODUCTS_DIR;
854943
};
944+
DA6F6DA42122B1A400EED9AA /* libfishhook.a */ = {
945+
isa = PBXReferenceProxy;
946+
fileType = archive.ar;
947+
path = libfishhook.a;
948+
remoteRef = DA6F6DA32122B1A400EED9AA /* PBXContainerItemProxy */;
949+
sourceTree = BUILT_PRODUCTS_DIR;
950+
};
951+
DA6F6DA62122B1A400EED9AA /* libfishhook-tvOS.a */ = {
952+
isa = PBXReferenceProxy;
953+
fileType = archive.ar;
954+
path = "libfishhook-tvOS.a";
955+
remoteRef = DA6F6DA52122B1A400EED9AA /* PBXContainerItemProxy */;
956+
sourceTree = BUILT_PRODUCTS_DIR;
957+
};
958+
DA6F6DB82122B1A400EED9AA /* libjsinspector.a */ = {
959+
isa = PBXReferenceProxy;
960+
fileType = archive.ar;
961+
path = libjsinspector.a;
962+
remoteRef = DA6F6DB72122B1A400EED9AA /* PBXContainerItemProxy */;
963+
sourceTree = BUILT_PRODUCTS_DIR;
964+
};
965+
DA6F6DBA2122B1A400EED9AA /* libjsinspector-tvOS.a */ = {
966+
isa = PBXReferenceProxy;
967+
fileType = archive.ar;
968+
path = "libjsinspector-tvOS.a";
969+
remoteRef = DA6F6DB92122B1A400EED9AA /* PBXContainerItemProxy */;
970+
sourceTree = BUILT_PRODUCTS_DIR;
971+
};
972+
DA6F6DBC2122B1A400EED9AA /* libthird-party.a */ = {
973+
isa = PBXReferenceProxy;
974+
fileType = archive.ar;
975+
path = "libthird-party.a";
976+
remoteRef = DA6F6DBB2122B1A400EED9AA /* PBXContainerItemProxy */;
977+
sourceTree = BUILT_PRODUCTS_DIR;
978+
};
979+
DA6F6DBE2122B1A400EED9AA /* libthird-party.a */ = {
980+
isa = PBXReferenceProxy;
981+
fileType = archive.ar;
982+
path = "libthird-party.a";
983+
remoteRef = DA6F6DBD2122B1A400EED9AA /* PBXContainerItemProxy */;
984+
sourceTree = BUILT_PRODUCTS_DIR;
985+
};
986+
DA6F6DC02122B1A400EED9AA /* libdouble-conversion.a */ = {
987+
isa = PBXReferenceProxy;
988+
fileType = archive.ar;
989+
path = "libdouble-conversion.a";
990+
remoteRef = DA6F6DBF2122B1A400EED9AA /* PBXContainerItemProxy */;
991+
sourceTree = BUILT_PRODUCTS_DIR;
992+
};
993+
DA6F6DC22122B1A400EED9AA /* libdouble-conversion.a */ = {
994+
isa = PBXReferenceProxy;
995+
fileType = archive.ar;
996+
path = "libdouble-conversion.a";
997+
remoteRef = DA6F6DC12122B1A400EED9AA /* PBXContainerItemProxy */;
998+
sourceTree = BUILT_PRODUCTS_DIR;
999+
};
1000+
DA6F6DC42122B1A400EED9AA /* libprivatedata.a */ = {
1001+
isa = PBXReferenceProxy;
1002+
fileType = archive.ar;
1003+
path = libprivatedata.a;
1004+
remoteRef = DA6F6DC32122B1A400EED9AA /* PBXContainerItemProxy */;
1005+
sourceTree = BUILT_PRODUCTS_DIR;
1006+
};
1007+
DA6F6DC62122B1A400EED9AA /* libprivatedata-tvOS.a */ = {
1008+
isa = PBXReferenceProxy;
1009+
fileType = archive.ar;
1010+
path = "libprivatedata-tvOS.a";
1011+
remoteRef = DA6F6DC52122B1A400EED9AA /* PBXContainerItemProxy */;
1012+
sourceTree = BUILT_PRODUCTS_DIR;
1013+
};
8551014
DA97D5B11E90D3D100971B6A /* libDBCustomTabs.a */ = {
8561015
isa = PBXReferenceProxy;
8571016
fileType = archive.ar;
@@ -908,7 +1067,7 @@
9081067
);
9091068
runOnlyForDeploymentPostprocessing = 0;
9101069
shellPath = /bin/sh;
911-
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
1070+
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
9121071
};
9131072
2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
9141073
isa = PBXShellScriptBuildPhase;

index.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"react-native": "*",
2828
"react": "*"
2929
},
30+
"main": "src/index.js",
3031
"types": "src/index.d.ts",
3132
"devDependencies": {
3233
"@types/react": "^16.4.6",
@@ -39,4 +40,4 @@
3940
"eslint-plugin-react": "6.x.x",
4041
"eslint-plugin-react-native": "2.x.x"
4142
}
42-
}
43+
}

src/Animations.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"use strict";
2+
3+
/**
4+
* Start and exit animations of Custom Tabs.
5+
* Slide in from left at start, Slide out to right.at exit.
6+
*/
7+
export const ANIMATIONS_SLIDE = {
8+
startEnter: "slide_in_right",
9+
startExit: "slide_out_left",
10+
endEnter: "android:anim/slide_in_left",
11+
endExit: "android:anim/slide_out_right"
12+
};
13+
14+
/**
15+
* Start and exit animations of Custom Tabs.
16+
* Fade in at start, Fade out at exit.
17+
*/
18+
export const ANIMATIONS_FADE = {
19+
startEnter: "android:anim/fade_in",
20+
startExit: "android:anim/fade_out",
21+
endEnter: "android:anim/fade_in",
22+
endExit: "android:anim/fade_out"
23+
};

src/ChromeIOS.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)