This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Returns the latest value of given prop as a ref. | |
| * | |
| * This function allows treating given prop as a non-reactive value, that should be | |
| * accessible in `useEffect` but does not trigger effect re-run. | |
| * | |
| * @param value - The prop value to be used as a ref | |
| * @returns A ref that will always hold the latest value of the prop | |
| */ | |
| function useLatestPropRef<T>(value: T) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect } from 'react' | |
| export class Timer { | |
| name: string | |
| lastTimestamp = 0 | |
| counts = new Map<string, number>() | |
| durations = new Map<string, number>() | |
| totalDuration = 0 | |
| totalCount = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Flutter | |
| import React | |
| import UIKit | |
| @UIApplicationMain | |
| @objc class AppDelegate: FlutterAppDelegate { | |
| override func application( | |
| _ application: UIApplication, | |
| didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? | |
| ) -> Bool { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import React | |
| // Source: https://github.com/TMisiukiewicz/react-native-host-example/blob/main/ios/ReactNativeHostExample/BridgeManager.swift | |
| class BridgeManager: NSObject { | |
| static let shared = BridgeManager() | |
| var bridge: RCTBridge? | |
| public func loadReactNative(launchOptions: [AnyHashable: Any]?) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Flutter | |
| import React | |
| import UIKit | |
| /** | |
| * Factory used by Flutter to create instances of FLReactView. | |
| * @see https://docs.flutter.dev/platform-integration/ios/platform-views | |
| */ | |
| class FLReactViewFactory: NSObject, FlutterPlatformViewFactory { | |
| private var messenger: FlutterBinaryMessenger |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <manifest xmlns:android="http://schemas.android.com/apk/res/android"> | |
| <!-- Permissions used by RN .... --> | |
| <uses-permission android:name="android.permission.INTERNET"/> | |
| <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> | |
| <!-- Use our MainApplication class --> | |
| <application | |
| android:label="flutter_brownfield_app" | |
| android:name=".MainApplication" | |
| android:icon="@mipmap/ic_launcher" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.flutter_brownfield_app | |
| import android.content.Intent | |
| import android.view.KeyEvent | |
| import com.facebook.react.ReactInstanceManager | |
| import com.facebook.react.ReactNativeHost | |
| import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler | |
| import io.flutter.embedding.android.FlutterActivity | |
| // ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.flutter_brownfield_app | |
| import android.app.Application | |
| import com.facebook.react.PackageList | |
| import com.facebook.react.ReactApplication | |
| import com.facebook.react.ReactPackage | |
| import com.facebook.react.defaults.DefaultReactNativeHost | |
| import com.facebook.soloader.SoLoader | |
| class MainApplication: Application(), ReactApplication { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.flutter_brownfield_app | |
| import android.content.Context | |
| import io.flutter.plugin.common.StandardMessageCodec | |
| import io.flutter.plugin.platform.PlatformView | |
| import io.flutter.plugin.platform.PlatformViewFactory | |
| /** | |
| * This is a Flutter PlatformViewFactory for creating instances of ReactView. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.flutter_brownfield_app | |
| import android.content.Context | |
| import android.view.View | |
| import com.facebook.react.ReactRootView | |
| import io.flutter.plugin.platform.PlatformView | |
| /** | |
| * This view is used to embed React Native view directly in the native view hierarchy. It allows to | |
| * mix and match Flutter and React Native views on one screen. |
NewerOlder