Skip to content

Commit

Permalink
[IMPROVE] fix some typing erros
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAlexandre committed Jul 15, 2021
1 parent 802c7b2 commit acdc2ce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/containers/ActionSheet/ActionSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const ActionSheet = React.memo(forwardRef(({ children, theme }: {children: JSX.E
styles.container,
{ backgroundColor: themes[theme].focusedBackground },
(isLandscape || isTablet) && styles.bottomSheet
]}
] as any}
animationConfig={ANIMATION_CONFIG}
// FlatList props
data={data?.options}
Expand Down
23 changes: 12 additions & 11 deletions app/containers/ActionSheet/Provider.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import React, { useRef, useContext, forwardRef } from 'react';
import PropTypes from 'prop-types';
import React, {useRef, useContext, forwardRef, ForwardedRef} from 'react';

import ActionSheet from './ActionSheet';
import { useTheme } from '../../theme';

const context = React.createContext({
interface IActionSheetProvider {
Provider: any;
Consumer: any;
}

const context: IActionSheetProvider = React.createContext({
showActionSheet: () => {},
hideActionSheet: () => {}
});
Expand All @@ -13,15 +17,15 @@ export const useActionSheet = () => useContext(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>
{contexts => <Component {...props} {...contexts} ref={ref} />}
{(contexts: any) => <Component {...props} {...contexts} ref={ref} />}
</Consumer>
));

export const ActionSheetProvider = React.memo(({ children }) => {
const ref: any = useRef();
const { theme } = useTheme();
export const ActionSheetProvider = React.memo(({ children }: {children: JSX.Element}) => {
const ref: ForwardedRef<any> = useRef();
const { theme }: any = useTheme();

const getContext = () => ({
showActionSheet: (options: any) => {
Expand All @@ -40,6 +44,3 @@ export const ActionSheetProvider = React.memo(({ children }) => {
</Provider>
);
});
ActionSheetProvider.propTypes = {
children: PropTypes.node
};
6 changes: 0 additions & 6 deletions app/containers/ActivityIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit acdc2ce

Please sign in to comment.