Skip to content

Commit

Permalink
fix: android fixes and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Cavallando committed Oct 31, 2023
1 parent 95a3077 commit a08a775
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/CommandBar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export type CommandBarOptions = {
orgId: string;
userId?: string;
spinnerColor?: string;
launchCode?: string;
};
31 changes: 31 additions & 0 deletions src/HelpHubView.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React, { useEffect } from 'react';
import { DeviceEventEmitter, requireNativeComponent } from 'react-native';
import type { CommandBarOptions } from './CommandBar';
import type { ViewStyle } from 'react-native';

export type HelpHubViewProps = {
options: CommandBarOptions;
onFallbackAction?: (action: any) => void;
style?: ViewStyle;
};

export const HelpHubViewNative: React.ComponentClass<HelpHubViewProps> =
requireNativeComponent('HelpHubView');

export const HelpHubView: React.FC<HelpHubViewProps> = (props) => {
useEffect(() => {
const subscription = DeviceEventEmitter.addListener(
'onFallbackAction',
(action) => {
props.onFallbackAction?.(action);
}
);

return () => {
subscription.remove();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return <HelpHubViewNative options={props.options} style={props.style} />;
};

0 comments on commit a08a775

Please sign in to comment.