diff --git a/.ci/setupTests.js b/.ci/setupTests.js index 82edfc9e5a..1d53b0be98 100644 --- a/.ci/setupTests.js +++ b/.ci/setupTests.js @@ -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', +); diff --git a/src/searchbar/SearchBar-ios.tsx b/src/searchbar/SearchBar-ios.tsx index b15b49bfe1..370ffc46e3 100644 --- a/src/searchbar/SearchBar-ios.tsx +++ b/src/searchbar/SearchBar-ios.tsx @@ -2,7 +2,6 @@ import React, { Component } from 'react'; import { TouchableOpacity, LayoutAnimation, - UIManager, StyleSheet, View, ActivityIndicator, @@ -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(() => { @@ -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 === '', @@ -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, }); diff --git a/tsconfig.json b/tsconfig.json index d62d2b57eb..8c3d159835 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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). */