Skip to content
Merged
183 changes: 183 additions & 0 deletions __tests__/__snapshots__/Storyshots.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,188 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots AssortedItems Text input 1`] = `
<View
style={
Object {
"paddingHorizontal": 14,
}
}
>
<View
style={
Array [
Object {
"marginBottom": 10,
},
undefined,
]
}
>
<Text
accessibilityLabel={null}
contentDescription={null}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 14,
"fontWeight": "600",
"marginBottom": 10,
"textAlign": "left",
},
Object {
"color": "#0d0e12",
},
undefined,
]
}
>
Short Text
</Text>
<View
style={
Object {
"position": "relative",
}
}
>
<TextInput
accessibilityLabel="placeholder"
allowFontScaling={true}
autoCapitalize="none"
autoCorrect={false}
contentDescription="placeholder"
keyboardAppearance="light"
placeholder="placeholder"
placeholderTextColor="#9ca2a8"
rejectResponderTermination={true}
style={
Array [
Object {
"color": "#0d0e12",
},
Array [
Object {
"backgroundColor": "transparent",
"borderRadius": 2,
"borderWidth": 0.5,
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"height": 48,
"padding": 14,
"textAlign": "left",
},
undefined,
undefined,
Object {
"backgroundColor": "#ffffff",
"borderColor": "#cbcbcc",
"color": "#0d0e12",
},
undefined,
undefined,
],
Object {
"textAlign": "auto",
},
]
}
underlineColorAndroid="transparent"
value="Rocket.Chat"
/>
</View>
</View>
<View
style={
Array [
Object {
"marginBottom": 10,
},
undefined,
]
}
>
<Text
accessibilityLabel={null}
contentDescription={null}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 14,
"fontWeight": "600",
"marginBottom": 10,
"textAlign": "left",
},
Object {
"color": "#0d0e12",
},
undefined,
]
}
>
Long Text
</Text>
<View
style={
Object {
"position": "relative",
}
}
>
<TextInput
accessibilityLabel="placeholder"
allowFontScaling={true}
autoCapitalize="none"
autoCorrect={false}
contentDescription="placeholder"
keyboardAppearance="light"
placeholder="placeholder"
placeholderTextColor="#9ca2a8"
rejectResponderTermination={true}
style={
Array [
Object {
"color": "#0d0e12",
},
Array [
Object {
"backgroundColor": "transparent",
"borderRadius": 2,
"borderWidth": 0.5,
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"height": 48,
"padding": 14,
"textAlign": "left",
},
undefined,
undefined,
Object {
"backgroundColor": "#ffffff",
"borderColor": "#cbcbcc",
"color": "#0d0e12",
},
undefined,
undefined,
],
Object {
"textAlign": "auto",
},
]
}
underlineColorAndroid="transparent"
value="https://open.rocket.chat/images/logo/android-chrome-512x512.png"
/>
</View>
</View>
</View>
`;

exports[`Storyshots Avatar Avatar by path 1`] = `
<View
style={
Expand Down
2 changes: 1 addition & 1 deletion app/containers/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const styles = StyleSheet.create({
...sharedStyles.textRegular,
height: 48,
fontSize: 16,
paddingHorizontal: 14,
padding: 14,
Comment thread
diegolmello marked this conversation as resolved.
borderWidth: StyleSheet.hairlineWidth,
borderRadius: 2
},
Expand Down
2 changes: 1 addition & 1 deletion app/presentation/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const styles = StyleSheet.create({
input: {
...I18nManager.isRTL
? { textAlign: 'right' }
: { textAlign: 'left' }
: { textAlign: 'auto' }
}
});

Expand Down
37 changes: 37 additions & 0 deletions storybook/stories/Assorted.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions, react/prop-types */
import React from 'react';
import { storiesOf } from '@storybook/react-native';

import { View } from 'react-native';
import TextInput from '../../app/containers/TextInput';

const stories = storiesOf('AssortedItems', module);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a good practice imo.
We should add this test for the TextInput instead of calling "Assorted"


const item = {
name: 'Rocket.Chat',
longText: 'https://open.rocket.chat/images/logo/android-chrome-512x512.png'
};

const theme = 'light';


stories.add('Text input', () => (
<>
<View style={{ paddingHorizontal: 14 }}>
<TextInput
label='Short Text'
placeholder='placeholder'
value={item.name}
theme={theme}
/>

<TextInput
label='Long Text'
placeholder='placeholder'
value={item.longText}
theme={theme}
/>
</View>
</>
));

1 change: 1 addition & 0 deletions storybook/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import './Avatar';
import '../../app/containers/BackgroundContainer/index.stories.js';
import '../../app/containers/RoomHeader/RoomHeader.stories.js';
import '../../app/views/RoomView/LoadMore/LoadMore.stories';
import './Assorted';

// Change here to see themed storybook
export const theme = 'light';
Expand Down