@actbase/native
Advanced tools
Comparing version 0.1.23 to 0.1.24
import { PropsWithChildren } from 'react'; | ||
import { StyleProp, ViewStyle } from 'react-native'; | ||
import { ReduxStore } from './devtools/common'; | ||
interface Props { | ||
@@ -9,2 +10,3 @@ style?: StyleProp<ViewStyle>; | ||
}; | ||
reduxStore?: ReduxStore; | ||
} | ||
@@ -15,3 +17,3 @@ export declare const Providers: { | ||
}; | ||
export declare const Application: ({ children, style, debug }: PropsWithChildren<Props>) => JSX.Element; | ||
export declare const Application: ({ children, style, debug, reduxStore }: PropsWithChildren<Props>) => JSX.Element; | ||
export {}; |
@@ -37,3 +37,4 @@ "use strict"; | ||
style = _a.style, | ||
debug = _a.debug; | ||
debug = _a.debug, | ||
reduxStore = _a.reduxStore; | ||
@@ -84,3 +85,4 @@ var oChildren = _react["default"].Children.toArray(children); | ||
return _react["default"].createElement(_reactNativeSafeAreaContext.SafeAreaProvider, null, _react["default"].createElement(_devtools["default"], { | ||
debug: debug | ||
debug: debug, | ||
reduxStore: reduxStore | ||
}, _react["default"].createElement(_reactNative.View, { | ||
@@ -87,0 +89,0 @@ style: style |
@@ -42,2 +42,3 @@ export declare const BUBBLE_SIZE = 58; | ||
}; | ||
redux?: ReduxStore; | ||
} | ||
@@ -66,1 +67,10 @@ export interface DevToolHooks { | ||
} | ||
export interface ReduxStore { | ||
getState: () => { | ||
[key: string]: unknown; | ||
}; | ||
} | ||
export declare type RowData = { | ||
key: string; | ||
value: string; | ||
}; |
import React, { PropsWithChildren } from 'react'; | ||
import { DevToolContext, DevToolHooks } from './common'; | ||
import { DevToolContext, DevToolHooks, ReduxStore } from './common'; | ||
export declare const DevContext: React.Context<DevToolContext>; | ||
@@ -10,4 +10,5 @@ export declare const useDevTools: () => DevToolHooks; | ||
}; | ||
reduxStore?: ReduxStore; | ||
} | ||
declare const DevTools: ({ debug, children }: PropsWithChildren<Props>) => JSX.Element; | ||
declare const DevTools: ({ debug, children, reduxStore }: PropsWithChildren<Props>) => JSX.Element; | ||
export default DevTools; |
@@ -47,3 +47,4 @@ "use strict"; | ||
var debug = _a.debug, | ||
children = _a.children; | ||
children = _a.children, | ||
reduxStore = _a.reduxStore; | ||
@@ -58,2 +59,6 @@ var _b = (0, _react.useState)(!debug), | ||
var _d = (0, _react.useState)(reduxStore), | ||
redux = _d[0], | ||
setRedux = _d[1]; | ||
(0, _react.useEffect)(function () { | ||
@@ -75,9 +80,14 @@ if (debug && !(typeof debug === 'boolean')) { | ||
}, [debug]); | ||
(0, _react.useEffect)(function () { | ||
setRedux(reduxStore); | ||
}, [reduxStore]); | ||
var _d = (0, _react.useMemo)(function () { | ||
var _e = (0, _react.useMemo)(function () { | ||
var e = disabled ? _react.Fragment : _tools["default"]; | ||
return [e, !disabled ? options : {}]; | ||
return [e, !disabled ? (0, _tslib.__assign)((0, _tslib.__assign)({}, options), { | ||
redux: redux | ||
}) : {}]; | ||
}, [disabled, options]), | ||
ToolElement = _d[0], | ||
toolProps = _d[1]; | ||
ToolElement = _e[0], | ||
toolProps = _e[1]; | ||
@@ -84,0 +94,0 @@ return _react["default"].createElement(DevContext.Provider, { |
@@ -7,7 +7,3 @@ /// <reference types="react" /> | ||
}; | ||
export declare type RowData = { | ||
key: string; | ||
value: string; | ||
}; | ||
declare const AsyncStorage: () => JSX.Element; | ||
export default AsyncStorage; |
import { PropsWithChildren } from 'react'; | ||
import { DevToolOptions } from './common'; | ||
declare const Tools: ({ children, module, console }: PropsWithChildren<DevToolOptions>) => JSX.Element; | ||
declare const Tools: ({ children, module, console, redux }: PropsWithChildren<DevToolOptions>) => JSX.Element; | ||
export default Tools; |
@@ -36,2 +36,4 @@ "use strict"; | ||
var _redux = _interopRequireDefault(require("./redux")); | ||
var _index = require("./index"); | ||
@@ -52,3 +54,4 @@ | ||
module = _a.module, | ||
console = _a.console; | ||
console = _a.console, | ||
redux = _a.redux; | ||
var inset = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)(); | ||
@@ -134,3 +137,23 @@ | ||
}, [enableAS]); | ||
var enableRedux = !!redux; | ||
(0, _react.useEffect)(function () { | ||
setModules(function (x) { | ||
var draft = (0, _tslib.__spreadArrays)(x); | ||
var ix = draft.findIndex(function (y) { | ||
return y.key === 'redux'; | ||
}); | ||
if (!enableRedux && ix >= 0) { | ||
draft.splice(ix, 1); | ||
} else if (enableRedux && ix < 0) { | ||
draft.push({ | ||
key: 'redux', | ||
name: 'Redux' | ||
}); | ||
} | ||
return draft; | ||
}); | ||
}, [enableRedux]); | ||
var options = _react["default"].useContext(_index.DevContext).options; | ||
@@ -372,4 +395,10 @@ | ||
if ((mod === null || mod === void 0 ? void 0 : mod.key) === 'redux') { | ||
return _react["default"].createElement(_redux["default"], { | ||
store: redux | ||
}); | ||
} | ||
return undefined; | ||
}, [modules, index, httpLogs, consoleLogs]); | ||
}, [modules, index, httpLogs, consoleLogs, redux]); | ||
return _react["default"].createElement(_react["default"].Fragment, null, children, _react["default"].createElement(_reactNative.Animated.View, (0, _tslib.__assign)({}, panResponder.panHandlers, { | ||
@@ -409,4 +438,6 @@ style: [_styles["default"].bubble, { | ||
}, | ||
showsHorizontalScrollIndicator: false, | ||
contentContainerStyle: { | ||
paddingLeft: _common.BUBBLE_SIZE / 2 + 5, | ||
paddingRight: 20, | ||
paddingVertical: 10 | ||
@@ -413,0 +444,0 @@ } |
{ | ||
"name": "@actbase/native", | ||
"version": "0.1.23", | ||
"version": "0.1.24", | ||
"description": "React-Native Generic UI Components", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
247853
93
3495