Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 5 additions & 4 deletions TimeAgo.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// @flow
import React, { Component } from "react";
import { View, Text } from "react-native";
import { View, Text, TextStyle} from "react-native";
import moment from "moment";

export default class TimeAgo extends Component {
props: {
time: string,
interval?: number,
hideAgo?: boolean
hideAgo?: boolean,
textStyle?: TextStyle,
};
state: { timer: null | number } = { timer: null };

Expand Down Expand Up @@ -38,9 +39,9 @@ export default class TimeAgo extends Component {
};

render() {
const { time, hideAgo } = this.props;
const { time, hideAgo, textStyle } = this.props; // added textstyle prop
return (
<Text {...this.props}>
<Text style = {textStyle} {...this.props}>
{moment(time).fromNow(hideAgo)}
</Text>
);
Expand Down
2 changes: 2 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import * as React from 'react';
import {TextStyle} from 'react-native'

export interface Props {
time: string | number | Array<any> | Date;
interval?: number;
hideAgo?: boolean;
textStyle?: TextStyle,
}

declare module 'react-native-timeago' {
Expand Down