Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
withLoadingScreen with hoist-non
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} />;
}
};
hoistNonReactStatics(LoadingScreen, WrappedComponent);
return LoadingScreen
};
export default withLoadingScreen;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.