Skip to content

Commit

Permalink
implemented Linking with Link.re
Browse files Browse the repository at this point in the history
  • Loading branch information
idkjs committed Mar 13, 2019
1 parent bbddd27 commit a15ab8b
Show file tree
Hide file tree
Showing 19 changed files with 911 additions and 30 deletions.
1 change: 1 addition & 0 deletions .bsb.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
90861
20 changes: 12 additions & 8 deletions .merlin
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
####{BSB GENERATED: NO EDIT
FLG -ppx '/Users/prisc_000/Downloads/react-native-web-test/node_modules/bs-platform/lib/reactjs_jsx_ppx_2.exe'
FLG -ppx /Users/prisc_000/Downloads/react-native-web-test/node_modules/bs-platform/lib/bsppx.exe
S /Users/prisc_000/Downloads/react-native-web-test/node_modules/bs-platform/lib/ocaml
B /Users/prisc_000/Downloads/react-native-web-test/node_modules/bs-platform/lib/ocaml
FLG -ppx '/Users/prisc_000/working/RNWEB/reason-react-native-web-demo/node_modules/bs-platform/lib/reactjs_jsx_ppx_2.exe'
FLG -ppx /Users/prisc_000/working/RNWEB/reason-react-native-web-demo/node_modules/bs-platform/lib/bsppx.exe
S /Users/prisc_000/working/RNWEB/reason-react-native-web-demo/node_modules/bs-platform/lib/ocaml
B /Users/prisc_000/working/RNWEB/reason-react-native-web-demo/node_modules/bs-platform/lib/ocaml
FLG -nostdlib -color always
FLG -w -30-40+6+7+27+32..39+44+45+101
S /Users/prisc_000/Downloads/react-native-web-test/node_modules/bs-react-native/lib/ocaml
B /Users/prisc_000/Downloads/react-native-web-test/node_modules/bs-react-native/lib/ocaml
S /Users/prisc_000/Downloads/react-native-web-test/node_modules/reason-react/lib/ocaml
B /Users/prisc_000/Downloads/react-native-web-test/node_modules/reason-react/lib/ocaml
S /Users/prisc_000/working/RNWEB/reason-react-native-web-demo/node_modules/bs-react-native/lib/ocaml
B /Users/prisc_000/working/RNWEB/reason-react-native-web-demo/node_modules/bs-react-native/lib/ocaml
S /Users/prisc_000/working/RNWEB/reason-react-native-web-demo/node_modules/reason-react/lib/ocaml
B /Users/prisc_000/working/RNWEB/reason-react-native-web-demo/node_modules/reason-react/lib/ocaml
S src
B lib/bs/src
S src/BsReactNativeWeb
B lib/bs/src/BsReactNativeWeb
S src/BsReactNativeWeb/private
B lib/bs/src/BsReactNativeWeb/private
S src/styles
B lib/bs/src/styles
####BSB GENERATED: NO EDIT}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"react": "16.8.4",
"react-art": "16.8.4",
"react-dom": "16.8.4",
"react-native-web": "0.10.0",
"react-native-web": "0.11.0",
"react-scripts": "2.1.8",
"reason-react": "0.5.3"
"reason-react": "0.6.0"
},
"devDependencies": {
"bs-platform": "4.0.18",
Expand Down
15 changes: 4 additions & 11 deletions src/App.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 6 additions & 9 deletions src/App.re
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,16 @@ let make = (_children) => {
</View>
<Text style=styles##text>
"This is an example of an app built with "->s
<Text> <a href="https://github.com/facebook/create-react-app">
"Create React App"->s </a>
</Text>
<Link href="https://github.com/facebook/create-react-app"
value="Create React App" />
" and "->s
<Text style=styles##link> <a href="https://github.com/necolas/react-native-web">
"React Native for Web"->s</a>
</Text>
<Link href="https://github.com/necolas/react-native-web" value=
"React Native for Web"/>
</Text>
<Text style=styles##text>
"To get started, edit "->s
<Text style=styles##link> <a style=Styles.code href="https://codesandbox.io/s/q4qymyp2l6/">
"src/App.js"->s </a>
</Text>
<Link style=styles##code href="https://codesandbox.io/s/q4qymyp2l6/"
value="src/App.js" />
". "->s
</Text>
<Button onPress={() => Js.log("Example button pressed")} title="Example button" />
Expand Down
104 changes: 104 additions & 0 deletions src/BsReactNativeWeb/TextWeb.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 102 additions & 0 deletions src/BsReactNativeWeb/TextWeb.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
module type TextComponent = {
let make:
(
~accessibilityRole: string=?,
~accessible: bool=?,
~allowFontScaling: bool=?,
~ellipsizeMode: [ | `clip | `head | `middle | `tail]=?,
~numberOfLines: int=?,
~onLayout: BsReactNative.RNEvent.NativeLayoutEvent.t => unit=?,
~onLongPress: unit => unit=?,
~onPress: unit => unit=?,
~pressRetentionOffset: BsReactNative.Types.insets=?,
~selectable: bool=?,
~style: BsReactNative.Style.t=?,
~testID: string=?,
~selectionColor: string=?,
~textBreakStrategy: [ | `simple | `highQuality | `balanced]=?,
~adjustsFontSizeToFit: bool=?,
~minimumFontScale: float=?,
~suppressHighlighting: bool=?,
~value: string=?,
array(ReasonReact.reactElement)
) =>
ReasonReact.component(
ReasonReact.stateless,
ReasonReact.noRetainedProps,
unit,
);
};

module type Impl = {let view: ReasonReact.reactClass;};

module CreateComponent = (Impl: Impl) : TextComponent => {
let make =
(
~accessibilityRole=?,
~accessible=?,
~allowFontScaling=?,
~ellipsizeMode=?,
~numberOfLines=?,
~onLayout=?,
~onLongPress=?,
~onPress=?,
~pressRetentionOffset=?,
~selectable=?,
~style=?,
~testID=?,
~selectionColor=?,
~textBreakStrategy=?,
~adjustsFontSizeToFit=?,
~minimumFontScale=?,
~suppressHighlighting=?,
~value=?,
children,
) =>
ReasonReact.wrapJsForReason(
~reactClass=Impl.view,
~props={
"accessibilityRole": accessibilityRole,
"accessible": accessible,
"allowFontScaling": allowFontScaling,
"ellipsizeMode":
UtilsRN.option_map(
fun
| `head => "head"
| `middle => "middle"
| `tail => "tail"
| `clip => "clip",
ellipsizeMode,
),
"numberOfLines": numberOfLines,
"onLayout": onLayout,
"onLongPress": onLongPress,
"onPress": onPress,
"pressRetentionOffset": pressRetentionOffset,
"selectable": selectable,
"style": style,
"testID": testID,
"selectionColor": selectionColor,
"textBreakStrategy":
UtilsRN.option_map(
fun
| `simple => "simple"
| `highQuality => "highQuality"
| `balanced => "balanced",
textBreakStrategy,
),
"adjustsFontSizeToFit": adjustsFontSizeToFit,
"minimumFontScale": minimumFontScale,
"suppressHighlighting": suppressHighlighting,
},
switch (value) {
| Some(string) =>
Array.append([|ReasonReact.string(string)|], children)
| None => children
},
);
};

include CreateComponent({
[@bs.module "react-native"] external view: ReasonReact.reactClass = "Text";
});
35 changes: 35 additions & 0 deletions src/BsReactNativeWeb/ViewWeb.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a15ab8b

Please sign in to comment.