Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
30 changes: 14 additions & 16 deletions app/containers/TextInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { StyleSheet, Text, TextInputProps, View } from 'react-native';
import Touchable from 'react-native-platform-touchable';

import sharedStyles from '../views/Styles';
Expand Down Expand Up @@ -50,23 +50,21 @@ const styles = StyleSheet.create({
}
});

interface IRCTextInputProps {
interface IRCTextInputProps extends TextInputProps {
label: string;
error: {
error?: {
error: any;
reason: any;
};
loading: boolean;
secureTextEntry: boolean;
containerStyle: any;
inputStyle: object;
inputRef: any;
testID: string;
iconLeft: string;
iconRight: string;
placeholder: string;
left: JSX.Element;
onIconRightPress(): void;
loading?: boolean;
containerStyle?: any;
inputStyle?: object;
inputRef?: any;
testID?: string;
iconLeft?: string;
iconRight?: string;
left?: JSX.Element;
onIconRightPress?(): void;
theme: string;
}

Expand Down Expand Up @@ -152,7 +150,7 @@ export default class RCTextInput extends React.PureComponent<IRCTextInputProps,
contentDescription={null}
// @ts-ignore
accessibilityLabel={null}
style={[styles.label, { color: themes[theme].titleText }, error.error && { color: dangerColor }]}>
style={[styles.label, { color: themes[theme].titleText }, error?.error && { color: dangerColor }]}>
{label}
</Text>
) : null}
Expand All @@ -168,7 +166,7 @@ export default class RCTextInput extends React.PureComponent<IRCTextInputProps,
borderColor: themes[theme].separatorColor,
color: themes[theme].titleText
},
error.error && {
error?.error && {
color: dangerColor,
borderColor: dangerColor
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import { ScrollView, Share, View } from 'react-native';
import moment from 'moment';
import { connect } from 'react-redux';
import { StackNavigationProp, StackNavigationOptions } from '@react-navigation/stack';
import { RouteProp } from '@react-navigation/core';
import { Dispatch } from 'redux';

import {
inviteLinksClear as inviteLinksClearAction,
Expand All @@ -20,22 +22,28 @@ import SafeAreaView from '../../containers/SafeAreaView';
import { events, logEvent } from '../../utils/log';
import styles from './styles';

class InviteUsersView extends React.Component {
static navigationOptions = () => ({
interface IInviteUsersView {
navigation: StackNavigationProp<any, 'InviteUsersView'>;
route: RouteProp<any, 'InviteUsersView'>;
theme: string;
timeDateFormat: string;
invite: {
url: string;
expires: number;
maxUses: number;
uses: number;
};
createInviteLink(rid: string): void;
clearInviteLink(): void;
}
class InviteUsersView extends React.Component<IInviteUsersView, any> {
private rid: string;

static navigationOptions: StackNavigationOptions = {
title: I18n.t('Invite_users')
});

static propTypes = {
navigation: PropTypes.object,
route: PropTypes.object,
theme: PropTypes.string,
timeDateFormat: PropTypes.string,
invite: PropTypes.object,
createInviteLink: PropTypes.func,
clearInviteLink: PropTypes.func
};

constructor(props) {
constructor(props: IInviteUsersView) {
super(props);
this.rid = props.route.params?.rid;
}
Expand Down Expand Up @@ -97,17 +105,18 @@ class InviteUsersView extends React.Component {
renderExpiration = () => {
const { theme } = this.props;
const expirationMessage = this.linkExpirationText();
// @ts-ignore
return <Markdown msg={expirationMessage} username='' baseUrl='' theme={theme} />;
};

render() {
const { theme, invite } = this.props;
return (
<SafeAreaView style={{ backgroundColor: themes[theme].backgroundColor }}>
{/* @ts-ignore*/}
<ScrollView
{...scrollPersistTaps}
style={{ backgroundColor: themes[theme].auxiliaryBackground }}
contentContainerStyle={styles.contentContainer}
showsVerticalScrollIndicator={false}>
<StatusBar />
<View style={styles.innerContainer}>
Expand All @@ -123,15 +132,15 @@ class InviteUsersView extends React.Component {
}
}

const mapStateToProps = state => ({
const mapStateToProps = (state: any) => ({
timeDateFormat: state.settings.Message_TimeAndDateFormat,
days: state.inviteLinks.days,
maxUses: state.inviteLinks.maxUses,
invite: state.inviteLinks.invite
});

const mapDispatchToProps = dispatch => ({
createInviteLink: rid => dispatch(inviteLinksCreateAction(rid)),
const mapDispatchToProps = (dispatch: Dispatch) => ({
createInviteLink: (rid: string) => dispatch(inviteLinksCreateAction(rid)),
clearInviteLink: () => dispatch(inviteLinksClearAction())
});

Expand Down