Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript & FC/Hook support #27

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,9 @@ dist

# macOS
.DS_Store

# default react testing apps
my-react-app/

# tsc results
lib/
5 changes: 5 additions & 0 deletions src/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 120,
"trailingComma": "all",
"singleQuote": true
}
43 changes: 0 additions & 43 deletions src/components/Event/Event.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { StyleSheet } from 'react-native';

const styles = StyleSheet.create({
item: {
// alignItems: 'center',
/* alignItems: 'center', */
position: 'absolute',
paddingVertical: 2,
paddingHorizontal: 2,
Expand Down
35 changes: 35 additions & 0 deletions src/components/Event/Event.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';
import { Text, TouchableOpacity } from 'react-native';

import styles from './Event.styles';

import { RNTEvent } from '../data';

interface EventProps {
event: RNTEvent;
onPress?: (e: RNTEvent) => any;
style: object;
}

const Event: React.FC<EventProps> = (props: EventProps) => {
const e = props.event;
const style = props.style;

return (
<TouchableOpacity
onPress={() => props.onPress && props.onPress(e)}
style={[styles.item, style, { backgroundColor: e.color }]}
>
<Text style={styles.title}>{e.title}</Text>
<Text style={styles.location}>{e.location}</Text>
{e.extraDescriptions &&
e.extraDescriptions.map((description, idx) => (
<Text key={idx} style={styles.description}>
{description}
</Text>
))}
</TouchableOpacity>
);
};

export default Event;
178 changes: 0 additions & 178 deletions src/components/Events/Events.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { StyleSheet } from 'react-native';

const GREY_COLOR = '#E9EDF0';
const ROW_HEIGHT = 60;
export { ROW_HEIGHT };
export const CONTENT_OFFSET = 0;
import {
EVENTS_CONTENT_OFFSET as CONTENT_OFFSET,
EVENTS_GREY_HEX as GREY_HEX,
EVENTS_ROW_HEIGHT as ROW_HEIGHT,
} from '../constant';

const styles = StyleSheet.create({
container: {
Expand All @@ -15,15 +15,15 @@ const styles = StyleSheet.create({
},
timeLabelLine: {
height: 1,
backgroundColor: GREY_COLOR,
backgroundColor: GREY_HEX,
position: 'absolute',
right: 0,
left: 0,
},
event: {
flex: 1,
overflow: 'hidden',
borderColor: GREY_COLOR,
borderColor: GREY_HEX,
borderLeftWidth: 1,
},
events: {
Expand Down
Loading