Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Sep 21 05:08
    dependabot[bot] labeled #13
  • Sep 21 05:08
    dependabot[bot] opened #13
  • Sep 21 05:08

    dependabot[bot] on npm_and_yarn

    Bump tmpl from 1.0.4 to 1.0.5 … (compare)

  • Sep 21 05:03
    dependabot[bot] labeled #17
  • Sep 21 05:03
    dependabot[bot] opened #17
  • Sep 21 05:03

    dependabot[bot] on npm_and_yarn

    Bump tmpl from 1.0.4 to 1.0.5 … (compare)

  • Aug 11 04:05
    dependabot[bot] labeled #12
  • Aug 11 04:05
    dependabot[bot] opened #12
  • Aug 11 04:05

    dependabot[bot] on npm_and_yarn

    Bump path-parse from 1.0.5 to 1… (compare)

  • Aug 11 04:02
    dependabot[bot] labeled #16
  • Aug 11 04:02
    dependabot[bot] opened #16
  • Aug 11 04:02

    dependabot[bot] on npm_and_yarn

    Bump path-parse from 1.0.5 to 1… (compare)

  • May 12 01:22
    dependabot[bot] labeled #11
  • May 12 01:22
    dependabot[bot] opened #11
  • May 12 01:22

    dependabot[bot] on npm_and_yarn

    Bump merge from 1.2.0 to 1.2.1 … (compare)

  • May 12 01:18
    dependabot[bot] labeled #15
  • May 12 01:17
    dependabot[bot] opened #15
  • May 12 01:17

    dependabot[bot] on npm_and_yarn

    Bump merge from 1.2.0 to 1.2.1 … (compare)

  • May 10 16:22
    dependabot[bot] labeled #10
  • May 10 16:22
    dependabot[bot] opened #10
ashu2012
@ashu2012
@chandu0101 am i looking into old docs ?
Chandra Sekhar Kode
@chandu0101
yes , i am not linked to scalajs-react-native anymore.
ashu2012
@ashu2012
so what must be my bet if i want to build react-native if already have web app using scalajs- react japgolly . I want to use some native component as camera and opening web page is not available in mobile in webview.
@chandu0101 shall i look elsewhere like shadaj react native e.t.c ?
Chandra Sekhar Kode
@chandu0101
hmm , sri react-native is mature than other existing solutions out there !.but current examples doesnt work with latest react-native. @zaharidichev have local updated version, hope they'll push soon.
Vadim Bondarev
@haghard
Hello folks, I’d like to ask the follo
wing question: Is it possible to pass some params from MainActivity/MainApplication to MobileApp.scala(hope you see what I mean)
Vadim Bondarev
@haghard
Anyone ? Please
Chandra Sekhar Kode
@chandu0101
@haghard i dont know, ask in react-native discord channel
Jack
@JackDavidson
Hey, I was able to get a react-native-web app working with SRI (so its cross platform web, android, and ios) with SRI, but for web ('react-scripts start') I get eslint errors about undefined functions. I cant seem to modify the eslint rules, either. My workaround has been to an eslint-ignore comment to the top of the .js file that SRI outputs, and everything works fine but its a manual step. Do you know any way that I could edit the build.sbt file to automatically add the eslint-ignore line at the top? Also, I plan to make a public git repo with this as soon as I get it working.
Nikolay Khoroshevskyi
@rossoha
@chandu0101 Is it possible to expose function from components in SRI ? component that in the end will be analog of
class Step extends React.Component {
  constructor(props) {
 this.state = {
// State fields. 
    };
  }
  sendState() {
    return this.state;
  }

 render() {
    const { prop, classes } = this.props;
// Render stuff
  }
}
Jack
@JackDavidson
@NikolayKhoroshevsky Are you trying to ask if you can export components defined in RSI for use in react?
Nikolay Khoroshevskyi
@rossoha
@JackDavidson Yes. :)
Jack
@JackDavidson
then yeah, definetly. but IDK about the properties. you could probably export a function that will act like what you want

`import sri.universal.components.TextC
import scala.scalajs.js.annotation.JSExportTopLevel
import scala.language.postfixOps

object MobileApp {
def main(args: Array[String]) = {}
@JSExportTopLevel("MyExportedComponent")
val MyExportedComponent = TextC("some text")
}`

import sri.universal.components.TextC
import scala.scalajs.js.annotation.JSExportTopLevel
import scala.language.postfixOps

