小编fin*_*inn的帖子

PageTabViewStyle 破坏了 NavigationView

我正在开发 SwiftUI 视图。当在 TabView 中使用 NavigationView 时,应用程序将按预期工作。

struct ContentView: View {
    
    var body: some View {
        TabView {
            NavigationView {
                Text("A")
                    .navigationBarTitle("Nav A")
            }
            .frame(maxWidth: .infinity, maxHeight: .infinity)
            NavigationView {
                Text("B")
                    .navigationBarTitle("Nav B")
            }
            .frame(maxWidth: .infinity, maxHeight: .infinity)
        }
        //.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never)) // this line breaks the view
    }
}
Run Code Online (Sandbox Code Playgroud)

一旦我取消注释,.tabViewStyle(...)视图就不会按预期工作。有什么想法吗?文字不再可见。导航似乎也不正确。

没有 PageTabViewStyle 也能正常工作

PageTabViewStyle 破坏视图

swiftui

5
推荐指数
1
解决办法
980
查看次数

Solana 在 Linux / Ubuntu 上启动 solana-test-validator 块存储错误

当尝试在我的 Ubuntu 机器上启动时,solana-test-validator我收到以下错误:

Error: failed to start validator: Failed to create ledger at test-ledger: blockstore error
Run Code Online (Sandbox Code Playgroud)

详细查看错误日志时,我注意到以下问题:

[0m[38;5;8m[[0m2021-12-11T10:29:28.942979023Z [0m[1m[31mERROR[0m solana_ledger::blockstore[0m[38;5;8m][0m tar stderr: /bin/sh: 1: bzip2: not found
Run Code Online (Sandbox Code Playgroud)

solana solana-cli

4
推荐指数
1
解决办法
2599
查看次数

Mantine 莫代尔未显示

我使用 Vite 创建了一个 React 应用程序并安装了Mantine v6.0.0. 当我调用以下函数打开 Mantine 模态时,视图变暗,但模态不可见。

const openModal = () => modals.openConfirmModal({
    title: 'Please confirm your action',
    children: (
      <Text size="sm">
        This action is so important that you are required to confirm it with a modal. Please click
        one of these buttons to proceed.
      </Text>
    ),
    labels: { confirm: 'Confirm', cancel: 'Cancel' },
    onCancel: () => console.log('Cancel'),
    onConfirm: () => console.log('Confirmed'),
  });
Run Code Online (Sandbox Code Playgroud)

css reactjs vite mantine

4
推荐指数
1
解决办法
2143
查看次数

如何检测 SwiftUI ColorPicker 的颜色何时更新?

我正在使用 SwiftUI,并希望在使用 ColorPicker 选择颜色后立即将其保存到 UserDefaults 中。做这个的最好方式是什么?

struct CustomizeView: View {
    
    @State private var color: Color = Color.green
    
    var body: some View {
            ColorPicker("Select a color!", selection: $color, supportsOpacity: false)
        }.onAppear {
            guard let defaults = UserDefaults(suiteName: "...") else { return }
            color = Color(rgb: defaults.integer(forKey: "color"))
        }
    }

    // where do I call the saveColors() function?
    
    func saveColors() {
        guard let defaults = UserDefaults(suiteName: "...") else { return }
        defaults.set(color.rgb, forKey: "colorCancel")
        defaults.synchronize()
    }
}
Run Code Online (Sandbox Code Playgroud)

(颜色的 rgb 初始值设定项是自定义的,不应该相关。)

swiftui

3
推荐指数
1
解决办法
828
查看次数

标签 统计

swiftui ×2

css ×1

mantine ×1

reactjs ×1

solana ×1

solana-cli ×1

vite ×1