All Projects → Eugnis → React Native Timeline Flatlist

Eugnis / React Native Timeline Flatlist

Licence: mit
FlatList based timeline component for React Native for iOS and Android

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Timeline Flatlist

Timeline
Awesome UI: Timeline with images in Xamarin.Forms.
Stars: ✭ 29 (-82.21%)
Mutual labels:  cross-platform, timeline
Raz
Modern & multiplatform game engine in C++17
Stars: ✭ 161 (-1.23%)
Mutual labels:  cross-platform
Uno.quickstart
An Uno "Hello world!" project using Windows UWP, iOS, Android and WebAssembly
Stars: ✭ 157 (-3.68%)
Mutual labels:  cross-platform
Rubeus
A cross platform 2D game engine written in C++ for beginners
Stars: ✭ 159 (-2.45%)
Mutual labels:  cross-platform
Airsim
Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
Stars: ✭ 12,528 (+7585.89%)
Mutual labels:  cross-platform
Dilithium
Dilithium is a bidirectional shader converter for converting between DXIL and SPIR-V.
Stars: ✭ 160 (-1.84%)
Mutual labels:  cross-platform
Abot
Cross Platform C# web crawler framework built for speed and flexibility. Please star this project! +1.
Stars: ✭ 1,961 (+1103.07%)
Mutual labels:  cross-platform
Litenetlib
Lite reliable UDP library for Mono and .NET
Stars: ✭ 2,179 (+1236.81%)
Mutual labels:  cross-platform
Hprose Php
Hprose is a cross-language RPC. This project is Hprose 3.0 for PHP
Stars: ✭ 1,952 (+1097.55%)
Mutual labels:  cross-platform
Covid 19 Timeline
以 社会学年鉴模式体例规范地统编自2019年末起新冠肺炎疫情进展的时间线。
Stars: ✭ 1,887 (+1057.67%)
Mutual labels:  timeline
Scenejs
🎬 Scene.js is JavaScript & CSS timeline-based animation library
Stars: ✭ 2,019 (+1138.65%)
Mutual labels:  timeline
Framework
The Aurelia 1 framework entry point, bringing together all the required sub-modules of Aurelia.
Stars: ✭ 11,672 (+7060.74%)
Mutual labels:  cross-platform
Kvkcalendar
A most fully customization calendar and timeline library for iOS 📅
Stars: ✭ 160 (-1.84%)
Mutual labels:  timeline
Tools Ocr
树洞 OCR 文字识别(一款跨平台的 OCR 小工具)
Stars: ✭ 2,303 (+1312.88%)
Mutual labels:  cross-platform
Happypanda
A cross platform manga/doujinshi manager with namespace & tag support
Stars: ✭ 161 (-1.23%)
Mutual labels:  cross-platform
Axion Technologies Hnh
Hotter’n Hell Hundred is the largest one hundred mile cycling events in the United States and the world. Held in Wichita Falls, TX, this event brings thousands of registrants within the city limits, resulting in a spike in revenue throughout local businesses, restaurants, and hotels, and overall for the city of Wichita Falls. There are several sub-events within the Hotter’n Hell Hundred, such as different races, dining events, consumer shows and a medical symposium. The proposed Hotter’n Hell Hundred mobile application serves as the ultimate source of information for the events, enabling users to quickly register for events and explore local places. In addition, the mobile application allows users to navigate through race during the event, tracking their speed, nearby rest stops, alternate routes, and finish line, ensuring the best possible experience during their stay in Wichita Falls.
Stars: ✭ 155 (-4.91%)
Mutual labels:  cross-platform
Kstimeline
Simple custom timeline written in swift
Stars: ✭ 157 (-3.68%)
Mutual labels:  timeline
Dotnetomdgenerator
A Roslyn-based cross-platform tool that generates an object model diagram from a set of C# source files or assemblies
Stars: ✭ 160 (-1.84%)
Mutual labels:  cross-platform
Xrepo
🗂️ A cross-platform C/C++ package manager based on Xmake
Stars: ✭ 162 (-0.61%)
Mutual labels:  cross-platform
Xresloader
跨平台Excel导表工具(Excel=>protobuf/msgpack/lua/javascript/json/xml)
Stars: ✭ 161 (-1.23%)
Mutual labels:  cross-platform

React Native Timeline Flatlist

npm version Platform

Timeline component for React Native App work for Android and iOS

It's a fork of react-native-timeline-listview with some updates including FlatList, because old ListView is deprecated.

Examples in examples folder and on Expo https://expo.io/@eugnis/react-native-timeline-flatlist-examples

DEMO HERE

untitled-1

Table of Contents

