/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
private/helloworld/ios/HelloWorld/AppDelegate.swift
64 строки
2 KB
Dawid Malecki
iOS: Add new configuration for `RCTDevMenu` (#53505)
01 окт 2025, 12:42
01 окт 2025, 12:42
29d5aa5
Код
Авторство
О чём код?
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import React import ReactAppDependencyProvider import React_RCTAppDelegate import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var reactNativeDelegate: ReactNativeDelegate? var reactNativeFactory: RCTReactNativeFactory? func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil ) -> Bool { let delegate = ReactNativeDelegate() let factory = RCTReactNativeFactory(delegate: delegate) delegate.dependencyProvider = RCTAppDependencyProvider() reactNativeDelegate = delegate reactNativeFactory = factory #if DEBUG let devMenuConfiguration = RCTDevMenuConfiguration( devMenuEnabled: true, shakeGestureEnabled: true, keyboardShortcutsEnabled: true ) reactNativeFactory?.devMenuConfiguration = devMenuConfiguration #endif window = UIWindow(frame: UIScreen.main.bounds) factory.startReactNative( withModuleName: "HelloWorld", in: window, launchOptions: launchOptions ) return true } } class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate { override func sourceURL(for bridge: RCTBridge) -> URL? { self.bundleURL() } override func bundleURL() -> URL? { #if DEBUG RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index") #else Bundle.main.url(forResource: "main", withExtension: "jsbundle") #endif } }