From 999dc03fd6d4f1d0a15dc2a19dd8f9557474e745 Mon Sep 17 00:00:00 2001 From: Benoit Dion Date: Wed, 17 Apr 2019 07:39:33 -0400 Subject: [PATCH 1/2] Properly use default port --- app/react-native/src/preview/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/react-native/src/preview/index.tsx b/app/react-native/src/preview/index.tsx index db58db3246a9..8be3979b5078 100644 --- a/app/react-native/src/preview/index.tsx +++ b/app/react-native/src/preview/index.tsx @@ -78,7 +78,7 @@ export default class Preview { channel = new Channel({ async: true }); } else { const host = getHost(params.host || 'localhost'); - const port = params.port ? `:${params.port || 7007}` : ''; + const port = `:${params.port || 7007}`; const query = params.query || ''; const { secured } = params; From d5d785da523a35becf775bf7416c6b174466a474 Mon Sep 17 00:00:00 2001 From: Benoit Dion Date: Wed, 17 Apr 2019 07:40:04 -0400 Subject: [PATCH 2/2] Return early on initial render The story isn't set until we receive the first channel event --- app/react-native/src/preview/components/StoryView/index.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/react-native/src/preview/components/StoryView/index.tsx b/app/react-native/src/preview/components/StoryView/index.tsx index a5448c28ec3b..b7407527aab2 100644 --- a/app/react-native/src/preview/components/StoryView/index.tsx +++ b/app/react-native/src/preview/components/StoryView/index.tsx @@ -77,6 +77,9 @@ export default class StoryView extends Component { } renderListening = () => { + if (!this.state) { + return null; + } const { storyFn, selection } = this.state; const { kind, story } = selection;