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
Expand Up @@ -71430,6 +71430,189 @@ Array [
]
`;

exports[`Storyshots Text Input Short and Long Text 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 Thread Messages.Item badge 1`] = `
<RCTScrollView>
<View>
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,
borderWidth: StyleSheet.hairlineWidth,
borderRadius: 2
},
Expand Down
43 changes: 43 additions & 0 deletions app/containers/TextInput.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* 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, StyleSheet } from 'react-native';
import TextInput from './TextInput';

const styles = StyleSheet.create({
paddingHorizontal: {
paddingHorizontal: 14
}
});

const stories = storiesOf('Text Input', module);

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

const theme = 'light';


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

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

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
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 '../../app/containers/TextInput.stories';

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