fable-compiler / fable-react-native

Fable bindings and helpers for React Native projects
Apache License 2.0
49 stars 11 forks source link

Adding react-native-device-info helper #19

Closed forki closed 6 years ago

forki commented 6 years ago

/cc @alfonsogarciacaro would appreciate a new release. hugs

alfonsogarciacaro commented 6 years ago

Done! :+1: 1.6.2

Zaid-Ajaj commented 6 years ago

@forki would this actually work: why import a normal library as a react component? according to react-native-device-info you can just import it the same way we do for node modules / other libraries.

module ReactNative.DeviceInfo 

open Fable.Core
open Fable.Core.JsInterop

type IDeviceInfo = 
  /// Gets the API level.
  abstract getAPILevel : unit -> int
  /// Gets the application name.
  abstract getApplicationName : unit -> string
  // etc . . . 

[<Import("*", "react-native-device-info")>] 
let deviceInfo : IDeviceInfo = jsNative
forki commented 6 years ago

Mhm the stuff I sent works. Feel free to opt it. I'm fine with breaking changes

Am 13.02.2018 23:06 schrieb "Zaid Ajaj" notifications@github.com:

@forki https://github.com/forki would this actually work: why import a normal library as a react component? according to react-native-device-info https://github.com/rebeccahughes/react-native-device-info you can just import it the same way we do for node modules / other libraries.

module ReactNative.DeviceInfo open Fable.Coreopen Fable.Core.JsInterop type IDeviceInfo = /// Gets the API level. abstract getAPILevel : unit -> int /// Gets the application name. abstract getApplicationName : unit -> string // etc . . . [<Import("*", "buffer")>] let deviceInfo : IDeviceInfo = jsNative

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fable-compiler/fable-react-native/pull/19#issuecomment-365421317, or mute the thread https://github.com/notifications/unsubscribe-auth/AADgNN-AcY5h9Sd6W2HAynIFOni-M0CUks5tUgeBgaJpZM4SD1ov .