MCPcopy Create free account
hub / github.com/callstack/react-native-paper / PortalConsumer

Class PortalConsumer

src/components/Portal/PortalConsumer.tsx:10–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8};
9
10export default class PortalConsumer extends React.Component<Props> {
11 componentDidMount() {
12 this.checkManager();
13
14 this.key = this.props.manager.mount(this.props.children);
15 }
16
17 componentDidUpdate() {
18 this.checkManager();
19
20 this.props.manager.update(this.key, this.props.children);
21 }
22
23 componentWillUnmount() {
24 this.checkManager();
25
26 this.props.manager.unmount(this.key);
27 }
28
29 private key: any;
30
31 private checkManager() {
32 if (!this.props.manager) {
33 throw new Error(
34 'Looks like you forgot to wrap your root component with `Provider` component from `react-native-paper`.\n\n' +
35 "Please read our getting-started guide and make sure you've followed all the required steps.\n\n" +
36 'https://callstack.github.io/react-native-paper/docs/guides/getting-started'
37 );
38 }
39 }
40
41 render() {
42 return null;
43 }
44}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…