object MobileApp {
  def main(args: Array[String]) = {}
  @JSExportTopLevel("MyExportedComponent")
  val MyExportedComponent = TextC("some text")
}
then in react
render() {
  const MyStuff = require("./assets/js/scalajs-output-android").MyExportedComponent;
  return MyStuff
}
Nikolay Khoroshevskyi
@rossoha
Great! Thanks.
And one more question: my first goal is to have function exposed ( sendState in my example ). So if TextC would have a function without any access modifiers, it would be visible from js perspective as a usual function?
I’m asking because from what I see in scalajs-react it’s not clear or not possible, so I thinking about switching my project to SRI.
Jack
@JackDavidson
@NikolayKhoroshevsky I'm playing around with it, and it looks like there is some funkyness
Jack
@JackDavidson
@NikolayKhoroshevsky ok, here you can export a function:

object MobileApp {
def main(args: Array[String]) = {}
@JSExportTopLevel("MyExportedComponent")
def MyExportedComponent(text: String) = TextC(text)

}

Have you used react before, btw? a 'sendState' function is something I've never had use for in react. Generally I pass everything as properties
what your describing is possible though, you would want @ExportJS on the function that you want to be callable
Jack
@JackDavidson
@JSExportTopLevel("MyExportedComponent")
class MyCustomText(text: String) {
  var someVar = "initialValue"
  @JSExport
  def setSomeVar(text: String): Unit = {
    someVar = text
  }
  @JSExport
  def render(): ReactElement = {
    return TextC(text + someVar)

  }
}
then in react:
    const SRI = require("./assets/js/scalajs-output-android").MyExportedComponent;
    const SRIWText = SRI('starting text ')
    console.log('sri w text is:')
    console.log(SRIWText)
    SRIWText.setSomeVar('some new text')
    return SRIWText.render()
image.png
you can see the state of the component getting changed between the console.log and when it actually gets rendered
Nikolay Khoroshevskyi
@rossoha
@JackDavidson. Awesome! That’s what I wanted. Many thanks!
Jack
@JackDavidson
no problem. glad I could help :)
I'm still learning this too, haha. I actually just started working with this stuff on Monday.
Nikolay Khoroshevskyi
@rossoha
: )
Jack
@JackDavidson
ok, I managed to solve my issue. I figured out how to edit the fastOptJS task to append my step for disabling eslint
Jack
@JackDavidson
I have a sample sri-native plus react-native-web project finally: https://github.com/JackDavidson/Scalajs-React-Native-Web-Starter Still a bunch of work to do to give people a nice starting point though. its nothing more than some text on a page. One great thing about the way it works is that it does not require the additional SRI sbt plugin, it relies only on the scalajs plugin plus a small bit of extra sbt config to work around react's strict enforcing of eslint no-undef rule.
Jack
@JackDavidson
@chandu0101 Do you have any examples of using local images in scalajs-react-interface-native? I tried to create an image, and nothing showed up. I looked at the output javascript and it doesn't look right either. I modified the javascript directly to include a require of the image, and that worked. Originally, it was something like createElement(Image, {source:{uri:'my-img.png'}} and I was expecting (and what worked) was createElement(Image, {source: require('my-img')}}
Jack
@JackDavidson
I was able to define my own version of the ImageComponent that works fine with react-native. If this is an issue with the built-in Image, I'll submit a pull request with my code. What didn't work was: 'val img = Image(source = ImageSource("../my-image.png"))' A call to my replacement code looks like 'val img = MyImage(MyAssetLoader.require("../my-image.png"))'
Jack
@JackDavidson
Thank you!
Nikolay Khoroshevskyi
@rossoha

