Giter VIP home page Giter VIP logo

sri's Introduction

sri

Join the chat at https://gitter.im/chandu0101/sri

Sri (Scalajs React interface) is a scalajs library to build truly native cross platform (mobile (ios and android) and web) applications. It is based on reactjs and react-native, so you must be familiar with them in order to use this library.

sri

Code of Conduct

If you want live happily in sri org, you need to adapt to two simple things diversity and equality.

Diversity:

  1. Realise the fact that not every human Mother Tongue is English.

  2. If you find someones English is not good,try to help that person or just ignore and do your work.

Equality:

  1. What ever tag(CEO,VP,Lead,Sr.Dev,Architect,Jr.Dev,..) you have before your name,you're just another human being on this planet.

  2. If you find someone doing wrong technically,try fixing it by sending a PR/guide constructively or just ignore and do your work.

Docs

Community

If you have any question regarding sri , create an issue here

sri's People

Contributors

arturaz avatar chandu0101 avatar virtualirfan 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  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  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

sri's Issues

How to define a function of type js.Dynamic => _ ?

This is an example code to flip a colored rectangle when the button is pressed but still in error when running on emulator. What's wrong with my code?

object Experimental {
  case class State(
    angleAnim: AnimatedValue = new AnimatedValue(0)
  )
  class Component extends NavigationScreenComponentS[State] {
    initialState(State())
    var angle: Double = 0
    def render() = {
      import styles._
      val onPressHandler = () => {
        state.angleAnim.setValue(angle)
        Animated.timing(
          this.state.angleAnim,
          new TimingAnimationConfig {
            toValue = angle + 180
            duration = 1000 // ms?
          }
        ).start()
      }
      View(style = whole)(
        AnimatedView(style = tile(angle))(),
        Button(title = "flip", onPress = onPressHandler)
      )
    }
    val callbackFun = (x: js.Dynamic) => {
      // angle = x.asInstanceOf[Double]
    }
    override def componentDidMount(): Unit = {
      state.angleAnim.addListener(callbackFun)
    }
  }
  object styles extends InlineStyleSheetUniversal {
    import dsl._
    val whole = style(
      flex := 1,
      alignItems.center
    )
    def tile(angle: Double) = style(
      width := 100,
      height := 100,
      backgroundColor := (if (90 <= angle && angle < 270) "blue" else "red"),
      transform := js.Array(
        js.Dynamic.literal(rotateX = s"${angle}deg")
      )
    )
  }
}

2018-02-05 12 07 29

The error says, I guess, the function I passed isn't a function. But it's compiled and I can't see anything wrong.

2018-02-05 12 01 10

Here is what is generated by Scala.js, related to the callback function.

