Skip to content

Instantly share code, notes, and snippets.

View haruelrovix's full-sized avatar
👨‍💻
Working from anywhere

Havit Rovik haruelrovix

👨‍💻
Working from anywhere
View GitHub Profile
@haruelrovix
haruelrovix / CommitList.js
Created December 13, 2018 01:23
RNE x RNW: Render commits data
import React from 'react';
import { ActivityIndicator, Dimensions, FlatList, Platform, View } from 'react-native';
import { Avatar, ListItem } from 'react-native-elements';
import { compose } from 'redux';
import fetch from 'fetch-hoc';
import styles from '../Shared.style';
import withHeader from '../../HOCs/withHeader';
const containerStyle = {
@haruelrovix
haruelrovix / CommitList.js
Last active December 13, 2018 01:13
RNE x RNW: Add compose and fetch GitHub API
import { compose } from 'redux';
import fetch from 'fetch-hoc';
...
export default compose(
withHeader({ title: 'Commits' }),
fetch('https://api.github.com/repos/react-native-training/react-native-elements/commits')
)(CommitList);
@haruelrovix
haruelrovix / CommitList.js
Created December 11, 2018 23:35
RNE x RNW: withHeader HOC
import withHeader from '../../HOCs/withHeader';
...
export default withHeader({ title: 'Commits' })(CommitList);
@haruelrovix
haruelrovix / Home.js
Created December 11, 2018 22:52
RNE x RNW: Add withRouter to Home
import React, { PureComponent } from 'react';
import { View } from 'react-native';
import { Input, Button } from 'react-native-elements';
import styles from './Shared.style';
import { withRouter } from '../Utils/Routing';
class Home extends PureComponent {
onPressButton = () => {
// Go to Commit screen
@haruelrovix
haruelrovix / App.js
Created December 11, 2018 22:41
RNE x RNW: Add second component and Routing
import React, { Component } from 'react';
import Home from './Components/Home';
import CommitList from './Components/Commit/CommitList';
import { Route, Router, Switch } from './Utils/Routing';
class App extends Component {
render() {
return (
<Router>
<Switch>
@haruelrovix
haruelrovix / Routing.web.js
Created December 11, 2018 22:27
RNE x RNW: Routing for web
export {
BrowserRouter as Router,
Link,
Route,
Switch,
withRouter
} from 'react-router-dom';
@haruelrovix
haruelrovix / Routing.native.js
Created December 11, 2018 22:25
RNE x RNW: Routing for native
export {
NativeRouter as Router, // Rename
Link,
Route,
Switch,
withRouter
} from 'react-router-native';
@haruelrovix
haruelrovix / CommitList.js
Created December 11, 2018 22:10
RNE x RNW: Placeholder for second screen
import React from 'react';
import { Text, View } from 'react-native';
import styles from '../Shared.style';
const CommitList = () => (
<View style={styles.container}>
<Text>Placeholder for second screen</Text>
</View>
);
@haruelrovix
haruelrovix / webpack.config.dev.js
Created December 10, 2018 02:31
RNE x RNW: Transpile RNE and RNVI
include: [
paths.appSrc,
`${paths.appNodeModules}/react-native-elements`,
`${paths.appNodeModules}/react-native-vector-icons`
]
@haruelrovix
haruelrovix / App.js
Created December 10, 2018 02:23
RNE x RNW: Change TouchableHighlight to use RNE's Button
<Button
onPress={this.onClick}
buttonStyle={styles.button}
underlayColor={'#0A84D0'}
title='Rotate Logo'
titleStyle={styles.buttonText}
/>