Skip to content

Instantly share code, notes, and snippets.

@jsteiner
Created February 2, 2017 14:44
Show Gist options
  • Save jsteiner/ae9ffbb1645d82519418116b36a41824 to your computer and use it in GitHub Desktop.
Save jsteiner/ae9ffbb1645d82519418116b36a41824 to your computer and use it in GitHub Desktop.
// Be sure this is set
"native-modules": true,
module ScrollableTabView
exposing
( view
, initialPage
, tabBarActiveTextColor
, tabBarInactiveTextColor
, tabBarUnderlineStyle
, tabBarTextStyle
, tabBarStyle
)
import NativeUi as NativeUi exposing (Property, Node)
import NativeUi.Style as Style
import Native.ScrollableTabView
import Json.Encode
view : List (Property msg) -> List (Node msg) -> Node msg
view =
NativeUi.customNode "ScrollableTabView" Native.ScrollableTabView.view
initialPage : Int -> Property msg
initialPage =
NativeUi.property "initialPage" << Json.Encode.int
tabBarActiveTextColor : String -> Property msg
tabBarActiveTextColor =
NativeUi.property "tabBarActiveTextColor" << Json.Encode.string
tabBarInactiveTextColor : String -> Property msg
tabBarInactiveTextColor =
NativeUi.property "tabBarInactiveTextColor" << Json.Encode.string
tabBarUnderlineStyle : List Style.Style -> Property msg
tabBarUnderlineStyle =
NativeUi.property "tabBarUnderlineStyle" << Style.encode
tabBarTextStyle : List Style.Style -> Property msg
tabBarTextStyle =
NativeUi.property "tabBarTextStyle" << Style.encode
tabBarStyle : List Style.Style -> Property msg
tabBarStyle =
NativeUi.property "tabBarStyle" << Style.encode
// Gists don't allow subdirectories, but this is actually Native/ScrollableTabView.js
const _user$project$Native_ScrollableTabView = function () {
var ScrollableTabView = require('react-native-scrollable-tab-view');
return {
view: ScrollableTabView,
};
}();
@ferologics
Copy link

ferologics commented Feb 2, 2017

@jsteiner Do you have a project you used it with? I'm probably too new to Elm to get this. Nevertheless, I got it to compile, now struggling to import and actually use it. How would you use the ScrollableTabView? I can import the module but not use it, maybe a syntax issue / not getting some basics.

Structure

- src
⎸  ᴸ-- Native/
⎸  ⎸   ᴸ-- Animation.js
⎸  ᴸ-- Tab/
⎸  ⎸    ᴸ-- Scene.elm
⎸  ⎸    ᴸ-- ...
⎸  ᴸ-- Animation.elm
⎸  ᴸ-- Main.elm
⎸  ᴸ-- ...
.
.

error message goes: can't find variable 'Animation'.

↘️  ⬇️  ↙️
➡️ Gist  ⬅️
↗️  ⬆️  ↖️

--

EDIT

I have it working, now it just doesn't seem to do anything really. Doesn't display content or animate, styling..

EDIT

Lottie is now broken on React Native.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment