Skip to content

Commit 76dec0a

Browse files
author
Kashish Grover
authored
Merge pull request #187 from treebohotels/native/fixes-13-feb
fix(native): Fix styled components breaking
2 parents cbeac59 + 6b34970 commit 76dec0a

File tree

4 files changed

+16
-17
lines changed

4 files changed

+16
-17
lines changed

src/Button/native/Button.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import { ActivityIndicator, TouchableOpacity } from 'react-native';
3+
import { ActivityIndicator } from 'react-native';
44
import styled from 'styled-components';
55
import theme from '../../theme/native';
66
import Text from '../../Text/native';
@@ -68,7 +68,7 @@ const styles = {
6868
},
6969
};
7070

71-
const StyledButton = styled((props) => <TouchableOpacity {...props} />)`
71+
const StyledButton = styled.TouchableOpacity`
7272
background-color: ${styles.buttonColor};
7373
align-items: center;
7474
justify-content: center;

src/Tag/native/Tag.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import { View } from 'react-native';
43
import styled from 'styled-components/native';
54
import Text from '../../Text/native';
65

@@ -27,7 +26,7 @@ const styles = {
2726
},
2827
};
2928

30-
const TagContainer = styled((props) => <View {...props} />)`
29+
const TagContainer = styled.View`
3130
align-self: flex-start;
3231
align-items: center;
3332
justify-content: center;

src/TextArea/native/TextArea.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react';
2-
import { Animated, View } from 'react-native';
2+
import { Animated } from 'react-native';
33
import PropTypes from 'prop-types';
44
import styled, { withTheme } from 'styled-components';
55
import Text from '../../Text/native';
@@ -18,7 +18,7 @@ const labelColor = (props) => {
1818
return props.error && !props.isEmptyInput ? props.theme.color.red : props.theme.color.greyDark;
1919
};
2020

21-
const InputContainerWrapper = styled((props) => <View {...props} />)`
21+
const InputContainerWrapper = styled.View`
2222
padding: ${(p) => p.theme.px([2, 0])};
2323
`;
2424

@@ -34,7 +34,7 @@ const Label = Text.extend`
3434

3535
const AnimatedLabel = Animated.createAnimatedComponent(Label);
3636

37-
const InputContainer = styled((props) => <View {...props} />)`
37+
const InputContainer = styled.View`
3838
position: relative;
3939
flex-direction: row;
4040
align-items: center;
@@ -45,12 +45,12 @@ const InputContainer = styled((props) => <View {...props} />)`
4545
height: ${(p) => p.theme.px(6.75)};
4646
`;
4747

48-
const RelativeFlexView = styled((props) => <View {...props} />)`
48+
const RelativeFlexView = styled.View`
4949
position: relative;
5050
flex: 1;
5151
`;
5252

53-
const Input = styled((props) => <TextArea {...props} />)`
53+
const Input = styled.TextArea`
5454
flex: 1;
5555
padding: ${(p) => p.theme.px([2.1, 0, 0, 1.5])};
5656
font-size: ${(p) => p.theme.fontSize.s};

src/TextInput/native/TextInput.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React, { Component } from 'react';
2-
import { Animated, View } from 'react-native';
1+
import React from 'react';
2+
import { Animated } from 'react-native';
33
import PropTypes from 'prop-types';
4-
import styled, { withTheme } from 'styled-components';
4+
import styled, { withTheme } from 'styled-components/native';
55
import Text from '../../Text/native';
66
import Space from '../../Space/native';
77

@@ -18,7 +18,7 @@ const labelColor = (props) => {
1818
return props.error && !props.isEmptyInput ? props.theme.color.red : props.theme.color.greyDark;
1919
};
2020

21-
const InputContainerWrapper = styled((props) => <View {...props} />)`
21+
const InputContainerWrapper = styled.View`
2222
padding: ${(p) => p.theme.px([2, 0])};
2323
`;
2424

@@ -34,7 +34,7 @@ const Label = Text.extend`
3434

3535
const AnimatedLabel = Animated.createAnimatedComponent(Label);
3636

37-
const InputContainer = styled((props) => <View {...props} />)`
37+
const InputContainer = styled.View`
3838
position: relative;
3939
flex-direction: row;
4040
align-items: center;
@@ -45,20 +45,20 @@ const InputContainer = styled((props) => <View {...props} />)`
4545
height: ${(p) => p.theme.px(6.75)};
4646
`;
4747

48-
const RelativeFlexView = styled((props) => <View {...props} />)`
48+
const RelativeFlexView = styled.View`
4949
position: relative;
5050
flex: 1;
5151
`;
5252

53-
const Input = styled((props) => <TextInput {...props} />)`
53+
const Input = styled.TextInput`
5454
flex: 1;
5555
padding: ${(p) => p.theme.px([2.1, 0, 0, 1.5])};
5656
font-size: ${(p) => p.theme.fontSize.s};
5757
color: ${(p) => p.theme.color.greyDarker};
5858
height: ${(p) => p.theme.px(6.75)};
5959
`;
6060

61-
class TextInput extends Component {
61+
class TextInput extends React.Component {
6262
constructor(props, { formik }) {
6363
super(props);
6464
const { name, theme } = this.props;

0 commit comments

Comments
 (0)