Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native: Patch preview-web and refs to support RN #19975

Merged
merged 1 commit into from Nov 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/api/src/modules/refs.ts
Expand Up @@ -75,7 +75,7 @@ const findFilename = /(\/((?:[^\/]+?)\.[^\/]+?)|\/)$/;

export const getSourceType = (source: string, refId: string) => {
const { origin: localOrigin, pathname: localPathname } = location;
const { origin: sourceOrigin, pathname: sourcePathname } = new URL(source);
const { origin: sourceOrigin, pathname: sourcePathname } = new URL(source || location.origin);

const localFull = `${localOrigin + localPathname}`.replace(findFilename, '');
const sourceFull = `${sourceOrigin + sourcePathname}`.replace(findFilename, '');
Expand Down
6 changes: 3 additions & 3 deletions lib/preview-web/src/PreviewWeb.tsx
Expand Up @@ -58,11 +58,11 @@ export class PreviewWeb<TFramework extends AnyFramework> extends Preview<TFramew

currentRender: Render<TFramework>;

constructor() {
constructor(urlStore: UrlStore = new UrlStore(), webview: WebView = new WebView()) {
super();

this.view = new WebView();
this.urlStore = new UrlStore();
this.view = webview;
this.urlStore = urlStore;

// Add deprecated APIs for back-compat
// @ts-ignore
Expand Down