Skip to content

Commit

Permalink
feat: add tab bar show and hide methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dkvyck-uptech committed Jan 21, 2025
1 parent 32f18b9 commit 7100683
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 10 deletions.
5 changes: 5 additions & 0 deletions dist/classes/NativelyTabBar.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare class NativelyTabBar {
private readonly id;
showTabBar(): void;
hideTabBar(): void;
}
16 changes: 16 additions & 0 deletions dist/classes/NativelyTabBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { generateID } from "../utils/generateID.js";
import globalContext from "../utils/globalThis.js";
export class NativelyTabBar {
constructor() {
_defineProperty(this, "id", generateID());
}
showTabBar() {
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 33, "show_tab_bar");
}
hideTabBar() {
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 33, "hide_tab_bar");
}
}
1 change: 1 addition & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export { NativelyAdmobInterstitial } from "./classes/NativelyAdmobInterstitial";
export { NativelyNFCService } from "./classes/NativelyNFCService";
export { NativelyFirebaseNotifications } from './classes/NativelyFirebaseNotifications';
export { NativelyKlaviyoNotifications } from './classes/NativelyKlaviyoNotifications';
export { NativelyTabBar } from './classes/NativelyTabBar';
export { useNatively } from './hooks/useNatively';
export { generateID } from "./utils/generateID";
import "./types";
Expand Down
1 change: 1 addition & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export { NativelyAdmobInterstitial } from "./classes/NativelyAdmobInterstitial.j
export { NativelyNFCService } from "./classes/NativelyNFCService.js";
export { NativelyFirebaseNotifications } from './classes/NativelyFirebaseNotifications.js';
export { NativelyKlaviyoNotifications } from './classes/NativelyKlaviyoNotifications.js';
export { NativelyTabBar } from './classes/NativelyTabBar.js';

// Hooks
export { useNatively } from './hooks/useNatively.js';
Expand Down
2 changes: 2 additions & 0 deletions dist/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { NativelyScanner } from "./classes/NativelyScanner.js";
import { NativelyStorage } from "./classes/NativelyStorage.js";
import { NativelyFirebaseNotifications } from "./classes/NativelyFirebaseNotifications.js";
import { NativelyKlaviyoNotifications } from './classes/NativelyKlaviyoNotifications.js';
import { NativelyTabBar } from './classes/NativelyTabBar.js';

// Assign natively to the global object
if (globalContext) {
Expand Down Expand Up @@ -49,4 +50,5 @@ if (globalContext) {
globalContext.NativelyStorage = NativelyStorage;
globalContext.NativelyFirebaseNotifications = NativelyFirebaseNotifications;
globalContext.NativelyKlaviyoNotifications = NativelyKlaviyoNotifications;
globalContext.NativelyTabBar = NativelyTabBar;
}
2 changes: 2 additions & 0 deletions dist/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { NativelyScanner } from "./classes/NativelyScanner";
import { NativelyStorage } from "./classes/NativelyStorage";
import { NativelyFirebaseNotifications } from "./classes/NativelyFirebaseNotifications";
import { NativelyKlaviyoNotifications } from "./classes/NativelyKlaviyoNotifications";
import { NativelyTabBar } from "./classes/NativelyTabBar";
interface NativelyProps {
natively: Natively;
NativelyAdmobBanner: NativelyAdmobBanner;
Expand All @@ -45,6 +46,7 @@ interface NativelyProps {
NativelyStorage: NativelyStorage;
NativelyFirebaseNotifications: NativelyFirebaseNotifications;
NativelyKlaviyoNotifications: NativelyKlaviyoNotifications;
NativelyTabBar: NativelyTabBar;
$agent: never;
}
declare global {
Expand Down
2 changes: 1 addition & 1 deletion natively-frontend.min.js

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"typescript": "^5.6.3",
"webpack": "^5.96.1",
"webpack": "^5.97.1",
"webpack-cli": "^5.1.4"
}
}
22 changes: 22 additions & 0 deletions src/classes/NativelyTabBar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {generateID} from "../utils/generateID";
import globalContext from "../utils/globalThis";

export class NativelyTabBar {
private readonly id: string = generateID();

showTabBar(): void {
globalContext?.natively.trigger(
this.id,
33,
"show_tab_bar",
);
}

hideTabBar(): void {
globalContext?.natively.trigger(
this.id,
33,
"hide_tab_bar",
);
}
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export {NativelyAdmobInterstitial} from "./classes/NativelyAdmobInterstitial";
export {NativelyNFCService} from "./classes/NativelyNFCService";
export {NativelyFirebaseNotifications} from './classes/NativelyFirebaseNotifications';
export {NativelyKlaviyoNotifications} from './classes/NativelyKlaviyoNotifications';
export {NativelyTabBar} from './classes/NativelyTabBar';

// Hooks
export {useNatively} from './hooks/useNatively';
Expand Down
2 changes: 2 additions & 0 deletions src/inject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {NativelyScanner} from "./classes/NativelyScanner";
import {NativelyStorage} from "./classes/NativelyStorage";
import {NativelyFirebaseNotifications} from "./classes/NativelyFirebaseNotifications";
import {NativelyKlaviyoNotifications} from './classes/NativelyKlaviyoNotifications';
import {NativelyTabBar} from './classes/NativelyTabBar';

// Assign natively to the global object
if (globalContext) {
Expand Down Expand Up @@ -49,4 +50,5 @@ if (globalContext) {
globalContext.NativelyStorage = NativelyStorage;
globalContext.NativelyFirebaseNotifications = NativelyFirebaseNotifications;
globalContext.NativelyKlaviyoNotifications = NativelyKlaviyoNotifications;
globalContext.NativelyTabBar = NativelyTabBar;
}
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {NativelyScanner} from "./classes/NativelyScanner";
import {NativelyStorage} from "./classes/NativelyStorage";
import {NativelyFirebaseNotifications} from "./classes/NativelyFirebaseNotifications";
import {NativelyKlaviyoNotifications} from "./classes/NativelyKlaviyoNotifications";
import {NativelyTabBar} from "./classes/NativelyTabBar";

interface NativelyProps {
natively: Natively;
Expand All @@ -46,6 +47,7 @@ interface NativelyProps {
NativelyStorage: NativelyStorage;
NativelyFirebaseNotifications: NativelyFirebaseNotifications;
NativelyKlaviyoNotifications: NativelyKlaviyoNotifications;
NativelyTabBar: NativelyTabBar;
$agent: never;
}

Expand Down

0 comments on commit 7100683

Please sign in to comment.