react-native-auto-timeago

Auto-updating timeago component for React Native

Usage no npm install needed!

<script type="module">
  import reactNativeAutoTimeago from 'https://cdn.skypack.dev/react-native-auto-timeago';
</script>

README

react-native-auto-timeago

View package on npm npm Build status

An auto-updating timeago component for React Native using moment.js.

Usage

import React, { Component } from 'react';
import TimeAgo from 'react-native-auto-timeago';

// Timestamp can be any valid data type accepted in a Moment.js constructor
// Currently accepts string, number, array, or a Date instance
let timestamp = "1630470872";

class MyComponent extends Component {

  ...

  render() {
    return (
      <TimeAgo short={true} timestamp={timestamp} interval={20000} />
    )
  }

  ...
};

All normal Text props are applicable (including style). Use the interval prop to change the update interval in milliseconds