Installation

npm i react-native-timeline-flatlist --save

or

yarn add react-native-timeline-flatlist

Basic Usage

image2

import Timeline from 'react-native-timeline-flatlist'

constructor(){
    super()
    this.data = [
      {time: '09:00', title: 'Event 1', description: 'Event 1 Description'},
      {time: '10:45', title: 'Event 2', description: 'Event 2 Description'},
      {time: '12:00', title: 'Event 3', description: 'Event 3 Description'},
      {time: '14:00', title: 'Event 4', description: 'Event 4 Description'},
      {time: '16:30', title: 'Event 5', description: 'Event 5 Description'}
    ]
  }

render(){
    return(
        <Timeline
          data={this.data}
        />
    )
}

see full basic example

Custom

image3

render(){
    return(
        <Timeline
          //..other props
          circleSize={20}
          circleColor='rgb(45,156,219)'
          lineColor='rgb(45,156,219)'
          timeContainerStyle={{minWidth:52, marginTop: -5}}
          timeStyle={{textAlign: 'center', backgroundColor:'#ff9797', color:'white', padding:5, borderRadius:13}}
          descriptionStyle={{color:'gray'}}
          options={{
            style:{paddingTop:5}
          }}
        />
    )
}

see full custom example

Circle Dot

image4

render(){
    return(
        <Timeline
          //..other props
          innerCircle={'dot'}
        />
    )
}

see full circle dot example

Icon

image5

constructor(){
    super()
    this.data = [
      {time: '09:00', title: 'Archery Training', description: 'The Beginner Archery and Beginner Crossbow course does not require you to bring any equipment, since everything you need will be provided for the course. ',lineColor:'#009688', icon: require('../img/archery.png')},
      {time: '10:45', title: 'Play Badminton', description: 'Badminton is a racquet sport played using racquets to hit a shuttlecock across a net.', icon: require('../img/badminton.png')},
      {time: '12:00', title: 'Lunch', icon: require('../img/lunch.png')},
      {time: '14:00', title: 'Watch Soccer', description: 'Team sport played between two teams of eleven players with a spherical ball. ',lineColor:'#009688', icon: require('../img/soccer.png')},
      {time: '16:30', title: 'Go to Fitness center', description: 'Look out for the Best Gym & Fitness Centers around me :)', icon: require('../img/dumbbell.png')}
    ]
  }
render(){
    return(
        <Timeline
          //..other props
          innerCircle={'icon'}
        />
    )
}

Also you can pass any React element as icon or iconDefault:

this.data = [
      ...
      {time: '12:00', title: 'Custom rendered icon', icon: <Image
      style={{width: 20, height: 20}}
      source={{uri: 'https://reactnative.dev/img/tiny_logo.png'}}
    />},
      ...
    ]
  }

see full icon example

Override Render

image6

constructor(){
    super()
    this.renderEvent = this.renderEvent.bind(this)

    this.data = [
      {
        time: '09:00',
        title: 'Archery Training',
        description: 'The Beginner Archery and Beginner Crossbow course does not require you to bring any equipment, since everything you need will be provided for the course. ',
        lineColor:'#009688',
        icon: require('../img/archery.png'),
        imageUrl: 'https://cloud.githubusercontent.com/assets/21040043/24240340/c0f96b3a-0fe3-11e7-8964-fe66e4d9be7a.jpg'
      },
      {
        time: '10:45',
        title: 'Play Badminton',
        description: 'Badminton is a racquet sport played using racquets to hit a shuttlecock across a net.',
        icon: require('../img/badminton.png'),
        imageUrl: 'https://cloud.githubusercontent.com/assets/21040043/24240405/0ba41234-0fe4-11e7-919b-c3f88ced349c.jpg'
      },
      {
        time: '12:00',
        title: 'Lunch',
        icon: require('../img/lunch.png'),
      },
      {
        time: '14:00',
        title: 'Watch Soccer',
        description: 'Team sport played between two teams of eleven players with a spherical ball. ',
        lineColor:'#009688',
        icon: require('../img/soccer.png'),
        imageUrl: 'https://cloud.githubusercontent.com/assets/21040043/24240419/1f553dee-0fe4-11e7-8638-6025682232b1.jpg'
      },
      {
        time: '16:30',
        title: 'Go to Fitness center',
        description: 'Look out for the Best Gym & Fitness Centers around me :)',
        icon: require('../img/dumbbell.png'),
        imageUrl: 'https://cloud.githubusercontent.com/assets/21040043/24240422/20d84f6c-0fe4-11e7-8f1d-9dbc594d0cfa.jpg'
      }
    ]
  }

