Skip to content

Commit 48ca60e

Browse files
committed
Remove shouldDecorateChildren option
Unnecessary now that we're outputing to a function; just don't do anything with the arguments if you don't want to.
1 parent 3b0be56 commit 48ca60e

File tree

9 files changed

+6
-223
lines changed

9 files changed

+6
-223
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ Function receives one parameter with the signature `{ isMouseDetected: Boolean,
107107

108108
**pressMoveThreshold** : Number - Amount of movement, in pixels, allowed during press gesture detection. Defaults to 5.
109109

110-
**shouldDecorateChildren** : Boolean - Suppress decoration of child components by
111-
setting this prop false. Defaults to true.
112-
113110
**shouldStopTouchMovePropagation** : Boolean - Stop touchmove event bubbling when react-cursor-position is active. Defaults to false.
114111

115112
**style** : Object - Style to be applied to the div rendered by react-cursor-position.

example/public/should-decorate-children.html

Lines changed: 0 additions & 63 deletions
This file was deleted.

example/src/components/ShouldDecorateChildren.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

example/src/pages/ShouldDecorateChildren.js

Lines changed: 0 additions & 79 deletions
This file was deleted.

example/src/router.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import PositionChanged from './pages/PositionChanged';
1212
import Home from './pages/Home';
1313
import ImageMagnify from './pages/ImageMagnify';
1414
import MapProps from './pages/MapProps';
15-
import ShouldDecorateChildren from './pages/ShouldDecorateChildren';
1615
import Style from './pages/Style';
1716
import Support from './pages/Support';
1817
import DetectedEnvironmentChanged from './pages/DetectedEnvironmentChanged';
@@ -32,7 +31,6 @@ const Routes = (props) => (
3231
<Route path="/map-child-props" component={MapProps} />
3332
<Route path="/on-position-changed" component={PositionChanged} />
3433
<Route path="/on-activation-changed" component={ActivationChanged} />
35-
<Route path="/should-decorate-children" component={ShouldDecorateChildren} />
3634
<Route path="/style" component={Style} />
3735
<Route path="/support" component={Support} />
3836
<Route path="/reset" component={Reset} />

src/ReactCursorPosition.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ interface CursorPositionOptionsProps {
3737
onPositionChanged?: (CursorPositionGeneratedProps) => void;
3838
pressDurationInMs?: number;
3939
pressMoveThreshold?: number;
40-
shouldDecorateChildren?: boolean;
4140
shouldStopTouchMovePropagation?: boolean;
4241
style?: object;
4342
tapDurationInMs?: number;

src/ReactCursorPosition.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ export default class extends React.Component {
8383
onPositionChanged: PropTypes.func,
8484
pressDurationInMs: PropTypes.number,
8585
pressMoveThreshold: PropTypes.number,
86-
shouldDecorateChildren: PropTypes.bool,
8786
shouldStopTouchMovePropagation: PropTypes.bool,
8887
style: PropTypes.object,
8988
tapDurationInMs: PropTypes.number,
@@ -102,7 +101,6 @@ export default class extends React.Component {
102101
onPositionChanged: noop,
103102
pressDurationInMs: 500,
104103
pressMoveThreshold: 5,
105-
shouldDecorateChildren: true,
106104
shouldStopTouchMovePropagation: false,
107105
tapDurationInMs: 180,
108106
tapMoveThreshold: 5,
@@ -455,16 +453,12 @@ export default class extends React.Component {
455453
}
456454

457455
render() {
458-
const { children, className, mapChildProps, shouldDecorateChildren, style } = this.props;
459-
let props = {};
460-
461-
if (shouldDecorateChildren) {
462-
props = objectAssign(
463-
{},
464-
mapChildProps(this.state),
465-
this.getPassThroughProps()
466-
);
467-
}
456+
const { children, className, mapChildProps, style } = this.props;
457+
const props = objectAssign(
458+
{},
459+
mapChildProps(this.state),
460+
this.getPassThroughProps()
461+
);
468462

469463
return (
470464
<div { ...{

test/ReactCursorPosition.spec.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -704,20 +704,6 @@ describe('ReactCursorPosition', () => {
704704
expect(spy.mock.calls[0][0].isActive).toBe(true);
705705
});
706706

707-
it('supports shouldDecorateChildren', () => {
708-
const tree = getMountedComponentTree({
709-
isActivatedOnTouch: true,
710-
shouldDecorateChildren: false
711-
});
712-
const childComponent = tree.find(GenericSpanComponent);
713-
const instance = tree.instance();
714-
instance.onTouchStart(touchEvent);
715-
716-
instance.onTouchMove(getTouchEvent({ pageX: 3, pageY: 4 }));
717-
718-
expect(childComponent.props()).toEqual({});
719-
});
720-
721707
describe('activationInteractionTouch', () => {
722708
it('throws an error if an unsupported touch interaction is specified', () => {
723709
function shouldThrow() {

test/__snapshots__/ReactCursorPosition.spec.js.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Object {
1313
"onPositionChanged": [Function],
1414
"pressDurationInMs": 500,
1515
"pressMoveThreshold": 5,
16-
"shouldDecorateChildren": true,
1716
"shouldStopTouchMovePropagation": false,
1817
"tapDurationInMs": 180,
1918
"tapMoveThreshold": 5,

0 commit comments

Comments
 (0)