Skip to content

Commit

Permalink
Added scommons-react-navigation module
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor-podzigun committed Jan 7, 2020
1 parent 918b019 commit 6cd818b
Show file tree
Hide file tree
Showing 13 changed files with 395 additions and 49 deletions.
2 changes: 2 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ lazy val `scommons-react-native` = (project in file("."))
.aggregate(
`scommons-react-native-core`,
`scommons-react-native-test`,
`scommons-react-navigation`,
`scommons-react-native-showcase`
)

lazy val `scommons-react-native-core` = ReactNativeCore.definition
lazy val `scommons-react-native-test` = ReactNativeTest.definition
lazy val `scommons-react-navigation` = ReactNavigation.definition
lazy val `scommons-react-native-showcase` = ReactNativeShowcase.definition
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package scommons.react.navigation

import scommons.react.ReactClass

import scala.scalajs.js

trait StackRouteConfig extends js.Object {

val screen: ReactClass

val path: js.UndefOr[String] = js.undefined
val params: js.UndefOr[js.Object] = js.undefined

val navigationOptions: js.UndefOr[js.Function1[js.Object, js.Object]] = js.undefined
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package scommons.react.navigation.raw

import io.github.shogowada.scalajs.reactjs.classes.ReactClass

import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport

@js.native
@JSImport("react-navigation", JSImport.Namespace)
object ReactNavigation extends js.Object {

def createAppContainer(comp: ReactClass): ReactClass = js.native
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package scommons.react.navigation.raw

import scommons.react.ReactClass

import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport

@js.native
@JSImport("react-navigation-stack", JSImport.Namespace)
object ReactNavigationStack extends js.Object {

def createStackNavigator(routeConfigs: js.Object): ReactClass = js.native
}
4 changes: 4 additions & 0 deletions project/src/main/scala/definitions/ReactNativeShowcase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package definitions
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbt.Keys._
import sbt._
import scoverage.ScoverageKeys.coverageExcludedPackages

import scalajsbundler.sbtplugin.ScalaJSBundlerPlugin.autoImport._

Expand All @@ -19,6 +20,8 @@ object ReactNativeShowcase extends ScalaJsModule {
publishLocal := ((): Unit),
publishM2 := ((): Unit),

coverageExcludedPackages := "scommons.reactnative.showcase.ShowcaseApp",

scalaJSUseMainModuleInitializer := false,
webpackBundlingMode := BundlingMode.LibraryOnly(),

Expand All @@ -29,6 +32,7 @@ object ReactNativeShowcase extends ScalaJsModule {

override val internalDependencies: Seq[ClasspathDep[ProjectReference]] = Seq(
ReactNativeCore.definition,
ReactNavigation.definition,
ReactNativeTest.definition % "test"
)

Expand Down
31 changes: 31 additions & 0 deletions project/src/main/scala/definitions/ReactNavigation.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package definitions

import common.Libs
import sbt.Keys._
import sbt._
import scoverage.ScoverageKeys.coverageExcludedPackages

object ReactNavigation extends ScalaJsModule {

override val id: String = "scommons-react-navigation"

override val base: File = file("navigation")

override def definition: Project = super.definition
.settings(
description := "Scala.js facades for react-navigation Components and Api",
coverageExcludedPackages := "scommons.react.navigation.raw"
)

override val internalDependencies: Seq[ClasspathDep[ProjectReference]] = Nil

override val superRepoProjectsDependencies: Seq[(String, String, Option[String])] = Seq(
("scommons-react", "scommons-react-core", None)
)

override val runtimeDependencies: Def.Initialize[Seq[ModuleID]] = Def.setting(Seq(
Libs.scommonsReactCore.value
))

override val testDependencies: Def.Initialize[Seq[ModuleID]] = Def.setting(Nil)
}
Loading

0 comments on commit 6cd818b

Please sign in to comment.