Skip to content

Commit

Permalink
Remove shouldDecorateChildren option
Browse files Browse the repository at this point in the history
Unnecessary now that we're outputing to a function; just don't do
anything with the arguments if you don't want to.
  • Loading branch information
ragalie committed May 17, 2020
1 parent 6ea1702 commit 0dfcab4
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 223 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ Function receives one parameter with the signature `{ isMouseDetected: Boolean,

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

**shouldDecorateChildren** : Boolean - Suppress decoration of child components by
setting this prop false. Defaults to true.

**shouldStopTouchMovePropagation** : Boolean - Stop touchmove event bubbling when react-cursor-position is active. Defaults to false.

**style** : Object - Style to be applied to the div rendered by react-cursor-position.
Expand Down
63 changes: 0 additions & 63 deletions example/public/should-decorate-children.html

This file was deleted.

48 changes: 0 additions & 48 deletions example/src/components/ShouldDecorateChildren.js

This file was deleted.

79 changes: 0 additions & 79 deletions example/src/pages/ShouldDecorateChildren.js

This file was deleted.

2 changes: 0 additions & 2 deletions example/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import PositionChanged from './pages/PositionChanged';
import Home from './pages/Home';
import ImageMagnify from './pages/ImageMagnify';
import MapProps from './pages/MapProps';
import ShouldDecorateChildren from './pages/ShouldDecorateChildren';
import Style from './pages/Style';
import Support from './pages/Support';
import DetectedEnvironmentChanged from './pages/DetectedEnvironmentChanged';
Expand All @@ -32,7 +31,6 @@ const Routes = (props) => (
<Route path="/map-child-props" component={MapProps} />
<Route path="/on-position-changed" component={PositionChanged} />
<Route path="/on-activation-changed" component={ActivationChanged} />
<Route path="/should-decorate-children" component={ShouldDecorateChildren} />
<Route path="/style" component={Style} />
<Route path="/support" component={Support} />
<Route path="/reset" component={Reset} />
Expand Down
1 change: 0 additions & 1 deletion src/ReactCursorPosition.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ interface CursorPositionOptionsProps {
onPositionChanged?: (CursorPositionGeneratedProps) => void;
pressDurationInMs?: number;
pressMoveThreshold?: number;
shouldDecorateChildren?: boolean;
shouldStopTouchMovePropagation?: boolean;
style?: object;
tapDurationInMs?: number;
Expand Down
18 changes: 6 additions & 12 deletions src/ReactCursorPosition.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export default class extends React.Component {
onPositionChanged: PropTypes.func,
pressDurationInMs: PropTypes.number,
pressMoveThreshold: PropTypes.number,
shouldDecorateChildren: PropTypes.bool,
shouldStopTouchMovePropagation: PropTypes.bool,
style: PropTypes.object,
tapDurationInMs: PropTypes.number,
Expand All @@ -102,7 +101,6 @@ export default class extends React.Component {
onPositionChanged: noop,
pressDurationInMs: 500,
pressMoveThreshold: 5,
shouldDecorateChildren: true,
shouldStopTouchMovePropagation: false,
tapDurationInMs: 180,
tapMoveThreshold: 5,
Expand Down Expand Up @@ -455,16 +453,12 @@ export default class extends React.Component {
}

render() {
const { children, className, mapChildProps, shouldDecorateChildren, style } = this.props;
let props = {};

if (shouldDecorateChildren) {
props = objectAssign(
{},
mapChildProps(this.state),
this.getPassThroughProps()
);
}
const { children, className, mapChildProps, style } = this.props;
const props = objectAssign(
{},
mapChildProps(this.state),
this.getPassThroughProps()
);

return (
<div { ...{
Expand Down
14 changes: 0 additions & 14 deletions test/ReactCursorPosition.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,20 +704,6 @@ describe('ReactCursorPosition', () => {
expect(spy.mock.calls[0][0].isActive).toBe(true);
});

it('supports shouldDecorateChildren', () => {
const tree = getMountedComponentTree({
isActivatedOnTouch: true,
shouldDecorateChildren: false
});
const childComponent = tree.find(GenericSpanComponent);
const instance = tree.instance();
instance.onTouchStart(touchEvent);

instance.onTouchMove(getTouchEvent({ pageX: 3, pageY: 4 }));

expect(childComponent.props()).toEqual({});
});

describe('activationInteractionTouch', () => {
it('throws an error if an unsupported touch interaction is specified', () => {
function shouldThrow() {
Expand Down
1 change: 0 additions & 1 deletion test/__snapshots__/ReactCursorPosition.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Object {
"onPositionChanged": [Function],
"pressDurationInMs": 500,
"pressMoveThreshold": 5,
"shouldDecorateChildren": true,
"shouldStopTouchMovePropagation": false,
"tapDurationInMs": 180,
"tapMoveThreshold": 5,
Expand Down

0 comments on commit 0dfcab4

Please sign in to comment.