function $s_Le9_default_Experimental$Component__componentDidMount__Le9_default_Experimental$Component__V($this) {
  $as_Le9_default_Experimental$State($this.scalaState).angleAnim$1.addListener($as_F1($this.callbackFun))
}
...
function $s_Le9_default_Experimental$Component__$$anonfun$callbackFun$1__p6__Le9_default_Experimental$Component__sjs_js_Dynamic__V($this, x) {
  /*<skip>*/
}
var $b_Le9_default_Experimental$Component = (void 0);
function $a_Le9_default_Experimental$Component() {
  if ((!$b_Le9_default_Experimental$Component)) {
    /** @constructor */
    var $c_Le9_default_Experimental$Component = (function $c_Le9_default_Experimental$Component() {
      $a_Lsri_navigation_NavigationScreenComponentS().call(this, $m_Lsri_core_package$().neq__Lsri_core_package$$eq$colon$bang$eq());
      Object.defineProperty(this, "angle", {
        "configurable": true,
        "enumerable": true,
        "writable": true,
        "value": 0.0
      });
      Object.defineProperty(this, "callbackFun", {
        "configurable": true,
        "enumerable": true,
        "writable": true,
        "value": null
      });
      this.initialState(new $c_Le9_default_Experimental$State($m_Le9_default_Experimental$State$().apply$default$1__Lsri_universal_apis_AnimatedValue()));
      this.angle = 0.0;
      this.callbackFun = new $c_sjsr_AnonFunction1((function($this) {
        return (function(x$2) {
          var x = x$2;
          $s_Le9_default_Experimental$Component__$$anonfun$callbackFun$1__p6__Le9_default_Experimental$Component__sjs_js_Dynamic__V($this, x)
        })
      })(this))
    });

Publish plugin for SBT 1.x

The lack of sbt 1.x support means you cannot use this in a multi-project build, unless the whole project is on older sbt.

How can I merge two styles?

In the old sri project, there was a styleE to merge two styles but I couldn't find any in this project. How can I merge two styles?

Should we move towards Semantic Versioning?

Discussion

The article below discusses lots of aspects of Semantic Versioning.
From the perspective of automation, it seems clear to me that it's the way to go: there are several libraries which implement the tenets involved in this matter. However, from the human perspective, the matter is debatable. The section I point out in the link below discusses some of these human factors.
https://en.wikipedia.org/wiki/Software_versioning#Dropping_the_most_significant_element

The arcle below can be seen as a detailed study of the human factors pointed above.
It's worth reading in full.
http://dafoster.net/articles/2015/03/14/semantic-versioning-vs-romantic-versioning/

Can I use this with react-native-windows?

This doesn't end with a working project (but then again, I don't really know what I'm doing! :)

sbt new scalajs-react-interface/mobile.g8 # name it sample2
cd sample2
react-native init sample2
npm install --save-dev
npm install --save-dev rnpm-plugin-windows
react-native windows
react-native start

at runtime, i get the following (suggestion doesn't seem to help):

Loading dependency graph, done.
Bundling index.windows.js 0.0% (0/5), failed.
error: bundling failed: "Unable to resolve module AccessibilityInfo from C:\\source\\sample\\sample2\\node_modules\\react-native\\Libraries\\react-native\\react-native-implementation.js: Module does not exist in the module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: watchman watch-del-all.\n 2. Delete the node_modules folder: rm -rf node_modules && npm install.\n 3. Reset packager cache: rm -fr $TMPDIR/react-* or npm start -- --reset-cache."

`SriPlatform` conditionals should output the same code

React-native now uses a single index.js, instead of index.android.js and index.ios.js. Conditionals like if (SriPlatform.isAndroid) produces different code for android:dev and ios:dev tasks.

This makes it hard to use a single file index.js. It should produce the same code, like when using if (ReactPlatform.OS == "android")

Getting started results in `not found: value DrawerViewItems`

This is with reference to this version of the quick start: https://github.com/scalajs-react-interface/sri/blob/479c6744b317fc41889f66cbdab9bc863a0cda41/docs/GettingStarted.md

When following the steps for the Drawer Navigation under MacOSX 10.12.5 with XCode 8.3.2, the sbt step results in this:

Marcins-MacBook-Pro-2:bobo marcin$ sbt ~ios:dev
[info] Loading project definition from /Users/marcin/Documents/code/bobo/project
[info] Updating {file:/Users/marcin/Documents/code/bobo/project/}bobo-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to bobo (in build file:/Users/marcin/Documents/code/bobo/)
[info] Updating {file:/Users/marcin/Documents/code/bobo/}bobo...
[info] Resolving org.eclipse.jetty#jetty-continuation;8.1.16.v20140903 ...
[info] Done updating.
[info] Compiling 7 Scala sources to /Users/marcin/Documents/code/bobo/target/scala-2.11/classes...
[error] /Users/marcin/Documents/code/bobo/src/main/scala/com/marcintustin/bobo/components/package.scala:22: not found: value DrawerViewItems
[error]             DrawerViewItems(props)
[error]             ^
[error] one error found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 4 s, completed May 26, 2017 12:02:20 PM
1. Waiting for source changes... (press enter to interrupt)

No errors occur at previous stages.

Full steps to reproduce below:

sbt new scalajs-react-universe/mobile.g8 -b drawer-navigation
# enter project name bobo; accept default package name sri.mobile.template
cd bobo
react-native init bobo
mv bobo/android/ android
mv bobo/ios/ ios
npm install
react-native link react-native-vector-icons
# Switch to new shell
Marcins-MacBook-Pro-2:bobo marcin$ sbt ~ios:dev
[info] Loading project definition from /Users/marcin/Documents/code/bobo/project
[info] Updating {file:/Users/marcin/Documents/code/bobo/project/}bobo-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to bobo (in build file:/Users/marcin/Documents/code/bobo/)
[info] Updating {file:/Users/marcin/Documents/code/bobo/}bobo...
[info] Resolving org.eclipse.jetty#jetty-continuation;8.1.16.v20140903 ...
[info] Done updating.
[info] Compiling 7 Scala sources to /Users/marcin/Documents/code/bobo/target/scala-2.11/classes...
[error] /Users/marcin/Documents/code/bobo/src/main/scala/sri/mobile/template/components/package.scala:22: not found: value DrawerViewItems
[error]             DrawerViewItems(props)
[error]             ^
[error] one error found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 4 s, completed May 26, 2017 12:22:11 PM
1. Waiting for source changes... (press enter to interrupt)

Cannot start the basic example (Invalid regular expression)

After following the steps shown in the docs here: https://github.com/scalajs-react-interface/sri/blob/master/docs/GettingStarted.md#native-mobile-app

It ends with this error:

$ yarn start
yarn run v1.21.1
$ react-native start server --transformer scalajsTransformer.js
Looks like you installed react-native globally, maybe you meant react-native-cli
?
To fix the issue, run:
npm uninstall -g react-native
npm install -g react-native-cli
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comm
and.

(And yes, I've tried the uninstall/install step of the react-native-cli plugin)

Running without yarn, yields:

$ react-native start server --transformer scalajsTransformer.js
Scanning 495 folders for symlinks in F:\projects\home\cochesjs\node_modules (22m
s)
(node:15648) Warning: Accessing non-existent property 'padLevels' of module expo
rts inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)

Invalid regular expression: /(node_modules[\\\]react[\\\]dist[\\\].*|website\\no
de_modules\\.*|heapCapture\\bundle\.js)$/: Unterminated character class

Add fields to the ConcreteBatch facade in relay

It appears that in JS, ConcreteBatch has these fields. In particular, I needed to reference .text.

/*: ConcreteBatch*/
{
  "fragment": {…},
  "id": null,
  "kind": "Batch",
  "metadata": {},
  "name": "appQuery",
  "query": {…},
  "text": {…},
};

Module Maintainers

https://github.com/scalajs-react-interface/sri/blob/master/docs/SriModules.md

If you ran into issues with any of sri modules then create an issue and ping corresponding maintainers from below table.

Module Maintainers
Core @chandu0101
Univeral @chandu0101
Navigation @chandu0101
Mobile @chandu0101
Relay @chandu0101 ,@dispalt
Web Community
VDOM Community
Sbt-Sri-Platform @chandu0101
Vector-Icons @chandu0101
Macros @chandu0101, @dispalt
ScalaCSS Community
Diode Community
Mobile.g8 @chandu0101
Web.g8 Community
Mobile-Examples @chandu0101
Web-Examples Community
Code-Push @chandu0101

If you want to take responsibility for a particular module/modules then reply to this issue by answering the following question.

1)Are you using that module in your apps or just passion ?

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.