Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/CustomFunctions/extractProps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default (customProps, originalProps) => {
if (Array.isArray(originalProps.style)) {
originalProps.style.forEach((style) => {
customProps.style = [...customProps.style, style];
});
} else {
customProps.style = [...customProps.style, originalProps.style];
}

return customProps;
};
6 changes: 5 additions & 1 deletion src/CustomFunctions/setCustomActivityIndicator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ActivityIndicator } from 'react-native'
import extractProps from './extractProps'

export const setCustomActivityIndicator = customProps => {
const ActivityIndicatorRender = ActivityIndicator.render
Expand All @@ -9,7 +10,10 @@ export const setCustomActivityIndicator = customProps => {
}
ActivityIndicator.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return ActivityIndicatorRender.apply(this, arguments)
} finally {
Expand Down
6 changes: 5 additions & 1 deletion src/CustomFunctions/setCustomImage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Image } from 'react-native'
import extractProps from './extractProps'

export const setCustomImage = customProps => {
const ImageRender = Image.render
Expand All @@ -9,7 +10,10 @@ export const setCustomImage = customProps => {
}
Image.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return ImageRender.apply(this, arguments)
} finally {
Expand Down
6 changes: 5 additions & 1 deletion src/CustomFunctions/setCustomKeyboardAvoidingView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { KeyboardAvoidingView } from 'react-native'
import extractProps from './extractProps'

export const setCustomKeyboardAvoidingView = customProps => {
const KeyboardAvoidingViewRender = KeyboardAvoidingView.render
Expand All @@ -9,7 +10,10 @@ export const setCustomKeyboardAvoidingView = customProps => {
}
KeyboardAvoidingView.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return KeyboardAvoidingViewRender.apply(this, arguments)
} finally {
Expand Down
6 changes: 5 additions & 1 deletion src/CustomFunctions/setCustomListView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ListView } from 'react-native'
import extractProps from './extractProps'

export const setCustomListView = customProps => {
const ListViewRender = ListView.render
Expand All @@ -9,7 +10,10 @@ export const setCustomListView = customProps => {
}
ListView.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return ListViewRender.apply(this, arguments)
} finally {
Expand Down
6 changes: 5 additions & 1 deletion src/CustomFunctions/setCustomModal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Modal } from 'react-native'
import extractProps from './extractProps'

export const setCustomModal = customProps => {
const ModalRender = Modal.render
Expand All @@ -9,7 +10,10 @@ export const setCustomModal = customProps => {
}
Modal.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return ModalRender.apply(this, arguments)
} finally {
Expand Down
6 changes: 5 additions & 1 deletion src/CustomFunctions/setCustomPicker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Picker } from 'react-native'
import extractProps from './extractProps'

export const setCustomPicker = customProps => {
const PickerRender = Picker.render
Expand All @@ -9,7 +10,10 @@ export const setCustomPicker = customProps => {
}
Picker.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return PickerRender.apply(this, arguments)
} finally {
Expand Down
6 changes: 5 additions & 1 deletion src/CustomFunctions/setCustomRefreshControl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RefreshControl } from 'react-native'
import extractProps from './extractProps'

export const setCustomRefreshControl = customProps => {
const RefreshControlRender = RefreshControl.render
Expand All @@ -9,7 +10,10 @@ export const setCustomRefreshControl = customProps => {
}
RefreshControl.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return RefreshControlRender.apply(this, arguments)
} finally {
Expand Down
6 changes: 5 additions & 1 deletion src/CustomFunctions/setCustomScrollView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ScrollView } from 'react-native'
import extractProps from './extractProps'

export const setCustomScrollView = customProps => {
const ScrollViewRender = ScrollView.render
Expand All @@ -9,7 +10,10 @@ export const setCustomScrollView = customProps => {
}
ScrollView.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return ScrollViewRender.apply(this, arguments)
} finally {
Expand Down
6 changes: 5 additions & 1 deletion src/CustomFunctions/setCustomSlider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Slider } from 'react-native'
import extractProps from './extractProps'

export const setCustomSlider = customProps => {
const SliderRender = Slider.render
Expand All @@ -9,7 +10,10 @@ export const setCustomSlider = customProps => {
}
Slider.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return SliderRender.apply(this, arguments)
} finally {
Expand Down
6 changes: 5 additions & 1 deletion src/CustomFunctions/setCustomStatusBar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { StatusBar } from 'react-native'
import extractProps from './extractProps'

export const setCustomStatusBar = customProps => {
const StatusBarRender = StatusBar.render
Expand All @@ -9,7 +10,10 @@ export const setCustomStatusBar = customProps => {
}
StatusBar.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return StatusBarRender.apply(this, arguments)
} finally {
Expand Down
6 changes: 5 additions & 1 deletion src/CustomFunctions/setCustomSwitch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Switch } from 'react-native'
import extractProps from './extractProps'

export const setCustomSwitch = customProps => {
const SwitchRender = Switch.render
Expand All @@ -9,7 +10,10 @@ export const setCustomSwitch = customProps => {
}
Switch.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return SwitchRender.apply(this, arguments)
} finally {
Expand Down
6 changes: 5 additions & 1 deletion src/CustomFunctions/setCustomText.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Text } from 'react-native'
import extractProps from './extractProps'

export const setCustomText = customProps => {
const TextRender = Text.render
Expand All @@ -9,7 +10,10 @@ export const setCustomText = customProps => {
}
Text.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return TextRender.apply(this, arguments)
} finally {
Expand Down
6 changes: 5 additions & 1 deletion src/CustomFunctions/setCustomTextInput.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TextInput } from 'react-native'
import extractProps from './extractProps'

export const setCustomTextInput = customProps => {
const TextInputRender = TextInput.render
Expand All @@ -9,7 +10,10 @@ export const setCustomTextInput = customProps => {
}
TextInput.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return TextInputRender.apply(this, arguments)
} finally {
Expand Down
21 changes: 17 additions & 4 deletions src/CustomFunctions/setCustomTouchable.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
TouchableWithoutFeedback,
TouchableOpacity
} from 'react-native';
import extractProps from './extractProps';

export const setCustomTouchableNativeFeedback = customProps => {
const TouchableNativeFeedbackRender = TouchableNativeFeedback.render
Expand All @@ -14,7 +15,10 @@ export const setCustomTouchableNativeFeedback = customProps => {
}
TouchableNativeFeedback.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return TouchableNativeFeedbackRender.apply(this, arguments)
} finally {
Expand All @@ -31,7 +35,10 @@ export const setCustomTouchableWithoutFeedback = customProps => {
}
TouchableWithoutFeedback.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return TouchableWithoutFeedbackRender.apply(this, arguments)
} finally {
Expand All @@ -48,7 +55,10 @@ export const setCustomTouchableOpacity = customProps => {
}
TouchableOpacity.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return TouchableOpacityRender.apply(this, arguments)
} finally {
Expand All @@ -65,7 +75,10 @@ export const setCustomTouchableHighlight = customProps => {
}
TouchableHighlight.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return TouchableHighlightRender.apply(this, arguments)
} finally {
Expand Down
10 changes: 6 additions & 4 deletions src/CustomFunctions/setCustomView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
View
} from 'react-native';
import { View } from 'react-native';
import extractProps from './extractProps';

export const setCustomView = customProps => {
const ViewRender = View.render
Expand All @@ -11,7 +10,10 @@ export const setCustomView = customProps => {
}
View.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return ViewRender.apply(this, arguments)
} finally {
Expand Down
10 changes: 6 additions & 4 deletions src/CustomFunctions/setCustomWebView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
WebView
} from 'react-native';
import { WebView } from 'react-native';
import extractProps from './extractProps';

export const setCustomWebView = customProps => {
const WebViewRender = WebView.render
Expand All @@ -11,7 +10,10 @@ export const setCustomWebView = customProps => {
}
WebView.render = function render(props) {
let oldProps = props
props = { ...props, style: [customProps.style, props.style] }
props = { ...props, style: [customProps.style] }

props = extractProps(props, oldProps)

try {
return WebViewRender.apply(this, arguments)
} finally {
Expand Down