File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,17 @@ class PreviewFrame extends React.Component {
29
29
}
30
30
31
31
componentDidMount ( ) {
32
+ console . log ( `componentDidMount: ${ this . props . isPlaying } ` ) ;
32
33
window . addEventListener ( 'message' , this . handleConsoleEvent ) ;
34
+
35
+ // TODO: maybe encapsulate this into a function (together with code from componentDidUpdate)
36
+ if ( this . props . isPlaying && this . props . previewIsRefreshing ) {
37
+ this . renderSketch ( ) ;
38
+ }
33
39
}
34
40
35
41
componentDidUpdate ( prevProps ) {
42
+ console . log ( `componentDidUpdate: ${ this . props . isPlaying } ` ) ;
36
43
// if sketch starts or stops playing, want to rerender
37
44
if ( this . props . isPlaying !== prevProps . isPlaying ) {
38
45
this . renderSketch ( ) ;
Original file line number Diff line number Diff line change
1
+ /* eslint-disable */
1
2
import React from 'react' ;
2
3
import PropTypes from 'prop-types' ;
3
4
import styled from 'styled-components' ;
@@ -66,7 +67,7 @@ const IDEViewMobile = (props) => {
66
67
< Link
67
68
to = "/mobile/preview"
68
69
onClick = { ( ) => {
69
- alert ( 'starting sketch' ) ;
70
+ // alert('starting sketch');
70
71
startSketch ( ) ;
71
72
} }
72
73
>
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ import * as PreferencesActions from '../IDE/actions/preferences';
13
13
import * as ConsoleActions from '../IDE/actions/console' ;
14
14
import * as FilesActions from '../IDE/actions/files' ;
15
15
16
+ import FullView from '../IDE/pages/FullView' ;
17
+
16
18
import { getHTMLFile } from '../IDE/reducers/files' ;
17
19
18
20
@@ -71,15 +73,17 @@ const MobileSketchView = (props) => {
71
73
< Content >
72
74
< h1 > Hello</ h1 >
73
75
< section className = "preview-frame-holder" >
74
-
75
76
< PreviewFrame
76
77
htmlFile = { htmlFile }
77
78
files = { files }
78
- fullView
79
+ head = {
80
+ < link type = "text/css" rel = "stylesheet" href = "/preview-styles.css" />
81
+ }
79
82
80
83
content = { selectedFile . content }
81
84
82
- isPlaying = { ide . isPlaying }
85
+ fullView
86
+ isPlaying
83
87
isAccessibleOutputPlaying = { ide . isAccessibleOutputPlaying }
84
88
previewIsRefreshing = { ide . previewIsRefreshing }
85
89
You can’t perform that action at this time.
0 commit comments