我正在尝试使用获得专利的 fable interop 制作一个基本的 react-native 应用程序,以便我可以使用 F# 进行实际编码。F# 部分到目前为止进展顺利,但是我在理解与 react-native 包的互操作如何工作时遇到了很大的问题。
我想尝试为https://reactnavigation.org/docs/material-bottom-tab-navigator设置绑定
这是当前代码
open Elmish
open Fable.React
open Fable
open Fable.Core
open Fable.Core.JsInterop
open Fable.ReactNative.Types
type ScreenOptions =
| Title of string
| TabBarIcon of (bool*string -> ReactElement)
| TabBarColor of string
| TabBarLabel of string
| TabBarAccessibilityLabel of obj
| TabBarTestId of string
type ScreenProps =
| Name of string
| Component of obj
| Options of ScreenOptions
type NavigatorProps =
| InitialRouteName of string
| ScreenOptions of ScreenOptions
| BackBehavior
| Shifting of bool
| Labeled of bool
| ActiveColor of string
| InactiveColor of string
| BarStyle of obj
type ITab =
abstract member Navigator : NavigatorProps list -> ReactElement
abstract member Screen : ScreenProps list -> ReactElement
type Globals =
[<Import("createMaterialBottomTabNavigator", from="@react-navigation/material-bottom-tabs")>]
static member NavBar with get(): ITab = failwith "JS only" and set(v:ITab): unit = failwith "JS only"
let inline renderNavBar (navbar : obj) (props : NavigatorProps list) =
ReactBindings.React.createElement(navbar, (keyValueList CaseRules.LowerFirst props), [])
let inline renderNavBarScreen (navbar : obj) (props : ScreenProps list) =
ReactBindings.React.createElement(navbar, (keyValueList CaseRules.LowerFirst props), [])
这只是因错误而崩溃:
TypeError: (0, _native.createNavigatorFactory) is not a function.
(In '(0, _native.createNavigatorFacvtory)(MaterialBottomTabNavigator)','
(0, _native.createNavigatorFactory)' is undefined)
我假设我如何导入库或如何渲染它?任何帮助将不胜感激。