Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ package-lock.json
**/lib/ocaml
**/.merlin

*.bs.js
*.res.js
28 changes: 13 additions & 15 deletions examples/AvatarExample.res
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
open ReactNative

let imageSource: ReactNative.Image.Source.t = %raw(`{ uri: "https://i.imgur.com/0y8Ftya.jpg"}`)

@react.component
let make = () =>
<View>
<Elements.Avatar
source={Image.Source.fromUriSource(
Image.uriSource(~uri="https://s3.amazonaws.com/uifaces/faces/twitter/jsa/128.jpg", ()),
)}
source={
let source: ReactNative.Image.Source.t = %raw(`{ uri: "https://s3.amazonaws.com/uifaces/faces/twitter/jsa/128.jpg"}`)
source
}
activeOpacity=0.7
avatarStyle={
open Style
style(~borderRadius=145. /. 2., ())
ReactNative.Style.s({borderRadius: 145. /. 2.})
}
overlayContainerStyle={
open Style
style(~backgroundColor=Color.transparent, ())
ReactNative.Style.s({backgroundColor: Color.transparent})
}
/>
<Elements.Avatar
rounded=true
source={Image.Source.fromUriSource(
Image.uriSource(~uri="https://i.imgur.com/0y8Ftya.jpg", ()),
)}
imageProps={Elements.Image.fromImageProps(
~source=Image.Source.fromUriSource(
Image.uriSource(~uri="https://i.imgur.com/0y8Ftya.jpg", ()),
),
~resizeMode=#contain,
(),
)}
source={
let source: ReactNative.Image.Source.t = %raw(`{ uri: "https://i.imgur.com/0y8Ftya.jpg"}`)
source
}
imageProps={Elements.Image.fromImageProps(~source=imageSource, ~resizeMode=#contain, ())}
/>
</View>
25 changes: 11 additions & 14 deletions examples/BadgeExample.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
open ReactNative

let source: ReactNative.Image.Source.t = %raw(`{ uri: "https://randomuser.me/api/portraits/men/41.jpg"}`)

let styles = {
open Style
StyleSheet.create({
"container": ReactNative.Style.s({backgroundColor: ReactNative.Color.transparent}),
})
}

@react.component
let make = () =>
<View>
Expand All @@ -9,19 +18,7 @@ let make = () =>
<Elements.Badge status=#warning />
// Avatar with mini badge
<View>
<Elements.Avatar
rounded=true
source={ReactNative.Image.Source.fromUriSource(
ReactNative.Image.uriSource(~uri="https://randomuser.me/api/portraits/men/41.jpg", ()),
)}
size=#large
/>
<Elements.Badge
status=#success
containerStyle={
open Style
style(~backgroundColor=ReactNative.Color.transparent, ())
}
/>
<Elements.Avatar rounded=true source size=#large />
<Elements.Badge status=#success containerStyle={styles["container"]} />
</View>
</View>
3 changes: 2 additions & 1 deletion examples/ListItemExample.res
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let list = [
]

@react.component
let make = () =>
let make = () => {
<FlatList
keyExtractor={(_item, index) => string_of_int(index)}
data=list
Expand All @@ -33,3 +33,4 @@ let make = () =>
</ListItem>
}}
/>
}
2 changes: 1 addition & 1 deletion examples/TextExample.res
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let make = () =>
h1=true
h1Style={
open Style
style(~paddingHorizontal=10.->dp, ~paddingVertical=20.->dp, ())
ReactNative.Style.s({paddingHorizontal: 10.->dp, paddingVertical: 20.->dp})
}>
{React.string("hello")}
</Elements.Text>
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rescript-react-native-elements",
"version": "3.4.0",
"version": "3.5.0",
"description": "React Native Elements bindings for rescript",
"keywords": [
"rescript",
Expand All @@ -19,16 +19,17 @@
"lint:staged": "lint-staged"
},
"peerDependencies": {
"@rescript/react": "^0.9.0",
"@rescript/react": "^0.13.0",
"react-native": "^0.63.3",
"react-native-elements": "^3.4.0",
"rescript-react-native": "^0.63.2"
},
"devDependencies": {
"@rescript/react": "^0.10.3",
"prettier": "^2.2.0",
"rescript": "^9.1.4",
"rescript-react-native": "^0.66.0"
"@rescript/core": "^1.6.1",
"@rescript/react": "^0.13.1",
"prettier": "^3.6.2",
"rescript": "^11.1.4",
"rescript-react-native": "^0.77.4"
},
"author": "Remi THOMAS",
"license": "ISC"
Expand Down
27 changes: 16 additions & 11 deletions bsconfig.json → rescript.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
{
"name": "rescript-react-native-elements",
"reason": {
"react-jsx": 3
},
"bs-dependencies": ["@rescript/react", "rescript-react-native"],
"suffix": ".bs.js",
"package-specs": [
{
"module": "es6",
"in-source": false
}
],
"sources": [
{
"dir": "src",
Expand All @@ -22,5 +11,21 @@
"type": "dev"
}
],
"package-specs": [
{
"module": "esmodule",
"in-source": false
}
],
"suffix": ".res.js",
"bs-dependencies": [
"@rescript/core",
"@rescript/react",
"rescript-react-native"
],
"jsx": {
"version": 4
},
"bsc-flags": ["-open RescriptCore"],
"namespace": "react-native-elements"
}
2 changes: 1 addition & 1 deletion src/Elements_Badge.res
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open ReactNative
module BadgeValue = {
type t

external fromString: string => t = ""
@send external fromString: string => t = ""
// Todo: value as React.element
// [@bs.module "react-native-elements"] external fromReactElement: React.element => t = "";
}
Expand Down
2 changes: 1 addition & 1 deletion src/Elements_Icon.res
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ external make: (
~reverseColor: Color.t=?,
~size: int=?,
~solid: bool=?,
~_type: @string("type")
~_type: @as("type")
[
| #material
| @as("material-community") #materialCommunity
Expand Down
8 changes: 4 additions & 4 deletions src/Elements_Image.res
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ external fromImageProps: (
~accessibilityLabel: string=?,
~accessible: bool=?,
~blurRadius: float=?,
~capInsets: View.edgeInsets=?,
~defaultSource: Image.DefaultSource.t=?,
~capInsets: Rect.t=?,
~defaultSource: Image.Source.t=?,
~fadeDuration: float=?,
~loadingIndicatorSource: array<Image.Source.t>=?,
~onError: Image.errorEvent => unit=?,
Expand Down Expand Up @@ -40,8 +40,8 @@ external make: (
string=?,
~accessible: bool=?,
~blurRadius: float=?,
~capInsets: View.edgeInsets=?,
~defaultSource: Image.DefaultSource.t=?,
~capInsets: Rect.t=?,
~defaultSource: Image.Source.t=?,
~fadeDuration: float=?,
~loadingIndicatorSource: array<Image.Source.t>=?,
~onError: Image.errorEvent => unit=?,
Expand Down
2 changes: 1 addition & 1 deletion src/Elements_ListItem.res
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module Chevron = {
~reverseColor: Color.t=?,
~size: int=?,
~solid: bool=?,
~_type: @string("type")
~_type: @as("type")
[
| #material
| @as("material") #material
Expand Down
2 changes: 1 addition & 1 deletion src/Elements_Overlay.res
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ external make: (
| #formSheet
| #overFullScreen
]=?,
~supportedOrientations: array<Modal.Orientation.t>=?,
~supportedOrientations: array<Modal.orientation>=?,
~transparent: bool=?,
unit,
) => React.element = "Overlay"
2 changes: 1 addition & 1 deletion src/Elements_Rating.res
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Rating = {
~showRating: bool=?,
~startingValue: float=?,
~style: Style.t=?,
~_type: @string("type")
~_type: @as("type")
[
| #star
| #rocket
Expand Down
69 changes: 35 additions & 34 deletions src/Elements_SocialIcon.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
open ReactNative

@unboxed
type iconType =
| @as("angellist") Angellist
| @as("codepen") Codepen
| @as("envelope") Envelope
| @as("etsy") Etsy
| @as("facebook") Facebook
| @as("flickr") Flickr
| @as("foursquare") Foursquare
| @as("github-alt") GithubAlt
| @as("github") Github
| @as("gitlab") Gitlab
| @as("instagram") Instagram
| @as("linkedin") Linkedin
| @as("medium") Medium
| @as("pinterest") Pinterest
| @as("quora") Quora
| @as("reddit-alien") RedditAlien
| @as("soundcloud") Soundcloud
| @as("stack-overflow") StackOverflow
| @as("steam") Steam
| @as("stumbleupon") Stumbleupon
| @as("tumblr") Tumblr
| @as("twitch") Twitch
| @as("twitter") Twitter
| @as("google") Google
| @as("google-plus-official") GooglePlusOfficial
| @as("vimeo") Vimeo
| @as("vk") Vk
| @as("weibo") Weibo
| @as("wordpress") Wordpress
| @as("youtube") Youtube

@react.component @module("react-native-elements")
external make: (
~button: bool=?,
Expand All @@ -11,7 +44,7 @@ external make: (
~iconColor: Color.t=?,
~iconSize: int=?,
~iconStyle: Style.t=?,
~_type: @string("type")
~_type: @as("type")
[
| #material
| @as("material-community") #materialCommunity
Expand All @@ -35,39 +68,7 @@ external make: (
~raised: bool=?,
~style: Style.t=?,
~title: string=?,
~iconType: @string
[
| #angellist
| #codepen
| #envelope
| #etsy
| #facebook
| #flickr
| #foursquare
| @as("github-alt") #githubAlt
| #github
| #gitlab
| #instagram
| #linkedin
| #medium
| #pinterest
| #quora
| @as("reddit-alien") #redditAlien
| #soundcloud
| @as("stack-overflow") #stackOverflow
| #steam
| #stumbleupon
| #tumblr
| #twitch
| #twitter
| #google
| @as("google-plus-official") #googlePlusOfficial
| #vimeo
| #vk
| #weibo
| #wordpress
| #youtube
],
~iconType: iconType,
~underlayColor: Color.t=?,
unit,
) => React.element = "SocialIcon"
37 changes: 21 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@
# yarn lockfile v1


"@rescript/react@^0.10.3":
version "0.10.3"
resolved "https://registry.yarnpkg.com/@rescript/react/-/react-0.10.3.tgz#a2a8bed6b017940ec26c2154764b350f50348889"
integrity sha512-Lf9rzrR3bQPKJjOK3PBRa/B3xrJ7CqQ1HYr9VHPVxJidarIJJFZBhj0Dg1uZURX+Wg/xiP0PHFxXmdj2bK8Vxw==
"@rescript/core@^1.6.1":
version "1.6.1"
resolved "https://registry.yarnpkg.com/@rescript/core/-/core-1.6.1.tgz#159670c94d64a2b8236f46be2bf09a007b1ece08"
integrity sha512-vyb5k90ck+65Fgui+5vCja/mUfzKaK3kOPT4Z6aAJdHLH1eljEi1zKhXroCiCtpNLSWp8k4ulh1bdB5WS0hvqA==

prettier@^2.2.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c"
integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==
"@rescript/react@^0.13.1":
version "0.13.1"
resolved "https://registry.yarnpkg.com/@rescript/react/-/react-0.13.1.tgz#19a90b2de39e4742bf73f834fe795fa9db5e06d5"
integrity sha512-VIWtu/sAJyYmDVoAhit0LHDYQrW6RqZ6z8sh8san5cjEAT4klv8JWkiaSK3FGUfooUDkGUXXgKTkqyj8zRR21w==

rescript-react-native@^0.66.0:
version "0.66.0"
resolved "https://registry.yarnpkg.com/rescript-react-native/-/rescript-react-native-0.66.0.tgz#2b6981dce30ffd0b88cd7c585cd05609a6177a4d"
integrity sha512-EuB1gAYjrXO7LtYRxB+/doJw9jX0oKhefpJ4yiREsYd2AW4lMva8UVAHh1GKV7jkDW9012jdyfY6E81mzl7ysQ==
prettier@^3.6.2:
version "3.6.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.6.2.tgz#ccda02a1003ebbb2bfda6f83a074978f608b9393"
integrity sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==

rescript@^9.1.4:
version "9.1.4"
resolved "https://registry.yarnpkg.com/rescript/-/rescript-9.1.4.tgz#1eb126f98d6c16942c0bf0df67c050198e580515"
integrity sha512-aXANK4IqecJzdnDpJUsU6pxMViCR5ogAxzuqS0mOr8TloMnzAjJFu63fjD6LCkWrKAhlMkFFzQvVQYaAaVkFXw==
rescript-react-native@^0.77.4:
version "0.77.4"
resolved "https://registry.yarnpkg.com/rescript-react-native/-/rescript-react-native-0.77.4.tgz#592a58f4c90c524989346d2c6b7edb799451d353"
integrity sha512-wDknv6RrHidmg5nnEwunIZXJOcRmtqji4Vg3MWj/q568w3+7Ta8xigrquEtR4bzdmELGG0l1AvvOjjNEF+iffA==

rescript@^11.1.4:
version "11.1.4"
resolved "https://registry.yarnpkg.com/rescript/-/rescript-11.1.4.tgz#9a42ebc4fc5363707e39cef5b3188160b63bee42"
integrity sha512-0bGU0bocihjSC6MsE3TMjHjY0EUpchyrREquLS8VsZ3ohSMD+VHUEwimEfB3kpBI1vYkw3UFZ3WD8R28guz/Vw==