renderDetail(rowData, sectionID, rowID) {
    let title = <Text style={[styles.title]}>{rowData.title}</Text>
    var desc = null
    if(rowData.description && rowData.imageUrl)
      desc = (
        <View style={styles.descriptionContainer}>
          <Image source={{uri: rowData.imageUrl}} style={styles.image}/>
          <Text style={[styles.textDescription]}>{rowData.description}</Text>
        </View>
      )

    return (
      <View style={{flex:1}}>
        {title}
        {desc}
      </View>
    )
  }

render(){
    return(
        <Timeline
          //..other props
          renderEvent={this.renderEvent}
        />
    )
}

see full override render example

Pull to refresh and load more

rflm

onRefresh(){
  //set initial data
}

onEndReached() {
  //fetch next data
}

renderFooter() {
    //show loading indicator
    if (this.state.waiting) {
        return <ActivityIndicator />;
    } else {
        return <Text>~</Text>;
    }
}

render(){
    return(
        <Timeline
          //..other props
          options={{
            refreshControl: (
              <RefreshControl
                refreshing={this.state.isRefreshing}
                onRefresh={this.onRefresh}
              />
            ),
            renderFooter: this.renderFooter,
            onEndReached: this.onEndReached
          }}
        />
    )
}

see full refresh and load more example

Column Format

Single Column Right

simulator screen shot apr 6 2560 be 5 19 51 pm

render(){
    return(
        <Timeline
          //..other props
          columnFormat='single-column-right'
        />
    )
}

see full single column right example

Two Column

simulator screen shot apr 6 2560 be 5 05 32 pm

render(){
    return(
        <Timeline
          //..other props
          columnFormat='two-column'
        />
    )
}

see full two column example

Time container hiding

showTime

render(){
    return(
        <Timeline
          //..other props
          showTime={false}
        />
    )
}

Configuration

Data Object:

Property Type Default Description
time string null event time
title string null event title
description string or object null event description
lineWidth int same as lineWidth of 'Timeline' event line width
lineColor string same as lineColor of 'Timeline' event line color
eventContainerStyle object null custom styles of line
circleSize int same as circleSize of 'Timeline' event circle size
circleColor string same as circleColor of 'Timeline' event circle color
dotColor string same as dotColor of 'Timeline' event dot color (innerCircle = 'dot')
icon obj(image source) or React.Element same as icon of 'Timeline' event icon (innerCircle = 'icon' or 'element')
position string null event side in 'two-column' layout : 'left', 'right'

Timeline:

Property Type Default Description
data data object null timeline data
innerCircle string null timeline mode : 'none', 'dot', 'icon', 'element'
separator bool true render separator line of events
columnFormat string 'single-left' can be 'single-column-left', 'single-column-right', 'two-column'
lineWidth int 2 timeline line width
lineColor string '#007AFF' timeline line color
circleSize int 16 timeline circle size
circleColor string '#007AFF' timeline circle color
dotColor string 'white' timeline dot color (innerCircle = 'dot')
dotSize int circleSize / 2 timeline dot size (innerCircle = 'dot')
iconDefault (or icon) obj(image source) or React.Element same as icon of 'Timeline' default event icon
style object null custom styles of Timeline container
listViewStyle object null custom styles of inner ListView
listViewContainerStyle object null custom styles of inner ListView container
timeStyle object null custom styles of event time
titleStyle object null custom styles of event title
descriptionStyle object null custom styles of event description
iconStyle object null custom styles of event icon
separatorStyle object null custom styles of separator
rowContainerStyle object null custom styles of event container
eventContainerStyle object null custom styles of the event part of the row (line)
eventDetailStyle object null custom styles of the event detail part of the row (line)
timeContainerStyle object null custom styles of container of event time
detailContainerStyle object null custom styles of container of event title and event description
onEventPress function(event) null function to be invoked when event was pressed
renderTime function(rowData, sectionID, rowID) null custom render event time
renderDetail function(rowData, sectionID, rowID) null custom render event title and event description
renderCircle function(rowData, sectionID, rowID) null custom render circle
renderFullLine bool false render event border on last timeline item
options object null ListView properties
showTime boolean true Time container options

Shift problem

Text width of event time may not be the same.

untitled-1

fix by add 'minWidth' in 'timeContainerStyle' to appropriate value

render(){
    return(
        <Timeline
          //..other props
          timeContainerStyle={{minWidth:72}}
        />
    )
}

Timeline is rendered, but not displayed until scroll

fix by add removeClippedSubviews: false into options

render(){
    return(
        <Timeline
          //..other props
          options={{
            removeClippedSubviews: false
          }}
        />
    )
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].