Could someone help with this:
I have a react component that takes props :

  steps: PropTypes.arrayOf(
      PropTypes.shape({
        stepName: PropTypes.string.isRequired,
        stepComponent: PropTypes.func.isRequired,
        stepId: PropTypes.string.isRequired
      })

And it renders it in this way:

         {steps.map((prop, key) => {
                const stepContentClasses = cx({
                  [classes.stepContentActive]: this.state.currentStep === key,
                  [classes.stepContent]: this.state.currentStep !== key
                });
                return (
                    <div className={stepContentClasses} key={key}>
                      <prop.stepComponent
                          innerRef={node => (this[prop.stepId] = node)}
                          allStates={this.state.allStates}
                      />
                    </div>
                );
              })}

Whatever I try to implement step component that I put as a property.. from browser debugger I see that
ReferenceError: node is not defined in line innerRef={node => (this[prop.stepId] = node)}

From what I see it should be a function that returns my step component but seem that this function should take params and one of them is innerRef that is not clear how to implement.

Nikolay Khoroshevskyi
@rossoha
Seems that I solved this:
  def apply(proper: js.Dynamic) = {
    val innerRef  = proper.innerRef.asInstanceOf[js.Function1[ChildEditComp, Unit]]
    val allStates = proper.allStates
    CreateElement[ChildEditComp](
      props = allStates,
      ref = innerRef
    )
  }
Richard Gomes
@frgomes

@chandu0101 @virtualirfan : Hello. I'm back after a long silence.

I'm upgrading sbt-sri-platform to SBT 1.0 and also upgrading ScalaJS 1.0.0-M8.
These changes trigger the need of recompiling everything.
Recompiling everything and republishing everything is a daunting task :-(
So, I have some ideas in regards to this subject:

  1. Using sbt-release-early makes life a lot easier since we don't need to manually adjust version in ThisBuild := whatever, given that sbt-release-early obtains the version number from Git. I've defined a tag v2019.06.26 and sbt publishLocal does exactly what I would expect: it publishes version v2019.06.26.

  2. This item is controversial: There are lots of projects and it's a lot of work to maintain all of them, set tags on all of them and publish all of them. I suggest we move all projects (with a few exceptions) to a single tree. I suggest that project scalajs-react-interface/sri holds everything (or almost everything!). I don't see the need of projects like discussion, since the issue management system itself is meant exactly for that.

Why I'm suggesting that? Because we can maintain all modules in a single go. We can update the version of ScalaJS, for example, recompile everything, test everything, apply one tag for all changes on all modules and publish all modules in a single go onto Bintray.

These are some projects which I'm currently working on:
https://github.com/frgomes/scalajs-jest/tree/v2019.06.26
https://github.com/frgomes/sbt-sri-platform/tree/v2019.06.26
https://github.com/frgomes/sri-core/tree/v2019.06.26

When I upgrade all modules, I will submit PRs against all projects.
Once again: if we had everything under a single tree, it would be enough to submit only one PR fixing only one ticket which applies to all modules.

Ideas?

Richard Gomes
@frgomes
@chandu0101 @virtualirfan :: If you guys agree with the idea of moving all submodules under a single repo, I volunteer to do that, which includes creating a multi-module project and possibly support for cross compilation for Scala 2.12 and 2.13.
virtualirfan
@virtualirfan
I'm OK with that. Let's see what @chandu0101 has to say since he had stronger feelings about it.
Richard Gomes
@frgomes
@virtualirfan @chandu0101 :: Reviewing the build files, there are lots of small mistakes which may or may not be relevant... who knows? Since a certain version of something is employed, the very same version should be employed across the board, on all projects. Given that there are 30+ projects to be maintained, chances are that leftovers will appear all over the place.
Richard Gomes
@frgomes
@virtualirfan @chandu0101 : The following projects under http://github.com/frgomes are migrated to ScalaJS 1.0.0-M8 and are sufficient for building a simple drawer navigator application. I haven't yet chance to deploy the application onto a simulator and see if it works.
sbt-sri-platform
scalajs-jest
scalajs-plus
sri-core
sri-universal
sri-mobile
sri-web
sri-vector-icons
sri-platform-config-android
sri-platform-config-ios
sri-platform-config-web
sri-navigation
Richard Gomes
@frgomes
@virtualirfan @chandu0101 :: Notice that build.sbt suggests cross build to Scala 2.12 and Scala 2.13. However, sri-core fails to build with Scala 2.13
Richard Gomes
@frgomes
@virtualirfan @chandu0101 :: In case you'd like to give it a try, you can build these projects more or less easier by using this bash script:
#!/bin/bash

function projects {
cat << EOD
sbt-sri-platform
scalajs-jest
scalajs-plus
sri-core
sri-universal
sri-mobile
sri-web
sri-vector-icons
sri-platform-config-android
sri-platform-config-ios
sri-platform-config-web
sri-navigation
EOD
}


function pending {
cat << EOD
sri-code-push
sri-diode
sri-enzyme
sri-graphql-sjs-models
sri-macros
sri-material-ui
sri-mobile-examples
sri-mobile.g8
sri-relay
sri-rx
sri-scalacss
sri-tools
sri-vdom
sri-vdom-styled
sri-victory
sri-web-bundle
sri-web-components
sri-web-examples
sri-web.g8
sri-web-router
sri-website
EOD
}

function sri_retag {
  projects | while read prj ;do
    echo ++++++++++ RETAGG ${prj} +++++++++++++++++++++++
    pushd $prj
    git tag -d v2019.06.26
    git tag -a v2019.06.26 -m 'Update ScalaJS 1.0.0-M8'
    popd
  done
}

function sri_build {
  projects | while read prj ;do
    echo ++++++++++ BUILDING ${prj} +++++++++++++++++++++++
    pushd $prj
    sbt publishLocal
    sync
    popd
  done
}

sri_retag && sri_build