[IMPROVE] - fixing some errors appoint by jest

This commit is contained in:
AlexAlexandre 2021-08-02 19:17:29 -03:00
parent 50a99fb846
commit 49b9cf436f
17 changed files with 98 additions and 26 deletions

View File

@ -4693,7 +4693,7 @@ exports[`Storyshots List pressable 1`] = `
"justifyContent": "center",
"paddingHorizontal": 12,
},
false,
undefined,
Object {
"height": 92,
},
@ -6211,7 +6211,7 @@ exports[`Storyshots List with bigger font 1`] = `
"justifyContent": "center",
"paddingHorizontal": 12,
},
false,
undefined,
Object {
"height": 69,
},
@ -6625,7 +6625,7 @@ exports[`Storyshots List with bigger font 1`] = `
"justifyContent": "center",
"paddingHorizontal": 12,
},
false,
undefined,
Object {
"height": 69,
},
@ -7080,7 +7080,7 @@ exports[`Storyshots List with black theme 1`] = `
"justifyContent": "center",
"paddingHorizontal": 12,
},
false,
undefined,
Object {
"height": 92,
},
@ -7494,7 +7494,7 @@ exports[`Storyshots List with black theme 1`] = `
"justifyContent": "center",
"paddingHorizontal": 12,
},
false,
undefined,
Object {
"height": 92,
},
@ -7972,7 +7972,7 @@ exports[`Storyshots List with custom colors 1`] = `
"justifyContent": "center",
"paddingHorizontal": 12,
},
false,
undefined,
Object {
"height": 92,
},
@ -8129,7 +8129,7 @@ exports[`Storyshots List with dark theme 1`] = `
"justifyContent": "center",
"paddingHorizontal": 12,
},
false,
undefined,
Object {
"height": 92,
},
@ -8543,7 +8543,7 @@ exports[`Storyshots List with dark theme 1`] = `
"justifyContent": "center",
"paddingHorizontal": 12,
},
false,
undefined,
Object {
"height": 92,
},
@ -10410,7 +10410,7 @@ exports[`Storyshots List with small font 1`] = `
"justifyContent": "center",
"paddingHorizontal": 12,
},
false,
undefined,
Object {
"height": 36.800000000000004,
},
@ -10824,7 +10824,7 @@ exports[`Storyshots List with small font 1`] = `
"justifyContent": "center",
"paddingHorizontal": 12,
},
false,
undefined,
Object {
"height": 36.800000000000004,
},
@ -47791,6 +47791,7 @@ exports[`Storyshots Message With image 1`] = `
/>
</View>
</View>
//TODO - fix the required fields for the Markdown
<Text
style={
Array [
@ -48109,6 +48110,7 @@ exports[`Storyshots Message With image 1`] = `
/>
</View>
</View>
//TODO - fix the required fields for the Markdown
<Text
style={
Array [

View File

@ -9,13 +9,9 @@ import Emoji from '../markdown/Emoji';
import {TAvatar} from "./types";
const Avatar = React.memo(({
text,
size,
server,
borderRadius,
style,
style,
avatar,
type,
children,
user,
onPress,
@ -26,8 +22,13 @@ const Avatar = React.memo(({
isStatic,
rid,
blockUnauthenticatedAccess,
serverVersion
serverVersion,
text = '',
size = 25,
borderRadius = 4,
type = 'd',
}: Partial<TAvatar>) => {
if ((!text && !avatar && !emoji && !rid) || !server) {
return null;
}

View File

@ -12,6 +12,11 @@ class AvatarContainer extends React.Component<Partial<TAvatar>, any> {
private mounted: boolean;
private subscription!: any;
static defaultProps = {
text: '',
type: 'd'
};
constructor(props: Partial<TAvatar>) {
super(props);
this.mounted = false;

View File

@ -40,6 +40,14 @@ const styles = StyleSheet.create({
export default class Button extends React.PureComponent<Partial<IButtonProps>, any> {
static defaultProps = {
title: 'Press me!',
type: 'primary',
onPress: () => alert('It works!'),
disabled: false,
loading: false
}
render() {
const {
title, type, onPress, disabled, backgroundColor, color, loading, style, theme, fontSize, ...otherProps

View File

@ -20,7 +20,7 @@ const styles = StyleSheet.create({
}
});
const Container = ({ children, left }: IHeaderButtonContainer) => (
const Container = ({ children, left = false }: IHeaderButtonContainer) => (
<View style={[styles.container, left ? styles.left : styles.right]}>
{children}
</View>

View File

@ -93,6 +93,10 @@ interface ILoginServicesProps {
class LoginServices extends React.PureComponent<ILoginServicesProps, any> {
private _animation: any;
static defaultProps = {
separator: true
}
state = {
collapsed: true,
servicesHeight: new Animated.Value(SERVICES_COLLAPSED_HEIGHT)

View File

@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { View, Alert, Keyboard, Text } from 'react-native';
import {View, Alert, Keyboard, Text, NativeModules} from 'react-native';
import { connect } from 'react-redux';
import { KeyboardAccessoryView } from 'react-native-ui-lib/keyboard';
import ImagePicker from 'react-native-image-crop-picker';
@ -143,6 +143,16 @@ class MessageBox extends Component<IMessageBoxProps, IMessageBoxState> {
private component: any;
private typingTimeout: any;
static defaultProps = {
message: {
id: ''
},
sharing: false,
iOSScrollBehavior: NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorFixedOffset,
isActionsEnabled: true,
getCustomEmoji: () => {}
}
constructor(props: IMessageBoxProps) {
super(props);
this.state = {
@ -958,6 +968,7 @@ class MessageBox extends Component<IMessageBoxProps, IMessageBoxState> {
//@ts-ignore
style={[styles.textBoxInput, { color: themes[theme].bodyText }]}
returnKeyType='default'
//@ts-ignore
keyboardType='twitter'
blurOnSubmit={false}
placeholder={I18n.t('New_Message')}

View File

@ -141,7 +141,7 @@ const HeaderTitle = React.memo(({ title, tmid, prid, scale, theme, testID }: TRo
});
const Header = React.memo(({
title, subtitle, parentTitle, type, status, usersTyping, width, height, prid, tmid, onPress, theme, isGroupChat, teamMain, testID
title, subtitle, parentTitle, type, status, width, height, prid, tmid, onPress, theme, isGroupChat, teamMain, testID, usersTyping = []
}: IRoomHeader) => {
const portrait = height > width;
let scale = 1;

View File

@ -22,7 +22,7 @@ interface IRoomTypeIcon {
}
const RoomTypeIcon = React.memo(({
type, size, isGroupChat, status, style, theme, teamMain
type, isGroupChat, status, style, theme, teamMain, size = 16
}: IRoomTypeIcon) => {
if (!type) {
return null;

View File

@ -8,7 +8,7 @@ interface IStatus {
style: any;
}
const Status = React.memo(({ status, size, style, ...props }: IStatus) => {
const Status = React.memo(({ style, status = 'offline', size = 32, ...props }: IStatus) => {
const name = `status-${ status }`;
const isNameValid = CustomIcon.hasIcon(name);
const iconName = isNameValid ? name : 'status-offline';

View File

@ -72,6 +72,11 @@ interface IRCTextInputProps {
export default class RCTextInput extends React.PureComponent<IRCTextInputProps, any> {
static defaultProps = {
error: {},
theme: 'light'
}
state = {
showPassword: false
}
@ -167,6 +172,7 @@ export default class RCTextInput extends React.PureComponent<IRCTextInputProps,
inputStyle
]}
ref={inputRef}
/*@ts-ignore*/
autoCorrect={false}
autoCapitalize='none'
underlineColorAndroid='transparent'

View File

@ -54,7 +54,7 @@ export const MultiSelect = React.memo(({
value: values,
multiselect = false,
onSearch,
onClose,
onClose = () => {},
disabled,
inputStyle,
theme
@ -129,6 +129,7 @@ export const MultiSelect = React.memo(({
<View style={[styles.content, { backgroundColor: themes[theme].backgroundColor }]}>
<TextInput
testID='multi-select-search'
/*@ts-ignore*/
onChangeText={onSearch || onSearchChange}
placeholder={I18n.t('Search')}
theme={theme}

View File

@ -8,7 +8,7 @@ interface IList {
numberOfLines: number;
}
const List = React.memo(({ children, ordered, start = 1, tight, numberOfLines = 0 }: IList) => {
const List = React.memo(({ children, ordered, tight, start = 1, numberOfLines = 0 }: IList) => {
let bulletWidth = 15;
if (ordered) {

View File

@ -64,6 +64,28 @@ interface IMessageContainerProps {
class MessageContainer extends React.Component<IMessageContainerProps, any> {
static defaultProps = {
getCustomEmoji: () => {},
onLongPress: () => {},
onReactionPress: () => {},
onEncryptedPress: () => {},
onDiscussionPress: () => {},
onThreadPress: () => {},
errorActionsShow: () => {},
replyBroadcast: () => {},
reactionInit: () => {},
fetchThreadName: () => {},
showAttachment: () => {},
onReactionLongPress: () => {},
navToRoomInfo: () => {},
callJitsi: () => {},
blockAction: () => {},
archived: false,
broadcast: false,
isIgnored: false,
theme: 'light'
}
state = { isManualUnignored: false };
private subscription: any;

View File

@ -66,10 +66,10 @@ const RoomItem = ({
name,
avatar,
width,
avatarSize,
avatarSize = 48,
username,
showLastMessage,
status,
status = 'offline',
useRealName,
theme,
isFocused,
@ -88,7 +88,7 @@ const RoomItem = ({
tunreadUser,
tunreadGroup,
testID,
swipeEnabled,
swipeEnabled = true,
onPress,
onLongPress,
toggleFav,

View File

@ -50,6 +50,17 @@ class RoomItemContainer extends React.Component<IRoomItemContainerProps, any> {
private mounted: boolean;
private roomSubscription: any;
static defaultProps = {
avatarSize: 48,
status: 'offline',
getUserPresence: () => {},
getRoomTitle: () => 'title',
getRoomAvatar: () => '',
getIsGroupChat: () => false,
getIsRead: () => false,
swipeEnabled: true
}
constructor(props: IRoomItemContainerProps) {
super(props);
this.mounted = false;

View File

@ -86,6 +86,7 @@ const OutsideStack = () => {
<Outside.Screen
name='WithoutServersView'
component={WithoutServersView}
/*@ts-ignore*/
options={WithoutServersView.navigationOptions}
/>
</Outside.Navigator>