-
Notifications
You must be signed in to change notification settings - Fork 1
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 #4 from mucahitdev/dev
chore: new components
- Loading branch information
Showing
16 changed files
with
307 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Button, type ButtonProps } from 'react-native'; | ||
|
||
export const customizeButton = (customProps: ButtonProps) => { | ||
const ButtonRender = (Button as any).render; | ||
if (!ButtonRender) { | ||
(Button as any).defaultProps = customProps; | ||
return; | ||
} | ||
(Button as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
}; | ||
return ButtonRender.call(this, props, ref); | ||
}; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { FlatList, type FlatListProps } from 'react-native'; | ||
|
||
export const customizeFlatList = (customProps: FlatListProps<any>) => { | ||
const FlatListRender = (FlatList as any).render; | ||
if (!FlatListRender) { | ||
(FlatList as any).defaultProps = customProps; | ||
return; | ||
} | ||
(FlatList as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
}; | ||
return FlatListRender.call(this, props, ref); | ||
}; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { ImageBackground, type ImageBackgroundProps } from 'react-native'; | ||
|
||
export const customizeImageBackground = (customProps: ImageBackgroundProps) => { | ||
const ImageBackgroundRender = (ImageBackground as any).render; | ||
if (!ImageBackgroundRender) { | ||
(ImageBackground as any).defaultProps = customProps; | ||
return; | ||
} | ||
(ImageBackground as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
style: [customProps.style, props.style], | ||
}; | ||
return ImageBackgroundRender.call(this, props, ref); | ||
}; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { | ||
KeyboardAvoidingView, | ||
type KeyboardAvoidingViewProps, | ||
} from 'react-native'; | ||
|
||
export const customizeKeyboardAvoidingView = ( | ||
customProps: KeyboardAvoidingViewProps | ||
) => { | ||
const KeyboardAvoidingViewRender = (KeyboardAvoidingView as any).render; | ||
if (!KeyboardAvoidingViewRender) { | ||
(KeyboardAvoidingView as any).defaultProps = customProps; | ||
return; | ||
} | ||
(KeyboardAvoidingView as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
}; | ||
return KeyboardAvoidingViewRender.call(this, props, ref); | ||
}; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Modal, type ModalProps } from 'react-native'; | ||
|
||
export const customizeModal = (customProps: ModalProps) => { | ||
const ModalRender = (Modal as any).render; | ||
if (!ModalRender) { | ||
(Modal as any).defaultProps = customProps; | ||
return; | ||
} | ||
(Modal as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
style: [customProps.style, props.style], | ||
}; | ||
return ModalRender.call(this, props, ref); | ||
}; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Pressable, type PressableProps } from 'react-native'; | ||
|
||
export const customizePressable = (customProps: PressableProps) => { | ||
const PressableRender = (Pressable as any).render; | ||
if (!PressableRender) { | ||
(Pressable as any).defaultProps = customProps; | ||
return; | ||
} | ||
(Pressable as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
style: [customProps.style, props.style], | ||
}; | ||
return PressableRender.call(this, props, ref); | ||
}; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { RefreshControl, type RefreshControlProps } from 'react-native'; | ||
|
||
export const customizeRefreshControl = (customProps: RefreshControlProps) => { | ||
const RefreshControlRender = (RefreshControl as any).render; | ||
if (!RefreshControlRender) { | ||
(RefreshControl as any).defaultProps = customProps; | ||
return; | ||
} | ||
(RefreshControl as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
}; | ||
return RefreshControlRender.call(this, props, ref); | ||
}; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ScrollView, type ScrollViewProps } from 'react-native'; | ||
|
||
export const customizeScrollView = (customProps: ScrollViewProps) => { | ||
const ScrollViewRender = (ScrollView as any).render; | ||
if (!ScrollViewRender) { | ||
(ScrollView as any).defaultProps = customProps; | ||
return; | ||
} | ||
(ScrollView as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
}; | ||
return ScrollViewRender.call(this, props, ref); | ||
}; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { SectionList, type SectionListProps } from 'react-native'; | ||
|
||
export const customizeSectionList = (customProps: SectionListProps<any>) => { | ||
const SectionListRender = (SectionList as any).render; | ||
if (!SectionListRender) { | ||
(SectionList as any).defaultProps = customProps; | ||
return; | ||
} | ||
(SectionList as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
}; | ||
return SectionListRender.call(this, props, ref); | ||
}; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { StatusBar, type StatusBarProps } from 'react-native'; | ||
|
||
export const customizeStatusBar = (customProps: StatusBarProps) => { | ||
const StatusBarRender = (StatusBar as any).render; | ||
if (!StatusBarRender) { | ||
(StatusBar as any).defaultProps = customProps; | ||
return; | ||
} | ||
(StatusBar as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
}; | ||
return StatusBarRender.call(this, props, ref); | ||
}; | ||
}; |
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
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { | ||
TouchableHighlight, | ||
TouchableNativeFeedback, | ||
TouchableWithoutFeedback, | ||
TouchableOpacity, | ||
type TouchableHighlightProps, | ||
type TouchableNativeFeedbackProps, | ||
type TouchableWithoutFeedbackProps, | ||
type TouchableOpacityProps, | ||
} from 'react-native'; | ||
|
||
export const customizeTouchableHighlight = ( | ||
customProps: TouchableHighlightProps | ||
) => { | ||
const TouchableHighlightRender = (TouchableHighlight as any).render; | ||
if (!TouchableHighlightRender) { | ||
(TouchableHighlight as any).defaultProps = customProps; | ||
return; | ||
} | ||
(TouchableHighlight as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
style: [customProps.style, props.style], | ||
}; | ||
return TouchableHighlightRender.call(this, props, ref); | ||
}; | ||
}; | ||
|
||
export const customizeTouchableNativeFeedback = ( | ||
customProps: TouchableNativeFeedbackProps | ||
) => { | ||
const TouchableNativeFeedbackRender = (TouchableNativeFeedback as any).render; | ||
if (!TouchableNativeFeedbackRender) { | ||
(TouchableNativeFeedback as any).defaultProps = customProps; | ||
return; | ||
} | ||
(TouchableNativeFeedback as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
style: [customProps.style, props.style], | ||
}; | ||
return TouchableNativeFeedbackRender.call(this, props, ref); | ||
}; | ||
}; | ||
|
||
export const customizeTouchableWithoutFeedback = ( | ||
customProps: TouchableWithoutFeedbackProps | ||
) => { | ||
const TouchableWithoutFeedbackRender = (TouchableWithoutFeedback as any) | ||
.render; | ||
if (!TouchableWithoutFeedbackRender) { | ||
(TouchableWithoutFeedback as any).defaultProps = customProps; | ||
return; | ||
} | ||
(TouchableWithoutFeedback as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
style: [customProps.style, props.style], | ||
}; | ||
return TouchableWithoutFeedbackRender.call(this, props, ref); | ||
}; | ||
}; | ||
|
||
export const customizeTouchableOpacity = ( | ||
customProps: TouchableOpacityProps | ||
) => { | ||
const TouchableOpacityRender = (TouchableOpacity as any).render; | ||
if (!TouchableOpacityRender) { | ||
(TouchableOpacity as any).defaultProps = customProps; | ||
return; | ||
} | ||
(TouchableOpacity as any).render = (props: any, ref: any) => { | ||
props = { | ||
...customProps, | ||
...props, | ||
style: [customProps.style, props.style], | ||
}; | ||
return TouchableOpacityRender.call(this, props, ref); | ||
}; | ||
}; |
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
Oops, something went wrong.