Git Product home page Git Product logo

botghani-notepad's Introduction

PAD.io

A React-native list-creating app.

Table of Contents

  1. Development
  2. JS Style Guide

Development

Setup

Expo is a set of tools, libraries and services which let you build native iOS and Android apps by writing JavaScript and React.

Install Expo-CLI globally first:

npm install -g expo-cli

Then install the app dependencies:

yarn install

Back to top

Env Variables

Create a file named .env in the root directory with the following format:

DEBUG=false
PERSIST_STATE=false
Flag Type Description
DEBUG bool Indicates whether the app should run in development mode
PERSIST_STATE bool Indicates whether the app state should be persisted across closing and restarting the app

IMPORTANT NOTE:

If you change the value of a variable in .env, you must make a change to env.js in order for the new value to be applied. See: #168

Running

To run the application on an iphone simulator (like Xcode):

yarn ios

To run the application on an android emulator:

yarn andriod

Back to top

Debugging

In order to debug the app, remote debugging must be enabled on the device or simulator.

On the iPhone simulator:

  1. Press Cmd + D to open the development menu
  2. Click Debug Remote JS

If remote debugging is unavailable, ensure that production mode is not enabled. In the browser Metro bundler, production mode is displayed as a toggle near the QR code.

Back to top

Development tools

React Native Debugger

React Native Debugger is a standalone app that allows for easy debugging of React Native apps.

To install the app: brew cask install react-native-debugger (you may need to run brew update beforehand)

Before opening the app, ensure that no other React-native debugger is open.

To open the app: yarn rnd.

Note the port in the RND is run on 19001 because Expo runs on port 19000.

Expo Mobile App

To run your Expo app on your own personal mobile device download the Expo mobile app for iOS or Andriod.

To see the scanable QR code run:

yarn start

In order to install a fresh version of the Expo app, you can do the following:

  1. In the simulator menu bar, click Hardware > Erase All Content and Settings....
  2. Delete the Expo app within the simulator by clicking and holding down on the Expo app icon on the home page and clicking the x.
  3. Run yarn start and the expo app will be re-installed.

Back to top

JS Style Guide

Import Statements

Import statements should be written in the following order:

  • external packages & libs
  • state files
  • util files
  • React components
  • styles
  • relative path imports

E.g.

import Module from 'package'
import { action } from 'state/actions'
import { myFunction } from 'utils/myFunction'
import Component from 'components/Component'
import style from 'styles/style'
import LocalComponent from './LocalComponent'
import localStyle from './localStyle'

Back to top

Conditional Rendering

The format for conditionally rendering markup and React components depends on its size or nesting. Examples provided below:

{ condition && <Component prop1={value} /> }

{ condition ? <Component prop1={value} /> : <OtherComponent /> }

{
  condition &&
    <Component
      prop1={value1}
      prop2={value2}
      prop3={value3}
      prop4={value4}
      prop5={value5}
    />
}
{
  condition &&
    <Component prop1={value}>
      <Child />
    </Component>
}
{
  condition
    ? (
      <Component
        prop1={value1}
        prop2={value2}
        prop3={value3}
        prop4={value4}
        prop5={value5}
      />
    )
    : (
      <OtherComponent>
        <Child />
      </OtherComponent>
    )
}

Back to top

botghani-notepad's People

Contributors

christopherbot avatar deefourple avatar dependabot[bot] avatar

Stargazers

 avatar

botghani-notepad's Issues

group import statements appropriately

Group import statements as follows:

import Thing from 'module'
import relativeThing from '../relative/path'

import Component from '../relative/path'

import style from '../style'

Also add this to the README (under a new heading called something like 'Coding/syntax guidelines')

Reduce size of NavButton

The NavButton is a tad on the large side. It could be reduced a little bit (by 10px or so?) to take up a bit less space.

Create data structure for rows and columns

Suggested data structure:

rows: [{id, label}]
columns: [{id, label}]
data: [{id, rowId, columnId, value}]

This will make it easier to do things such as sorting/rearranging rows/columns since the data will be mapped by rowId and columnId

Improve Cell UI

Each table cell is currently super compact and doesn't offer enough visual whitespace to read the contents. Added padding would offer room for it to breathe.

improve the functionality of updating cell values

Currently, updating a cell (via clicking on it) changes the cell to an input field and displays an "Ok" and "Cancel" button which will save and cancel the update, respectively.

A simpler UI would be:

  • user clicks on a cell to update it, it turns into an input field
  • user updates the value
  • on blur of the input field, automatically save the current cell value

This offers no option to cancel the current update but it much nicer on mobile to simply tap away from the input

Expand the redux List state

Is currently just an array of strings.

Should be more complex i.e an array of objects

[
  {
     name:  string,
     id: string,
     rows: array 
     columns: array
     isBeingEdited: bool
  }
]

Active list settings bar

Create a settings bar that will display at the top of the page when one list is in view. It will contain items such as:

  • A delete button
  • An edit button (to rename the list)
  • Other things..??

depends on #84

Add style guide regarding ternary operators

Needs info.

// single line
{ condition ? <Component /> : <OtherComponent /> }

// multi line
{
  condition
    ? (
      <Component
        here={is}
        a={list}
        of={props} />
    )
    : <OtherComponent
}

Move the "Create List" input into the nav

The "Create List" component takes up screen space when viewing a list and is unnecessary to be seen all the time. It should be moved into the nav bar, most likely positioned at the top.

set up VSCode with proper plugins/key binds for React Native

I want to slowly transfer all of my coding to VSCode, but it's hard to do it at work because my productivity drops. I want to set it up for this project so I can spend some time getting used to it. You're welcome to do the same if you want to learn how to use another text editor! Apparently, when configured properly it's the best (free) IDE for React and Vue so my interest is peak @christopherbot

VSCode - React Native

add ability to sort list items

ideally, clicking on a category header should sort the list (alphabetically for strings, numerically for numbers, etc).

Allow user to input cell data

The cells are temporarily populated with cellR or cellC depending on if it was created by a createRow or createColumn action. This should be overwrite-able by the user (or don't even fill in the cell at all to begin with)

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.