[IMPROVE] fix some typing erros
This commit is contained in:
parent
802c7b2b28
commit
acdc2ce8f5
|
@ -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}
|
||||
|
|
|
@ -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: () => {}
|
||||
});
|
||||
|
@ -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) => {
|
||||
|
@ -40,6 +44,3 @@ export const ActionSheetProvider = React.memo(({ children }) => {
|
|||
</Provider>
|
||||
);
|
||||
});
|
||||
ActionSheetProvider.propTypes = {
|
||||
children: PropTypes.node
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue