Skip to content

Fix/types to prop types #797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
module.exports = {
env: {
test: {
presets: ['module:metro-react-native-babel-preset'],
retainLines: true,
},
presets: ['module:metro-react-native-babel-preset']
}
},
presets: ['module:metro-react-native-babel-preset'],
retainLines: true,
plugins: ['transform-inline-environment-variables'],
presets: ['module:metro-react-native-babel-preset']
};
74 changes: 74 additions & 0 deletions generatedTypes/components/drawer/Swipeable.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { Component } from 'react';
import { Animated } from 'react-native';
export declare type PropType = {
children: any;
friction: number;
leftThreshold?: number;
rightThreshold?: number;
fullLeftThreshold?: number;
fullSwipeLeft?: boolean;
overshootLeft?: boolean;
overshootRight?: boolean;
overshootFriction?: number;
onSwipeableLeftOpen?: Function;
onSwipeableRightOpen?: Function;
onSwipeableOpen?: Function;
onSwipeableClose?: Function;
onSwipeableLeftWillOpen?: Function;
onSwipeableRightWillOpen?: Function;
onSwipeableWillOpen?: Function;
onSwipeableWillClose?: Function;
onFullSwipeLeft?: Function;
onWillFullSwipeLeft?: Function;
onDragStart?: Function;
renderLeftActions?: (progressAnimatedValue: any, dragAnimatedValue: any) => any;
renderRightActions?: (progressAnimatedValue: any, dragAnimatedValue: any) => any;
leftActionsContainerStyle: any;
rightActionsContainerStyle: any;
useNativeAnimations: boolean;
animationOptions?: Object;
containerStyle?: Object;
childrenContainerStyle?: Object;
};
declare type StateType = {
dragX: Animated.Value;
rowTranslation: Animated.Value;
leftWidth: number | typeof undefined;
rightOffset: number | typeof undefined;
rowWidth: number | typeof undefined;
};
export default class Swipeable extends Component<PropType, StateType> {
static defaultProps: {
friction: number;
overshootFriction: number;
useNativeAnimations: boolean;
fullLeftThreshold: number;
};
constructor(props: PropType);
UNSAFE_componentWillUpdate(props: PropType, state: StateType): void;
_updateAnimatedEvent: (props: PropType, state: StateType) => void;
_onTapHandlerStateChange: ({ nativeEvent }: {
nativeEvent: any;
}) => void;
_onHandlerStateChange: ({ nativeEvent }: {
nativeEvent: any;
}) => void;
_handleRelease: (nativeEvent: any) => void;
_animateRow: (fromValue: any, toValue: any, velocityX: any) => void;
_currentOffset: () => number;
close: () => void;
openLeft: () => void;
openRight: () => void;
_onRowLayout: ({ nativeEvent }: {
nativeEvent: any;
}) => void;
_onLeftLayout: ({ nativeEvent }: {
nativeEvent: any;
}) => void;
_onRightLayout: ({ nativeEvent }: {
nativeEvent: any;
}) => void;
handleMeasure: (name: any, nativeEvent: any) => void;
render(): JSX.Element;
}
export {};
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"lint:test": "mocha --compilers js:babel-core/register eslint-rules/tests/lib/rules",
"xcode": "open ./ios/uilib.xcodeproj",
"build:dev": "tsc --p tsconfig.dev.json",
"build": "tsc --p tsconfig.build.json",
"build:exports": "./node_modules/.bin/babel src --out-dir src --config-file ./src/.babelrc.json --extensions '.ts,.tsx' --ignore 'src/index.ts'",
"build": "tsc --p tsconfig.build.json && npm run build:exports",
"log": "react-native log-ios | grep 'ethan -'",
"docs:install": "(cd ./uilib-docs && rm -rf node_modules && rm -rf package-lock.json && npm install)",
"docs:deploy": "(cd ./uilib-docs && gatsby build --prefix-paths && gh-pages -d public --branch gh-pages)",
Expand Down Expand Up @@ -56,8 +57,10 @@
"url-parse": "^1.2.0"
},
"devDependencies": {
"@babel/cli": "^7.10.1",
"@babel/core": "^7.4.0",
"@babel/preset-env": "^7.3.1",
"@babel/preset-react": "^7.10.1",
"@babel/runtime": "^7.4.2",
"@react-native-community/async-storage": "^1.6.2",
"@react-native-community/blur": "^3.4.1",
Expand All @@ -72,6 +75,7 @@
"@typescript-eslint/parser": "^2.13.0",
"@welldone-software/why-did-you-render": "^3.2.1",
"babel-jest": "^25.2.4",
"babel-plugin-typescript-to-proptypes": "^1.3.2",
"babel-preset-react-native": "*",
"eslint": "^5.16.0",
"eslint-config-wix": "^1.1.28",
Expand Down
4 changes: 4 additions & 0 deletions src/.babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@babel/preset-typescript", "@babel/preset-react"],
"plugins": ["babel-plugin-typescript-to-proptypes"]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
// @flow
// Similarly to the DrawerLayout component this deserves to be put in a
// separate repo. Although, keeping it here for the time being will allow us
Expand Down Expand Up @@ -67,12 +68,12 @@ export default class Swipeable extends Component<PropType, StateType> {
fullLeftThreshold: 0.45
};

_onGestureEvent: ?Animated.Event;
_transX: ?Animated.Interpolation;
_showLeftAction: ?Animated.Interpolation | ?Animated.Value;
_leftActionTranslate: ?Animated.Interpolation;
_showRightAction: ?Animated.Interpolation | ?Animated.Value;
_rightActionTranslate: ?Animated.Interpolation;
// _onGestureEvent: ?Animated.Event;
// _transX: ?Animated.Interpolation;
// _showLeftAction: ?Animated.Interpolation | ?Animated.Value;
// _leftActionTranslate: ?Animated.Interpolation;
// _showRightAction: ?Animated.Interpolation | ?Animated.Value;
// _rightActionTranslate: ?Animated.Interpolation;

constructor(props: PropType) {
super(props);
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"emitDeclarationOnly": false
"emitDeclarationOnly": true
},
"include": ["src/**/*", "typings/**/*"],
"exclude": [ "node_modules", "src/index.ts"]
Expand Down