Skip to content

Commit

Permalink
fix unit tests, add more ts checks (react-native-elements#2920)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeremy Hamilton <jeremy.hamilton@tekfive.com>
  • Loading branch information
flyingcircle and Jeremy Hamilton authored Mar 28, 2021
1 parent 5ed0976 commit d78718c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .ci/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

configure({ adapter: new Adapter() });

jest.mock(
'../node_modules/react-native/Libraries/LayoutAnimation/LayoutAnimation.js',
);
10 changes: 3 additions & 7 deletions src/searchbar/SearchBar-ios.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { Component } from 'react';
import {
TouchableOpacity,
LayoutAnimation,
UIManager,
StyleSheet,
View,
ActivityIndicator,
Expand Down Expand Up @@ -102,8 +101,7 @@ class SearchBar extends Component<
cancel = () => {
this.onChangeText('');
if (this.props.showCancel) {
// @ts-ignore
UIManager.configureNextLayoutAnimation && LayoutAnimation.easeInEaseOut();
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
this.setState({ hasFocus: false });
}
setTimeout(() => {
Expand All @@ -114,8 +112,7 @@ class SearchBar extends Component<

onFocus: InputProps['onFocus'] = (event) => {
this.props.onFocus(event);
// @ts-ignore
UIManager.configureNextLayoutAnimation && LayoutAnimation.easeInEaseOut();
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
this.setState({
hasFocus: true,
isEmpty: this.props.value === '',
Expand All @@ -125,8 +122,7 @@ class SearchBar extends Component<
onBlur: InputProps['onBlur'] = (event) => {
this.props.onBlur(event);
if (!this.props.showCancel) {
// @ts-ignore
UIManager.configureNextLayoutAnimation && LayoutAnimation.easeInEaseOut();
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
this.setState({
hasFocus: false,
});
Expand Down
7 changes: 3 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@
"outDir": "dist",
/* Strict Type-Checking Options */
"strict": false, /* Enable all strict type-checking options. */
"strictPropertyInitialization": false,
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
// "noUnusedLocals": true, /* Report errors on unused locals. */
"noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */

/* Module Resolution Options */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
Expand Down

0 comments on commit d78718c

Please sign in to comment.