[IMPROVE] fix some typing erros

This commit is contained in:
AlexAlexandre 2021-07-15 18:46:31 -03:00
parent 802c7b2b28
commit acdc2ce8f5
3 changed files with 13 additions and 18 deletions

View File

@ -182,7 +182,7 @@ const ActionSheet = React.memo(forwardRef(({ children, theme }: {children: JSX.E
styles.container, styles.container,
{ backgroundColor: themes[theme].focusedBackground }, { backgroundColor: themes[theme].focusedBackground },
(isLandscape || isTablet) && styles.bottomSheet (isLandscape || isTablet) && styles.bottomSheet
]} ] as any}
animationConfig={ANIMATION_CONFIG} animationConfig={ANIMATION_CONFIG}
// FlatList props // FlatList props
data={data?.options} data={data?.options}

View File

@ -1,10 +1,14 @@
import React, { useRef, useContext, forwardRef } from 'react'; import React, {useRef, useContext, forwardRef, ForwardedRef} from 'react';
import PropTypes from 'prop-types';
import ActionSheet from './ActionSheet'; import ActionSheet from './ActionSheet';
import { useTheme } from '../../theme'; import { useTheme } from '../../theme';
const context = React.createContext({ interface IActionSheetProvider {
Provider: any;
Consumer: any;
}
const context: IActionSheetProvider = React.createContext({
showActionSheet: () => {}, showActionSheet: () => {},
hideActionSheet: () => {} hideActionSheet: () => {}
}); });
@ -13,15 +17,15 @@ export const useActionSheet = () => useContext(context);
const { Provider, Consumer } = context; const { Provider, Consumer } = context;
export const withActionSheet = (Component: any) => forwardRef((props, ref) => ( export const withActionSheet = (Component: React.FC) => forwardRef((props: any, ref: ForwardedRef<any>) => (
<Consumer> <Consumer>
{contexts => <Component {...props} {...contexts} ref={ref} />} {(contexts: any) => <Component {...props} {...contexts} ref={ref} />}
</Consumer> </Consumer>
)); ));
export const ActionSheetProvider = React.memo(({ children }) => { export const ActionSheetProvider = React.memo(({ children }: {children: JSX.Element}) => {
const ref: any = useRef(); const ref: ForwardedRef<any> = useRef();
const { theme } = useTheme(); const { theme }: any = useTheme();
const getContext = () => ({ const getContext = () => ({
showActionSheet: (options: any) => { showActionSheet: (options: any) => {
@ -40,6 +44,3 @@ export const ActionSheetProvider = React.memo(({ children }) => {
</Provider> </Provider>
); );
}); });
ActionSheetProvider.propTypes = {
children: PropTypes.node
};

View File

@ -32,10 +32,4 @@ const RCActivityIndicator = ({ theme = 'light', absolute, ...props }: IActivityI
/> />
); );
// TODO - test the app without the theme default
// RCActivityIndicator.defaultProps = {
// theme: 'light'
// };
export default RCActivityIndicator; export default RCActivityIndicator;