This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type action = Toggle | Close | Edit; | |
let reducer = switch(action) { | |
| Toggle => "toggle visibility" | |
| Close => "close me" | |
| Edit => "edit function" | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let (result) = useQuery(ComponentList.definition); | |
switch(result) { | |
| Loading => <LoadingSpinner /> | |
| Error(err) => <ErrorMessage message={err##message} /> | |
| Data(data) => { | |
switch(data##componentsList) { | |
| None => [] | |
| Some(components) => components->Belt.Array.map(component => <div> component##value </span> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[@genType] | |
let make = (~render, ~children) => { | |
...component, | |
render: _self => | |
<div className="InteriorLayout"> | |
{render()} | |
</div>, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.body.style.backgroundColor = 'black' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import hoistNonReactStatics from 'hoist-non-react-statics'; | |
import { View, ActivityIndicator } from "react-native"; | |
const withLoadingScreen = (size = "small") => WrappedComponent => { | |
class LoadingScreen extends React.PureComponent { | |
render() { | |
if (this.props.loading) return <ActivityIndicator size={size} color="white" /> | |
return <WrappedComponent {...this.props} />; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { compose } from "redux"; | |
import { compose } from "react-apollo"; | |
// your InfoScreen implementation | |
// bottom of file: | |
export default compose( | |
connect(mapStateToProps, mapActionCreators), | |
withLoadingScreen | |
)(InfoScreen) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import hoistNonReactStatics from 'hoist-non-react-statics'; | |
import { View, ActivityIndicator } from "react-native"; | |
const withLoadingScreen = (size = "small") => WrappedComponent => { | |
class LoadingScreen extends React.PureComponent { | |
render() { | |
if (this.props.loading) return <ActivityIndicator size={size} color="white" /> | |
return <WrappedComponent {...this.props} />; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import hoistNonReactStatics from 'hoist-non-react-statics'; | |
import { View, ActivityIndicator } from "react-native"; | |
const withLoadingScreen = WrappedComponent => { | |
class LoadingScreen extends React.PureComponent { | |
render() { | |
if (this.props.loading) return <ActivityIndicator size="small" color="white" /> | |
return <WrappedComponent {...this.props} />; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import { View, ActivityIndicator } from "react-native"; | |
const withLoadingScreen = WrappedComponent => { | |
return class LoadingScreen extends React.PureComponent { | |
render() { | |
if (this.props.loading) return <ActivityIndicator size="small" color="white" /> | |
return <WrappedComponent {...this.props} />; | |
} | |
}; |