Coder Social home page Coder Social logo

shakacode / reactrails-react-native-client Goto Github PK

View Code? Open in Web Editor NEW
30.0 49.0 7.0 1.06 MB

This repository is for a react-native client to the https://www.reactrails.com/, source at https://github.com/shakacode/react-webpack-rails-tutorial/.

Home Page: http://www.shakacode.com/work

Python 4.67% Java 4.24% JavaScript 78.60% Objective-C 12.49%

reactrails-react-native-client's Introduction

React Native Tutorial

This is a simple mobile app example for posting comments in React Native. It connects the API at https://www.reactrails.com. You can see a web client there, plus links to the source.

Setup

  1. Install the latest version of Xcode from AppStore or https://developer.apple.com/download/ (Apple ID required)
  2. Install the latest version of Android Studio from https://developer.android.com/studio/index.html
  3. Install nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
  1. Install NodeJS stable
nvm install node
  1. Install React Native and recommended packages
npm install -g react-native-cli
brew install watchman
brew install flow
  1. Install npm dependencies
npm i
  1. Install Native Dependencies (maybe)
  • vector-icons

Customization in Native Files

Besides adding vector-icons

  1. App name
  2. Icons, both ios and android

Android

Android Keystore

  1. Edit android/app/src/main/AndroidManifest.xml

Backend API

  • Currently connecting by default to https://www.reactrails.com/. Be aware of that!
  • The url can be changed app/api/index.js. Keep in mind, that Android emulator is a separate Virtual Machine with its own localhost binding. To make the api available under that emulator, you will have to use ip address of your computer, which can be seen by running ifconfig in the shell

Running IOS

react-native run-ios

Running Android

  1. Check that installed build tools match gradle config of android project:
  • In gradle config (app > android > build.gradle), search buildToolsVersion
  • Run android sdk from bash and find installed build tools version there
  1. Run emulator from Android studio or emulator @<version> from bash (you can find installed version by running emulator -list-avds from bash)
  2. From project folder run
react-native run-android

Testing

Testing framework uses mocha + enzyme, to run tests type

npm test

Linters

This projects uses Eslint with React and React Native rules. To run linters type

npm run lint

Flow

This projects uses Eslint with React and React Native rules. To run linters type

npm run flow

Detailed docs

Can be found in docs folder. See Introduction to start.

reactrails-react-native-client's People

Contributors

alexeuler avatar jdeppen avatar justin808 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reactrails-react-native-client's Issues

Cannot read property style of undefined

I am trying to setup this project on my mac. I ran these commands.

brew install watchman
brew install flow

npm i
react-native run-ios

In my simulator, I am getting this error cannot read property style of undefined.

screen shot 2017-08-04 at 12 00 55 pm

Comments

Why not use https://facebook.github.io/react-native/docs/touchableopacity.html#touchableopacity
instead of:

const TouchableElement = Platform.OS === 'android' ?
      TouchableNativeFeedback :
      TouchableHighlight;

Don't you get warnings about missing key?

renderRow={(comment) => <Comment {...comment} />}

Do you normally have actions in Constructor?

constructor(props) {
    super(props);
    const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
    this.state = { dataSource: ds.cloneWithRows(this.props.comments) };
    this.props.actions.fetchComments();
  }

I would define dataSource in state like this:

this.state = { dataSource: new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }) };

ES6 fat arrow functions

I noticed that none of the Redux actions were written with ES6 fat arrow which a more concise syntax. I am updating...

export const setIsFetching = () => ({
  type: actionTypes.SET_IS_FETCHING
});
export function setIsFetching() {
  return {
    type: actionTypes.SET_IS_FETCHING,
  };
}

Explain how initialState is used?

Someone interested to walk me through this and explain it?

import reducers, { initialStates } from '../reducers';

export default () => {
  const { $$commentsState } = initialStates;
  const initialState = {
    $$commentsStore: $$commentsState.merge({
      $$comments: [],
    }),
  };

  const reducer = combineReducers(reducers);
  const composedStore = compose(
    applyMiddleware(thunkMiddleware, loggerMiddleware)
  );

  return composedStore(createStore)(reducer, initialState);
};

Unable to test

We need to find out how to test with .ios.js and .android.js files.

screen shot 2016-07-11 at 10 37 28 am

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.