A constructor to instantiate ModuleScreen.
If using the new style context, re-declare this in your class to be the
React.ContextType
of your static contextType
.
Should be used with type annotation or static contextType.
static contextType = MyContext
// For TS pre-3.7:
context!: React.ContextType<typeof MyContext>
// For TS 3.7 and above:
declare context: React.ContextType<typeof MyContext>
An object that is requested to execute the screen component. It is initialized in constructor through props.
An instance of IModuleMessenger for communication between components rendered on the same screen. It is initialized in constructor through props.
An object that is described about an environment of the screen component. It is initialized in constructor through props.
An interface to interact with screen.
An object to apply system theme on the screen component.
import { ThemeProvider } from "@mui/material/styles";
...
class MainScreen extends ModuleScreen {
...
render() {
return(
<ThemeProvider theme={this.systemTheme}>
...
</ThemeProvider>
);
}
}
If set, this.context
will be set at runtime to the current value of the given Context.
Usage:
type MyContext = number
const Ctx = React.createContext<MyContext>(0)
class Foo extends React.Component {
static contextType = Ctx
context!: React.ContextType<typeof Ctx>
render () {
return <>My context's value: {this.context}</>;
}
}
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.
Called immediately after a component is mounted. Setting state here will trigger re-rendering.
Called immediately after updating occurs. Not called for the initial render.
The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
cancelled network requests, or cleaning up any DOM elements created in componentDidMount
.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Get screen mode. Available modes are:
Return a current screen mode.
Runs before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
Whether the screen is focused or not.
Return true if the screen is focused or not.
Whether the screen is visible or not. In the case of a PopupScreen, it is not focused, but can be seen.
Return true if the screen is visible or not.
Called when a client has been bound to this screen component.
A Message that was used to bind to this screen component.
An empty IModuleChannel. The screen component should be defined events which are proper about the message.
Return true if you implemented events on the IModuleChannel which is sent as parameter. May return false if the screen component doesn't support interface about the message.
Called when the module's data have been synchronized. When Dart-Platform gets control, it initializes the Dart-Platform's system and modules internal data to the data that is synchronized with the Controller.
Override to handle new message which has been sent by system. Should not be call super method:
onNewMessage(message: Message) {
// super.onNewMessage(message); <-- do not call super method
// implement here to handle the new message
}
A new message.
Return true if the message has been handled, otherwise false.
Called when the screen has been dragged. This event only occurs if the module screen type is ScreenType.POPUP_SCREEN.
Called when screen's focus state has been changed.
A focused state.
Called when screen's screen mode state has been changed.
A screen mode. It is either PopupScreenMode.SINGLE or PopupScreenMode.DUAL.
Called when screen's visible state has been changed.
A visible state.
Called to determine whether the change in props and state should trigger a re-render.
Component
always returns true.
PureComponent
implements a shallow comparison on props and state and returns true if any
props or states have changed.
If false is returned, Component#render
, componentWillUpdate
and componentDidUpdate
will not be called.
Generated using TypeDoc
An abstract class to be inherited on screen component class of the Module package. Screen component is an executable unit on DART-Platform. Conceptually,the components are like React functions. They accept arbitrary inputs (called “props”) and return React elements describing what should appear on the screen.
This component has a lifecycle. For more information on each lifecycle, see React.Component's lifecycle.
An type params to describe a React.Component's state object.
1