Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Working from anywhere

Havit Rovik haruelrovix

👨‍💻
Working from anywhere
View GitHub Profile
@haruelrovix
haruelrovix / CommitList.js
Created Dec 13, 2018
RNE x RNW: Render commits data
View CommitList.js
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 Dec 13, 2018
RNE x RNW: Add compose and fetch GitHub API
View CommitList.js
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 Dec 11, 2018
RNE x RNW: withHeader HOC
View CommitList.js
import withHeader from '../../HOCs/withHeader';
...
export default withHeader({ title: 'Commits' })(CommitList);
@haruelrovix
haruelrovix / Home.js
Created Dec 11, 2018
RNE x RNW: Add withRouter to Home
View Home.js
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 Dec 11, 2018
RNE x RNW: Add second component and Routing
View App.js
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 Dec 11, 2018
RNE x RNW: Routing for web
View Routing.web.js
export {
BrowserRouter as Router,
Link,
Route,
Switch,
withRouter
} from 'react-router-dom';
@haruelrovix
haruelrovix / Routing.native.js
Created Dec 11, 2018
RNE x RNW: Routing for native
View Routing.native.js
export {
NativeRouter as Router, // Rename
Link,
Route,
Switch,
withRouter
} from 'react-router-native';
@haruelrovix
haruelrovix / CommitList.js
Created Dec 11, 2018
RNE x RNW: Placeholder for second screen
View CommitList.js
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 Dec 10, 2018
RNE x RNW: Transpile RNE and RNVI
View webpack.config.dev.js
include: [
paths.appSrc,
`${paths.appNodeModules}/react-native-elements`,
`${paths.appNodeModules}/react-native-vector-icons`
]
@haruelrovix
haruelrovix / App.js
Created Dec 10, 2018
RNE x RNW: Change TouchableHighlight to use RNE's Button
View App.js
<Button
onPress={this.onClick}
buttonStyle={styles.button}
underlayColor={'#0A84D0'}
title='Rotate Logo'
titleStyle={styles.buttonText}
/>
You can’t perform that action at this time.