Skip to content

Commit

Permalink
fix: 🐞修复各个组件的相关interface未导出的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLLLLH committed Dec 24, 2020
1 parent fa8d678 commit 604eb56
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/components/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { KrpanoRendererContext } from '../contexts/KrpanoRendererContext';
import { EventCallback } from '../types';
import { mapEventPropsToJSCall } from '../utils';

interface EventsConfig {
export interface EventsConfig {
/** 事件名,若存在该参数则为局部事件 */
name?: string;
keep?: boolean;
Expand Down Expand Up @@ -39,11 +39,11 @@ interface EventsConfig {
onIPhoneFullscreen?: EventCallback;
}

interface EventsProps extends EventsConfig {}
export interface EventsProps extends EventsConfig {}

const GlobalEvents = '__GlobalEvents';

const Events: React.FC<EventsProps> = ({ name, keep, children, ...EventsAttrs }) => {
export const Events: React.FC<EventsProps> = ({ name, keep, children, ...EventsAttrs }) => {
const renderer = React.useContext(KrpanoRendererContext);
const EventSelector = `events[${name || GlobalEvents}]`;

Expand Down
6 changes: 3 additions & 3 deletions src/components/Hotspot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { KrpanoRendererContext } from '../contexts/KrpanoRendererContext';
import { EventCallback } from '../types';
import { Logger, mapEventPropsToJSCall, mapObject } from '../utils';

interface ImageHotspotConfig {
export interface ImageHotspotConfig {
name: string;
url: string;
type?: string;
Expand Down Expand Up @@ -37,9 +37,9 @@ interface ImageHotspotConfig {
onLoaded?: EventCallback;
}

interface HotspotProps extends ImageHotspotConfig {}
export interface HotspotProps extends ImageHotspotConfig {}

const Hotspot: React.FC<HotspotProps> = ({ name, children, ...hotspotAttrs }) => {
export const Hotspot: React.FC<HotspotProps> = ({ name, children, ...hotspotAttrs }) => {
const renderer = useContext(KrpanoRendererContext);
const EventSelector = `hotspot[${name}]`;

Expand Down
12 changes: 10 additions & 2 deletions src/components/Krpano.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import KrpanoActionProxy from '../KrpanoActionProxy';
import { NativeKrpanoRendererObject } from '../types';
import { Logger } from '../utils';

interface KrpanoProps {
export interface KrpanoProps {
className?: string;
currentScene?: string;
/** Krpano XML地址 */
Expand All @@ -16,7 +16,15 @@ interface KrpanoProps {
onReady?: (renderer: KrpanoActionProxy) => void;
}

const Krpano: React.FC<KrpanoProps> = ({ className, currentScene, target = 'krpano', id, xml, onReady, children }) => {
export const Krpano: React.FC<KrpanoProps> = ({
className,
currentScene,
target = 'krpano',
id,
xml,
onReady,
children,
}) => {
const [renderer, setRenderer] = React.useState<KrpanoActionProxy | null>(null);
const onReadyCallback = React.useCallback(
(obj: NativeKrpanoRendererObject) => {
Expand Down
12 changes: 9 additions & 3 deletions src/components/Scene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ export interface SceneImageWithMultires {
asPreview?: boolean;
}

interface SceneProps {
export interface SceneProps {
name: string;
previewUrl?: string;
onStart?: () => void;
/** 直接指定scene的xml内容。指定后会忽略其他设置 */
content?: string;
/** image标签的附加属性,仅少部分情况用到 */
Expand All @@ -30,7 +29,14 @@ interface SceneProps {
images?: [SceneImage] | SceneImageWithMultires[];
}

const Scene: React.FC<SceneProps> = ({ name, previewUrl, imageTagAttributes = {}, images = [], content, children }) => {
export const Scene: React.FC<SceneProps> = ({
name,
previewUrl,
imageTagAttributes = {},
images = [],
content,
children,
}) => {
const renderer = useContext(KrpanoRendererContext);
const currentScene = useContext(CurrentSceneContext);

Expand Down
4 changes: 2 additions & 2 deletions src/components/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { KrpanoRendererContext } from '../contexts/KrpanoRendererContext';
/**
* @see https://krpano.com/docu/xml/#view
*/
interface ViewProps {
export interface ViewProps {
hlookat?: number;
vlookat?: number;
fov?: number;
Expand Down Expand Up @@ -42,7 +42,7 @@ interface ViewProps {
children?: null;
}

const View: React.FC<ViewProps> = ({ children, ...viewAttrs }) => {
export const View: React.FC<ViewProps> = ({ children, ...viewAttrs }) => {
const renderer = useContext(KrpanoRendererContext);

React.useEffect(() => {
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export { default as Krpano } from './components/Krpano';
export { default as View } from './components/View';
export { default as Scene } from './components/Scene';
export { default as Hotspot } from './components/Hotspot';
export { default as Events } from './components/Events';
export * from './components/Krpano';
export * from './components/View';
export * from './components/Scene';
export * from './components/Hotspot';
export * from './components/Events';

export * from './KrpanoActionProxy';
export * from './types';
Expand Down

0 comments on commit 604eb56

Please sign in to comment.