+
{title}
+
+
+
+ {JSON.stringify(json, null, 2)}
+
+
+
+
+ );
+}
+ViewSourceBlock.propTypes = {
+ title: PropTypes.string.isRequired,
+ json: PropTypes.shape({}).isRequired,
+};
+
+function ViewSource() {
+ const [isOpen, setIsOpen] = useState(false);
+ const [event, setEvent] = useState(null);
+
+ useEffect(() => {
+ const loadViewSource = (e) => {
+ setEvent(e);
+ setIsOpen(true);
+ };
+ navigation.on(cons.events.navigation.VIEWSOURCE_OPENED, loadViewSource);
+ return () => {
+ navigation.removeListener(cons.events.navigation.VIEWSOURCE_OPENED, loadViewSource);
+ };
+ }, []);
+
+ const handleAfterClose = () => {
+ setEvent(null);
+ };
+
+ const renderViewSource = () => (
+