-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from idrisssakhi/BLUR-TS-ISSUE
resolve ts issue
- Loading branch information
Showing
7 changed files
with
30 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
import React from 'react' | ||
import { requireNativeComponent, StyleSheet } from 'react-native'; | ||
import { styles } from './BlurView.style'; | ||
import type { BlurViewProperties } from './types'; | ||
import { requireNativeComponent, StyleSheet, ViewStyle } from 'react-native'; | ||
|
||
export const BlurView = (props: BlurViewProperties) => { | ||
import type { BlurViewProperties } from '../types'; | ||
|
||
const BlurView = (props: BlurViewProperties) => { | ||
return ( | ||
<NativeBlurView style={StyleSheet.compose(styles.transparent, props?.style)} {...props} /> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create<{transparent: ViewStyle}>({ | ||
transparent: {backgroundColor: 'transparent'}, | ||
}); | ||
|
||
BlurView.defaultProps = { | ||
blurType: 'dark', | ||
blurAmount: 10, | ||
}; | ||
|
||
// requireNativeComponent automatically resolves 'BlurView' to 'BlurViewManager' | ||
const NativeBlurView = requireNativeComponent<BlurViewProperties>( | ||
'BlurView', | ||
// @ts-expect-error because the type declarations are kinda wrong, no? | ||
BlurView, | ||
); | ||
const NativeBlurView = requireNativeComponent<BlurViewProperties>('BlurView'); | ||
|
||
export default BlurView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
export * from './BlurView'; | ||
export * from './types'; | ||
import type { View } from 'react-native'; | ||
//@ts-ignore | ||
import NativeBlurView from './Views/BlurView'; | ||
import type { BlurViewProperties } from './types'; | ||
|
||
const BlurView = NativeBlurView as React.ComponentType<BlurViewProperties & React.RefAttributes<View>>; | ||
|
||
export { BlurView }; | ||
export type { BlurViewProperties }; |
This file was deleted.
Oops, something went wrong.