Skip to content

Commit

Permalink
Fix/metro config expo (#1712)
Browse files Browse the repository at this point in the history
* fix: fix metro-config for expo usage
  • Loading branch information
sergey-kozel authored Apr 10, 2023
1 parent 07bb149 commit d5b9b5a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/ui/menu/menuGroup.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class MenuGroup extends React.Component<MenuGroupProps, State> {
return this.expandAnimation._value;
}

private get expandToRotateInterpolation(): Animated.AnimatedInterpolation {
private get expandToRotateInterpolation(): Animated.AnimatedInterpolation<string> {
return this.expandAnimation.interpolate({
inputRange: [-this.state.submenuHeight, CHEVRON_DEG_EXPANDED],
outputRange: [`${CHEVRON_DEG_COLLAPSED}deg`, `${CHEVRON_DEG_EXPANDED}deg`],
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/select/select.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export class Select extends React.Component<SelectProps, State> {
return Array.isArray(this.props.selectedIndex) ? this.props.selectedIndex : [this.props.selectedIndex];
}

private get expandToRotateInterpolation(): Animated.AnimatedInterpolation {
private get expandToRotateInterpolation(): Animated.AnimatedInterpolation<string> {
return this.expandAnimation.interpolate({
inputRange: [CHEVRON_DEG_COLLAPSED, CHEVRON_DEG_EXPANDED],
outputRange: [`${CHEVRON_DEG_COLLAPSED}deg`, `${CHEVRON_DEG_EXPANDED}deg`],
Expand Down
13 changes: 7 additions & 6 deletions src/components/ui/spinner/animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ export class SpinnerAnimation extends Animation<SpinnerAnimationConfig, SpinnerA
* @returns {SpinnerAnimationStyle} - an object that contains container, start and end arcs transform styles.
*/
public toProps(): SpinnerAnimationStyle {
const containerInterpolation: Animated.AnimatedInterpolation = this.createContainerInterpolation();
const startArcInterpolation: Animated.AnimatedInterpolation = this.createArcInterpolation(StartArcEasing);
const endArcInterpolation: Animated.AnimatedInterpolation = this.createArcInterpolation(EndArcEasing);
const containerInterpolation: Animated.AnimatedInterpolation<number> = this.createContainerInterpolation();
const startArcInterpolation: Animated.AnimatedInterpolation<number> = this.createArcInterpolation(StartArcEasing);
const endArcInterpolation: Animated.AnimatedInterpolation<number> = this.createArcInterpolation(EndArcEasing);

return {
container: this.toStyleTransformProp(containerInterpolation),
Expand All @@ -108,7 +108,7 @@ export class SpinnerAnimation extends Animation<SpinnerAnimationConfig, SpinnerA
return new Array(numberOfFrames).fill(0);
};

private createContainerInterpolation = (): Animated.AnimatedInterpolation => {
private createContainerInterpolation = (): Animated.AnimatedInterpolation<number> => {
return this.animationValue.interpolate({
inputRange: [0, 1],
outputRange: [
Expand All @@ -118,7 +118,7 @@ export class SpinnerAnimation extends Animation<SpinnerAnimationConfig, SpinnerA
});
};

private createArcInterpolation = (easing: EasingFunction): Animated.AnimatedInterpolation => {
private createArcInterpolation = (easing: EasingFunction): Animated.AnimatedInterpolation<number> => {
return this.animationValue.interpolate({
inputRange: this.createArcInterpolationInputRange(),
outputRange: this.createArcInterpolationOutputRange(easing),
Expand Down Expand Up @@ -156,7 +156,8 @@ export class SpinnerAnimation extends Animation<SpinnerAnimationConfig, SpinnerA
* @param {ViewStyle} source - initial StyleSheet object.
* @returns a final StyleSheet object with a `rotate` animation value.
*/
private toStyleTransformProp = (rotate: Animated.AnimatedInterpolation, source: ViewStyle = {}): ViewStyle => {
private toStyleTransformProp = (rotate: Animated.AnimatedInterpolation<number | string>,
source: ViewStyle = {}): ViewStyle => {
const transform = [...(source.transform || []), { rotate }];

// @ts-ignore: AnimatedInterpolation does not fit RotateTransform type declaration
Expand Down
4 changes: 1 addition & 3 deletions src/metro-config/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Fs from 'fs';
import LodashMerge from 'lodash.merge';
import MetroConfig from 'metro-config/src/defaults';
import BootstrapService from './services/bootstrap.service';
import { EvaConfig } from './services/eva-config.service';
import ProjectService from './services/project.service';
Expand All @@ -13,7 +12,6 @@ type MetroConfigType = {
watchFolders?: Array<string>;
};

const defaultMetroConfig = MetroConfig.getDefaultValues();
const customMappingWatchOptions = {
/*
* How often the custom mapping should be polled in milliseconds
Expand Down Expand Up @@ -50,7 +48,7 @@ const customMappingWatchOptions = {
export const create = (evaConfig: EvaConfig, metroConfig?: MetroConfigType): MetroConfigType => {

const handleMetroEvent = (event): void => {
const reporter = metroConfig?.reporter || defaultMetroConfig.reporter;
const reporter = metroConfig?.reporter;

if (reporter?.update) {
reporter.update(event);
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
}
},
"include": [
"./src",
".eslintrc.js",
"./src/**/*"
"./src/**/package.json"
],
"exclude": [
"./src/template-js",
Expand Down

0 comments on commit d5b9b5a

Please sign in to comment.