| 67 | )(Monitor as React.ComponentType<any>); |
| 68 | |
| 69 | return class DevTools extends Component< |
| 70 | Props<S, A, MonitorState, MonitorAction> |
| 71 | > { |
| 72 | static contextTypes = { |
| 73 | store: PropTypes.object, |
| 74 | }; |
| 75 | |
| 76 | static propTypes = { |
| 77 | store: PropTypes.object, |
| 78 | }; |
| 79 | |
| 80 | liftedStore?: LiftedStore<S, A, MonitorState>; |
| 81 | |
| 82 | static instrument = ( |
| 83 | options?: Options<S, A, MonitorState, MonitorAction> |
| 84 | ) => |
| 85 | instrument( |
| 86 | (state, action) => Monitor.update(monitorProps, state, action), |
| 87 | options |
| 88 | ); |
| 89 | |
| 90 | constructor( |
| 91 | props: Props<S, A, MonitorState, MonitorAction>, |
| 92 | context: { store?: EnhancedStore<S, A, MonitorState> } |
| 93 | ) { |
| 94 | super(props, context); |
| 95 | |
| 96 | if (ReactReduxContext) { |
| 97 | if (this.props.store && !this.props.store.liftedStore) { |
| 98 | logError('NoLiftedStore'); |
| 99 | } |
| 100 | return; |
| 101 | } |
| 102 | |
| 103 | if (!props.store && !context.store) { |
| 104 | logError('NoStore'); |
| 105 | return; |
| 106 | } |
| 107 | |
| 108 | if (context.store) { |
| 109 | this.liftedStore = context.store.liftedStore; |
| 110 | } else { |
| 111 | this.liftedStore = props.store!.liftedStore; |
| 112 | } |
| 113 | |
| 114 | if (!this.liftedStore) { |
| 115 | logError('NoLiftedStore'); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | render() { |
| 120 | if (ReactReduxContext) { |
| 121 | // For react-redux@6 |
| 122 | if (this.props.store) { |
| 123 | if (!this.props.store.liftedStore) { |
| 124 | return null; |
| 125 | } |
| 126 | return ( |
nothing calls this directly
no test coverage detected