Skip to content

Commit d8eba7e

Browse files
committed
[style] Code style updates after linter upgrade
1 parent 203f58b commit d8eba7e

13 files changed

+58
-62
lines changed

src/SharedElement.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import {
33
SharedElement as RawSharedElement,
4-
SharedElementProps as RawSharedElementProps
4+
SharedElementProps as RawSharedElementProps,
55
} from "react-native-shared-element";
66

77
import SharedElementSceneContext from "./SharedElementSceneContext";
@@ -30,7 +30,7 @@ class SharedElement extends React.Component<SharedElementProps> {
3030
} = this.props;
3131
return (
3232
<SharedElementSceneContext.Consumer>
33-
{sceneData => {
33+
{(sceneData) => {
3434
/*invariant(
3535
sceneData != null,
3636
'The SharedElementSceneContext is not set, did you forget to wrap your scene component with `createSharedElementScene(..)`?'

src/SharedElementCompatRouteProxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class SharedElementCompatRouteProxy implements SharedElementCompatRoute {
4747
this.deprecatedStateCache = this.deprecatedStateCache || {
4848
key: this.key,
4949
routeName: this.name,
50-
params: this.params
50+
params: this.params,
5151
};
5252
return this.deprecatedStateCache;
5353
}

src/SharedElementFocusEvents.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
NavigationContext,
3-
StackNavigationState
3+
StackNavigationState,
44
} from "@react-navigation/native";
55
import * as React from "react";
66

@@ -15,7 +15,7 @@ import { EventEmitter } from "./utils/EventEmitter";
1515
*/
1616
export function useSharedElementFocusEvents({
1717
state,
18-
emitter
18+
emitter,
1919
}: {
2020
state: StackNavigationState;
2121
emitter: EventEmitter;

src/SharedElementRendererData.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { SharedElementCompatRouteProxy } from "./SharedElementCompatRouteProxy";
22
import SharedElementSceneData, {
3-
SharedElementSceneEventType
3+
SharedElementSceneEventType,
44
} from "./SharedElementSceneData";
55
import {
66
SharedElementEventSubscription,
77
SharedElementsStrictConfig,
88
SharedElementAnimatedValue,
99
SharedElementTransitionProps,
10-
SharedElementRoute
10+
SharedElementRoute,
1111
} from "./types";
1212
import { normalizeSharedElementsConfig } from "./utils";
1313

@@ -257,7 +257,7 @@ export default class SharedElementRendererData
257257
private registerScene(scene: SharedElementSceneData) {
258258
this.scenes.push({
259259
scene,
260-
subscription: null
260+
subscription: null,
261261
});
262262
if (this.scenes.length > 10) {
263263
const { subscription } = this.scenes[0];
@@ -268,7 +268,7 @@ export default class SharedElementRendererData
268268
}
269269

270270
private updateSceneListeners() {
271-
this.scenes.forEach(sceneRoute => {
271+
this.scenes.forEach((sceneRoute) => {
272272
const { scene, subscription } = sceneRoute;
273273
const isActive =
274274
(this.route && this.route.key === scene.route.key) ||
@@ -289,7 +289,7 @@ export default class SharedElementRendererData
289289
route: SharedElementRoute | null
290290
): SharedElementSceneData | null {
291291
const sceneRoute = route
292-
? this.scenes.find(sc => sc.scene.route.key === route.key)
292+
? this.scenes.find((sc) => sc.scene.route.key === route.key)
293293
: undefined;
294294
return sceneRoute ? sceneRoute.scene : null;
295295
}
@@ -355,7 +355,7 @@ export default class SharedElementRendererData
355355
}
356356

357357
private emitUpdateEvent(): void {
358-
this.updateSubscribers.forEach(handler => handler());
358+
this.updateSubscribers.forEach((handler) => handler());
359359
}
360360

361361
getTransitions(): SharedElementTransitionProps[] {
@@ -364,7 +364,7 @@ export default class SharedElementRendererData
364364
prevScene,
365365
scene,
366366
isShowing,
367-
sceneAnimValue
367+
sceneAnimValue,
368368
} = this;
369369

370370
if (!sharedElements || !scene || !prevScene) return NO_SHARED_ELEMENTS;
@@ -376,13 +376,13 @@ export default class SharedElementRendererData
376376
position: sceneAnimValue,
377377
start: {
378378
ancestor: (prevScene ? prevScene.getAncestor() : undefined) || null,
379-
node: (prevScene ? prevScene.getNode(startId) : undefined) || null
379+
node: (prevScene ? prevScene.getNode(startId) : undefined) || null,
380380
},
381381
end: {
382382
ancestor: (scene ? scene.getAncestor() : undefined) || null,
383-
node: (scene ? scene.getNode(endId) : undefined) || null
383+
node: (scene ? scene.getNode(endId) : undefined) || null,
384384
},
385-
...other
385+
...other,
386386
};
387387
});
388388
}

src/SharedElementRendererProxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ISharedElementRendererData } from "./SharedElementRendererData";
22
import SharedElementSceneData, {
3-
SharedElementSceneEventType
3+
SharedElementSceneEventType,
44
} from "./SharedElementSceneData";
55

66
export class SharedElementRendererProxy implements ISharedElementRendererData {

src/SharedElementSceneData.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
SharedElementAnimatedValue,
55
SharedElementRoute,
66
SharedElementSceneComponent,
7-
SharedElementsComponentConfig
7+
SharedElementsComponentConfig,
88
} from "./types";
99

1010
export type SharedElementSceneUpdateHandlerEventType =
@@ -20,7 +20,7 @@ export type SharedElementSceneUpdateHandler = (
2020

2121
const INVERT_OPTIONS = {
2222
inputRange: [0, 1],
23-
outputRange: [1, 0]
23+
outputRange: [1, 0],
2424
};
2525

2626
export type SharedElementSceneEventType =
@@ -123,6 +123,6 @@ export default class SharedElementSceneData {
123123
node: SharedElementNode | undefined,
124124
id: string
125125
): void {
126-
this.updateSubscribers.forEach(handler => handler(eventType, node, id));
126+
this.updateSubscribers.forEach((handler) => handler(eventType, node, id));
127127
}
128128
}

src/createSharedElementScene.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Route, NavigationState } from "@react-navigation/native";
22
import {
33
StackNavigationProp,
4-
StackCardInterpolationProps
4+
StackCardInterpolationProps,
55
} from "@react-navigation/stack";
66
import hoistNonReactStatics from "hoist-non-react-statics";
77
import * as React from "react";
@@ -15,14 +15,14 @@ import {
1515
SharedElementEventSubscription,
1616
SharedElementSceneComponent,
1717
SharedElementRoute,
18-
SharedElementsComponentConfig
18+
SharedElementsComponentConfig,
1919
} from "./types";
2020
import { EventEmitter } from "./utils/EventEmitter";
2121

2222
const styles = StyleSheet.create({
2323
container: {
24-
flex: 1
25-
}
24+
flex: 1,
25+
},
2626
});
2727

2828
type PropsType = {
@@ -68,7 +68,7 @@ function createSharedElementScene(
6868
rendererData,
6969
AnimationContext,
7070
navigatorId,
71-
verbose
71+
verbose,
7272
};
7373

7474
class SharedElementSceneView extends React.PureComponent<PropsType> {
@@ -98,7 +98,7 @@ function createSharedElementScene(
9898
transitionEnd: navigation.addListener(
9999
"transitionEnd",
100100
this.onTransitionEnd
101-
)
101+
),
102102
};
103103
}
104104

@@ -123,7 +123,7 @@ function createSharedElementScene(
123123
};
124124

125125
componentWillUnmount() {
126-
Object.values(this.subscriptions).forEach(unsubscribe => unsubscribe());
126+
Object.values(this.subscriptions).forEach((unsubscribe) => unsubscribe());
127127
}
128128

129129
render() {

src/createSharedElementStackNavigator.tsx

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import {
55
RouteConfig,
66
StackRouter,
77
StackRouterOptions,
8-
StackNavigationState
8+
StackNavigationState,
99
} from "@react-navigation/native";
1010
import {
1111
CardAnimationContext,
1212
StackView,
13-
StackNavigationOptions
13+
StackNavigationOptions,
1414
} from "@react-navigation/stack";
1515
import {
1616
StackNavigationConfig,
17-
StackNavigationEventMap
17+
StackNavigationEventMap,
1818
} from "@react-navigation/stack/lib/typescript/src/types";
1919
import * as React from "react";
2020
import { Platform } from "react-native";
@@ -27,7 +27,7 @@ import SharedElementRendererView from "./SharedElementRendererView";
2727
import createSharedElementScene from "./createSharedElementScene";
2828
import {
2929
SharedElementSceneComponent,
30-
SharedElementsComponentConfig
30+
SharedElementsComponentConfig,
3131
} from "./types";
3232
import { EventEmitter } from "./utils/EventEmitter";
3333

@@ -41,7 +41,7 @@ export default function createSharedElementStackNavigator<
4141
// didn't rename to `createSharedElementStackNavigator4`.
4242
if (
4343
options &&
44-
Object.keys(options).filter(key => key !== "name" && key !== "debug")
44+
Object.keys(options).filter((key) => key !== "name" && key !== "debug")
4545
.length > 0
4646
) {
4747
throw new Error(
@@ -70,7 +70,7 @@ export default function createSharedElementStackNavigator<
7070
}: Props) {
7171
const defaultOptions = {
7272
gestureEnabled: Platform.OS === "ios",
73-
animationEnabled: Platform.OS !== "web"
73+
animationEnabled: Platform.OS !== "web",
7474
};
7575
const { state, descriptors, navigation } = useNavigationBuilder<
7676
StackNavigationState,
@@ -84,12 +84,12 @@ export default function createSharedElementStackNavigator<
8484
typeof screenOptions === "function"
8585
? (...args) => ({
8686
...defaultOptions,
87-
...screenOptions(...args)
87+
...screenOptions(...args),
8888
})
8989
: {
9090
...defaultOptions,
91-
...screenOptions
92-
}
91+
...screenOptions,
92+
},
9393
});
9494

9595
const rendererDataRef = React.useRef<SharedElementRendererData | null>(
@@ -109,7 +109,7 @@ export default function createSharedElementStackNavigator<
109109

110110
return (
111111
<SharedElementRendererContext.Consumer>
112-
{rendererData => {
112+
{(rendererData) => {
113113
// In case a renderer is already present higher up in the chain
114114
// then don't bother creating a renderer here, but use that one instead
115115
if (!rendererData) {
@@ -131,9 +131,7 @@ export default function createSharedElementStackNavigator<
131131
<SharedElementRendererView
132132
rendererData={rendererDataRef.current}
133133
/>
134-
) : (
135-
undefined
136-
)}
134+
) : undefined}
137135
</SharedElementRendererContext.Provider>
138136
);
139137
}}
@@ -258,6 +256,6 @@ export default function createSharedElementStackNavigator<
258256

259257
return {
260258
Navigator: WrapNavigator,
261-
Screen: wrapScreen
259+
Screen: wrapScreen,
262260
};
263261
}

src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import {
33
SharedElementAnimation,
44
SharedElementResize,
55
SharedElementAlign,
6-
SharedElementTransitionProps
6+
SharedElementTransitionProps,
77
} from "react-native-shared-element";
88

99
export {
1010
SharedElementNode,
1111
SharedElementAnimation,
12-
SharedElementTransitionProps
12+
SharedElementTransitionProps,
1313
};
1414

1515
export type SharedElementEventSubscription = () => void;

src/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
SharedElementConfig,
33
SharedElementsConfig,
44
SharedElementStrictConfig,
5-
SharedElementsStrictConfig
5+
SharedElementsStrictConfig,
66
} from "./types";
77

88
export function normalizeSharedElementConfig(
@@ -12,15 +12,15 @@ export function normalizeSharedElementConfig(
1212
return {
1313
id: sharedElementConfig,
1414
otherId: sharedElementConfig,
15-
animation: "move"
15+
animation: "move",
1616
};
1717
} else {
1818
const { id, otherId, animation, ...other } = sharedElementConfig;
1919
return {
2020
id,
2121
otherId: otherId || id,
2222
animation: animation || "move",
23-
...other
23+
...other,
2424
};
2525
}
2626
}

src/utils/EventEmitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class EventEmitter {
55

66
emit(name: string, e: any): void {
77
if (this.listeners[name]) {
8-
this.listeners[name].forEach(callback => callback(e));
8+
this.listeners[name].forEach((callback) => callback(e));
99
}
1010
}
1111

src/v4/createSharedElementScene.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import { NavigationProp, Route } from "./types";
1111

1212
const styles = StyleSheet.create({
1313
container: {
14-
flex: 1
15-
}
14+
flex: 1,
15+
},
1616
});
1717

1818
type PropsType = {
@@ -23,7 +23,7 @@ function routeFromNavigation(navigation: any): SharedElementRoute {
2323
return {
2424
key: navigation.state.key,
2525
name: navigation.state.routeName,
26-
params: navigation.state.params || {}
26+
params: navigation.state.params || {},
2727
};
2828
}
2929

@@ -66,12 +66,12 @@ function createSharedElementScene(
6666
this.subscriptions = {
6767
willFocus: navigation.addListener("willFocus", this.onWillFocus),
6868
didFocus: navigation.addListener("didFocus", this.onDidFocus),
69-
willBlur: navigation.addListener("willBlur", this.onWillBlur)
69+
willBlur: navigation.addListener("willBlur", this.onWillBlur),
7070
};
7171
}
7272

7373
componentWillUnmount() {
74-
Object.values(this.subscriptions).forEach(subscription =>
74+
Object.values(this.subscriptions).forEach((subscription) =>
7575
subscription.remove()
7676
);
7777
}

0 commit comments

Comments
 (0)