Skip to content

Commit 0dbf673

Browse files
committed
Prepare package for publishing
1 parent 844b1ea commit 0dbf673

33 files changed

+744
-299
lines changed

.npmignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
example
2-
src
2+
src
3+
screenshots

README.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
Redux DevTools implementation for React Native based on [redux-devtools-inspector](https://github.com/alexkuz/redux-devtools-inspector).
77

8+
For now, it's mostly a one-to-one port adjusted for mobile. Some features might be missing but I plan to implement in the future.
9+
810
![](https://raw.githubusercontent.com/mchudy/react-native-redux-devtools/master/screenshots/counter.png)
911

1012
### Installation
@@ -17,8 +19,37 @@ yarn add react-native-redux-devtools
1719

1820
### Usage
1921

22+
Create store composed with devtools:
2023
```js
24+
import { createStore, compose, applyMiddleware } from 'redux';
25+
import reducer from './reducer';
26+
import { DevTools } from 'react-native-redux-devtools';
27+
28+
const enhancer = compose(
29+
applyMiddleware(), // apply middlewares that you are using
30+
DevTools.instrument()
31+
);
32+
33+
export const store = createStore(reducer, enhancer);
34+
```
2135

36+
Then you can render devtools in your application:
37+
```jsx
38+
import * as React from 'react';
39+
import { View } from 'react-native';
40+
import { DevTools } from 'react-native-redux-devtools';
41+
42+
class App extends React.Component {
43+
render() {
44+
return (
45+
<View>
46+
{/* Your app content */}
47+
<DevTools />
48+
</View>
49+
);
50+
}
51+
}
2252
```
2353

24-
More details on how to set up devtools can be found in [redux-devtools documentation](https://github.com/reduxjs/redux-devtools/blob/master/docs/Walkthrough.md).
54+
Remember not to enable devtools in production builds!
55+
More details on how to set up devtools can be found in [redux-devtools documentation](https://github.com/reduxjs/redux-devtools/blob/master/docs/Walkthrough.md).

example/App.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { StyleSheet, Text, View, TouchableHighlight } from 'react-native';
33
import { actions } from './src/actions';
44
import { connect, Provider } from 'react-redux';
55
import { store } from './src/store';
6-
import DevTools from './src/DevTools';
6+
import { DevTools } from 'react-native-redux-devtools';
77

88
export default class Root extends React.Component {
99
render() {

example/package.json

+1-14
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,18 @@
99
},
1010
"dependencies": {
1111
"bind-decorator": "^1.0.11",
12-
"dateformat": "^3.0.3",
13-
"hex-rgba": "^1.0.2",
14-
"immutable": "^4.0.0-rc.12",
15-
"javascript-stringify": "^1.6.0",
16-
"jsondiffpatch": "^0.3.11",
17-
"moment": "^2.22.2",
1812
"react": "16.5.0",
19-
"react-base16-styling": "^0.6.0",
2013
"react-native": "0.57.2",
21-
"react-native-json-tree": "^1.2.0",
2214
"react-redux": "^5.0.7",
2315
"redux": "^4.0.0",
24-
"redux-devtools": "^3.4.1",
25-
"redux-devtools-themes": "^1.0.0"
16+
"react-native-redux-devtools": "file:.."
2617
},
2718
"devDependencies": {
2819
"@babel/plugin-proposal-decorators": "^7.1.2",
29-
"@types/dateformat": "^1.0.1",
30-
"@types/hex-rgba": "^1.0.0",
31-
"@types/immutable": "^3.8.7",
3220
"@types/react": "^16.4.15",
3321
"@types/react-native": "^0.57.2",
3422
"@types/react-redux": "^6.0.9",
3523
"@types/redux": "^3.6.0",
36-
"@types/redux-devtools": "^3.0.44",
3724
"babel-jest": "23.6.0",
3825
"jest": "23.6.0",
3926
"metro-react-native-babel-preset": "0.48.0",

example/src/actions.ts

-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ export enum ActionTypes {
66
export const actions = {
77
increment: () => ({
88
type: ActionTypes.INCREMENT,
9-
payload: {
10-
a: 1,
11-
b: true
12-
}
139
}),
1410
decrement: () => ({
1511
type: ActionTypes.DECREMENT

example/src/store.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createStore, compose, applyMiddleware } from 'redux';
22
import reducer from './reducer';
3-
import DevTools from './DevTools';
3+
import { DevTools } from 'react-native-redux-devtools';
44

55
const enhancer = compose(
66
applyMiddleware(),

example/yarn.lock

+17-48
Original file line numberDiff line numberDiff line change
@@ -662,23 +662,6 @@
662662
lodash "^4.17.10"
663663
to-fast-properties "^2.0.0"
664664

665-
"@types/dateformat@^1.0.1":
666-
version "1.0.1"
667-
resolved "https://registry.yarnpkg.com/@types/dateformat/-/dateformat-1.0.1.tgz#2e5b235c8c55652c4fec284506d2a36fe65fe87e"
668-
integrity sha1-LlsjXIxVZSxP7ChFBtKjb+Zf6H4=
669-
670-
"@types/hex-rgba@^1.0.0":
671-
version "1.0.0"
672-
resolved "https://registry.yarnpkg.com/@types/hex-rgba/-/hex-rgba-1.0.0.tgz#b2aed2aa9fdd6152b7f0ac5e3733b974d4eba35a"
673-
integrity sha512-u3AGV8fjRsDBqY4wOvVWhVCgKDfh2b0h3mux7KPKU1cm/6mJp14OWBINLgBypeBTM89Nm2j+eKQqIoIe7150DA==
674-
675-
"@types/immutable@^3.8.7":
676-
version "3.8.7"
677-
resolved "https://registry.yarnpkg.com/@types/immutable/-/immutable-3.8.7.tgz#536d33d30f3f3d9a6d4642a219419fd82af633fb"
678-
integrity sha1-U20z0w8/PZptRkKiGUGf2Cr2M/s=
679-
dependencies:
680-
immutable "*"
681-
682665
"@types/prop-types@*":
683666
version "15.5.6"
684667
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.5.6.tgz#9c03d3fed70a8d517c191b7734da2879b50ca26c"
@@ -708,14 +691,6 @@
708691
"@types/prop-types" "*"
709692
csstype "^2.2.0"
710693

711-
"@types/redux-devtools@^3.0.44":
712-
version "3.0.44"
713-
resolved "https://registry.yarnpkg.com/@types/redux-devtools/-/redux-devtools-3.0.44.tgz#2781b87067b8aec3102d4cb4a478feb340df5259"
714-
integrity sha512-FzLlfbx35XjYSY3lboIGwU/8dkwHoeFhxFxVz2KVgExH6eQNJUtFQ3W54tSrn/6mRHKDs/XFleaKhIXjrflTtA==
715-
dependencies:
716-
"@types/react" "*"
717-
redux "^3.6.0"
718-
719694
"@types/redux@^3.6.0":
720695
version "3.6.0"
721696
resolved "https://registry.yarnpkg.com/@types/redux/-/redux-3.6.0.tgz#f1ebe1e5411518072e4fdfca5c76e16e74c1399a"
@@ -2922,11 +2897,6 @@ image-size@^0.6.0:
29222897
resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.6.3.tgz#e7e5c65bb534bd7cdcedd6cb5166272a85f75fb2"
29232898
integrity sha512-47xSUiQioGaB96nqtp5/q55m0aBQSQdyIloMOc/x+QVTDZLNmXE892IIDrJ0hM1A5vcNUDD5tDffkSP5lCaIIA==
29242899

2925-
immutable@*:
2926-
version "3.8.2"
2927-
resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3"
2928-
integrity sha1-wkOZUUVbs5kT2vKBN28VMOEErfM=
2929-
29302900
immutable@^4.0.0-rc.12:
29312901
version "4.0.0-rc.12"
29322902
resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.0.0-rc.12.tgz#ca59a7e4c19ae8d9bf74a97bdf0f6e2f2a5d0217"
@@ -3888,7 +3858,7 @@ locate-path@^2.0.0:
38883858
p-locate "^2.0.0"
38893859
path-exists "^3.0.0"
38903860

3891-
lodash-es@^4.17.5, lodash-es@^4.2.1:
3861+
lodash-es@^4.17.5:
38923862
version "4.17.11"
38933863
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.11.tgz#145ab4a7ac5c5e52a3531fb4f310255a152b4be0"
38943864
integrity sha512-DHb1ub+rMjjrxqlB3H56/6MXtm1lSksDp2rA2cNWjG8mlDUYFhUj3Di2Zn5IwSU87xLv8tNIQ7sSwE/YOX/D/Q==
@@ -3928,7 +3898,7 @@ lodash.throttle@^4.1.1:
39283898
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
39293899
integrity sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=
39303900

3931-
lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1:
3901+
lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.6.1:
39323902
version "4.17.11"
39333903
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
39343904
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==
@@ -4360,11 +4330,6 @@ mkdirp@^0.5.0, mkdirp@^0.5.1:
43604330
dependencies:
43614331
minimist "0.0.8"
43624332

4363-
moment@^2.22.2:
4364-
version "2.22.2"
4365-
resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"
4366-
integrity sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=
4367-
43684333
morgan@^1.9.0:
43694334
version "1.9.1"
43704335
resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.9.1.tgz#0a8d16734a1d9afbc824b99df87e738e58e2da59"
@@ -5064,6 +5029,20 @@ react-native-json-tree@^1.2.0:
50645029
prop-types "^15.6.0"
50655030
react-base16-styling "github:dean177/react-base16-styling#fbc6593"
50665031

5032+
"react-native-redux-devtools@file:..":
5033+
version "0.0.1"
5034+
dependencies:
5035+
dateformat "^3.0.3"
5036+
hex-rgba "^1.0.2"
5037+
immutable "^4.0.0-rc.12"
5038+
javascript-stringify "^1.6.0"
5039+
jsondiffpatch "^0.3.11"
5040+
react-base16-styling "^0.6.0"
5041+
react-native-json-tree "^1.2.0"
5042+
redux "^4.0.0"
5043+
redux-devtools "^3.4.1"
5044+
redux-devtools-themes "^1.0.0"
5045+
50675046
react-native-typescript-transformer@^1.2.10:
50685047
version "1.2.10"
50695048
resolved "https://registry.yarnpkg.com/react-native-typescript-transformer/-/react-native-typescript-transformer-1.2.10.tgz#6f76c1449028cdeafa184b533301ecd547367ed1"
@@ -5272,16 +5251,6 @@ redux@*, redux@^4.0.0:
52725251
loose-envify "^1.1.0"
52735252
symbol-observable "^1.2.0"
52745253

5275-
redux@^3.6.0:
5276-
version "3.7.2"
5277-
resolved "https://registry.yarnpkg.com/redux/-/redux-3.7.2.tgz#06b73123215901d25d065be342eb026bc1c8537b"
5278-
integrity sha512-pNqnf9q1hI5HHZRBkj3bAngGZW/JMCmexDlOxw4XagXY2o1327nHH54LoTjiPJ0gizoqPDRqWyX/00g0hD6w+A==
5279-
dependencies:
5280-
lodash "^4.2.1"
5281-
lodash-es "^4.2.1"
5282-
loose-envify "^1.1.0"
5283-
symbol-observable "^1.0.3"
5284-
52855254
regenerate-unicode-properties@^7.0.0:
52865255
version "7.0.0"
52875256
resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-7.0.0.tgz#107405afcc4a190ec5ed450ecaa00ed0cafa7a4c"
@@ -5937,7 +5906,7 @@ supports-color@^5.3.0:
59375906
dependencies:
59385907
has-flag "^3.0.0"
59395908

5940-
symbol-observable@^1.0.2, symbol-observable@^1.0.3, symbol-observable@^1.2.0:
5909+
symbol-observable@^1.0.2, symbol-observable@^1.2.0:
59415910
version "1.2.0"
59425911
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804"
59435912
integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==

package.json

+14-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,22 @@
1414
"url": "git://github.com/mchudy/react-native-redux-devtools.git"
1515
},
1616
"dependencies": {
17-
"moment": "^2.22.2",
18-
"redux-devtools": "^3.4.1"
17+
"dateformat": "^3.0.3",
18+
"hex-rgba": "^1.0.2",
19+
"immutable": "^4.0.0-rc.12",
20+
"javascript-stringify": "^1.6.0",
21+
"jsondiffpatch": "^0.3.11",
22+
"react-base16-styling": "^0.6.0",
23+
"react-native-json-tree": "^1.2.0",
24+
"redux": "^4.0.0",
25+
"redux-devtools": "^3.4.1",
26+
"redux-devtools-themes": "^1.0.0"
1927
},
2028
"devDependencies": {
29+
"@types/hex-rgba": "^1.0.0",
30+
"@types/react": "^16.7.3",
31+
"@types/react-native": "^0.57.7",
32+
"bind-decorator": "^1.0.11",
2133
"typescript": "^3.1.1"
2234
}
2335
}

screenshots/counter.png

326 Bytes
Loading
File renamed without changes.

example/src/ActionList.tsx renamed to src/ActionList.tsx

-5
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,11 @@ export class ActionList extends React.Component<ActionListProps> {
3232
const {
3333
actions,
3434
actionIds,
35-
onToggleAction,
3635
skippedActionIds,
37-
selectedActionId,
38-
startActionId,
3936
onSearch,
4037
searchValue,
41-
currentActionId,
4238
onCommit,
4339
onSweep,
44-
onJumpToState,
4540
styling
4641
} = this.props;
4742
const lowerSearchValue = searchValue && searchValue.toLowerCase();

example/src/ActionListHeader.tsx renamed to src/ActionListHeader.tsx

+3-9
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ export class ActionListHeader extends React.Component<ActionListHeaderProps> {
88
styling,
99
onSearch,
1010
hasSkippedActions,
11-
hasStagedActions,
12-
onCommit,
13-
onSweep
11+
hasStagedActions
1412
} = this.props;
13+
1514
return (
1615
<View {...styling('actionListHeader')}>
1716
<TextInput
@@ -23,7 +22,7 @@ export class ActionListHeader extends React.Component<ActionListHeaderProps> {
2322
}
2423
/>
2524
{!!hasStagedActions && (
26-
<View style={{ flexDirection: 'row' }}>
25+
<View {...styling('actionListHeaderButtonContainer')}>
2726
{!!hasSkippedActions &&
2827
this.renderButton(Button.SWEEP, ['selectorButtonFirst'])}
2928
{this.renderButton(Button.COMMIT, [
@@ -60,11 +59,6 @@ export class ActionListHeader extends React.Component<ActionListHeaderProps> {
6059
}
6160
}
6261

63-
const getActiveButtons = (hasSkippedActions: boolean): Button[] =>
64-
[hasSkippedActions ? Button.SWEEP : null, Button.COMMIT].filter(
65-
Boolean
66-
) as Button[];
67-
6862
enum Button {
6963
SWEEP = 'Sweep',
7064
COMMIT = 'Commit'

example/src/ActionListRow.tsx renamed to src/ActionListRow.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class ActionListRow extends React.Component<
3232
} = this.props;
3333
const timeDelta = timestamps.current - timestamps.previous;
3434
const showButtons = (this.state.showButtons && !isInitAction) || isSkipped;
35-
console.warn(isInFuture);
35+
3636
let actionType = action.type;
3737
if (typeof actionType === 'undefined') {
3838
actionType = '<UNDEFINED>';

example/src/ActionPreview.tsx renamed to src/ActionPreview.tsx

+5-18
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ export class ActionPreview extends React.Component<ActionPreviewProps> {
3333
delta,
3434
error,
3535
nextState,
36-
onInspectPath,
37-
inspectedPath,
3836
tabName,
3937
onSelectTab,
4038
action,
@@ -64,7 +62,7 @@ export class ActionPreview extends React.Component<ActionPreviewProps> {
6462
<View {...styling('actionPreviewContainer')}>
6563
<ActionPreviewHeader
6664
tabs={renderedTabs}
67-
{...{ inspectedPath, onInspectPath, tabName, onSelectTab, styling }}
65+
{...{ tabName, onSelectTab, styling }}
6866
/>
6967
{!error && (
7068
<ScrollView>
@@ -86,31 +84,22 @@ export class ActionPreview extends React.Component<ActionPreviewProps> {
8684
)}
8785
</ScrollView>
8886
)}
89-
{error &&
90-
<Text {...styling('stateError')}>{error}</Text>
91-
}
87+
{error && <Text {...styling('stateError')}>{error}</Text>}
9288
</View>
9389
);
9490
}
9591

9692
@bind
9793
private labelRenderer(
98-
[key, ...rest]: any,
99-
nodeType: string,
94+
[key, ..._rest]: any,
95+
_nodeType: string,
10096
expanded: boolean
10197
) {
102-
const { styling, onInspectPath, inspectedPath } = this.props;
98+
const { styling } = this.props;
10399

104100
return (
105101
<Text>
106102
<Text {...styling('treeItemKey')}>{key}</Text>
107-
{/* <span {...styling('treeItemPin')}
108-
onClick={() => onInspectPath([
109-
...inspectedPath.slice(0, inspectedPath.length - 1),
110-
...[key, ...rest].reverse()
111-
])}>
112-
{'(pin)'}
113-
</span> */}
114103
{!expanded && ': '}
115104
</Text>
116105
);
@@ -120,8 +109,6 @@ export class ActionPreview extends React.Component<ActionPreviewProps> {
120109
interface ActionPreviewProps {
121110
tabs?: ((defaultTabs: Tab[]) => Tab[]) | Tab[];
122111
tabName: TabName;
123-
inspectedPath: string[];
124-
onInspectPath: (path: string[]) => void;
125112
delta?: Delta;
126113
error?: string;
127114
onSelectTab: (tabName: TabName) => void;

0 commit comments

Comments
 (0)