yarn add react-native-config
react-native link react-native-config
- Create
.env
files for each configuration. Ex:.env.dev
,.env.prod
, etc Ex:
API_ENDPOINT=https://api.myresource.com/dev
ENV=dev
import SwiftUI | |
struct DemoView: View { | |
@State var effectValue: Double | |
let end = 2.75 | |
init() { | |
self._effectValue = State(initialValue: end) |
// MARK: - SceneDelegate | |
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
var window: UIWindow? | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
let navigationController = UINavigationController(navigationBarClass: NavigationBar.self, toolbarClass: nil) | |
(navigationController.navigationBar as! NavigationBar).preferredHeight = 88 | |
navigationController.setViewControllers([ViewController()], animated: false) | |
import SwiftUI | |
/// A wrapper view that provides a mutable Binding to its content closure. | |
/// | |
/// Useful in Xcode Previews for interactive previews of views that take a Binding. | |
struct Stateful<Value, Content: View>: View { | |
var content: (Binding<Value>) -> Content | |
@State private var state: Value | |
init(initialState: Value, @ViewBuilder content: @escaping (Binding<Value>) -> Content) { |
#!/usr/bin/env bash -e | |
## | |
## Automatic version from package.json file | |
## | |
## Call this script from your XCode Scheme: | |
## - Copy / paste this script in a .sh file | |
## - Open your app scheme in XCode (shortcut: Cmd + <) | |
## - go to Build > Pre-actions | |
## - Add a run Script ('+' button in scheme window > "New Run Script Action" |
import axios, { AxiosResponse } from 'axios'; | |
import { get } from 'lodash-es'; | |
const rest = axios.create({ | |
baseURL: 'some base URL goes here', | |
}); | |
// this one send file as Blob type | |
const getPdf = () => ( | |
rest.get(`/get-pdf`, { |
/// An iOS style TabView that doesn't reset it's childrens navigation stacks when tabs are switched. | |
public struct UIKitTabView: View { | |
private var viewControllers: [UIHostingController<AnyView>] | |
private var selectedIndex: Binding<Int>? | |
@State private var fallbackSelectedIndex: Int = 0 | |
public init(selectedIndex: Binding<Int>? = nil, @TabBuilder _ views: () -> [Tab]) { | |
self.viewControllers = views().map { | |
let host = UIHostingController(rootView: $0.view) | |
host.tabBarItem = $0.barItem |
import SwiftUI | |
/// Example of how to get Dynamic Type with custom fonts in SwiftUI. | |
struct ContentView: View { | |
var body: some View { | |
VStack(spacing: 20) { | |
Text("A large title").customFont(.largeTitle) // "Optima-ExtraBlack", 28 | |
Text("A body").customFont(.body) // "Kailasa", 16 | |
Text("A caption").customFont(.caption2) // "IowanOldStyle-Italic", 11 | |
} |
[{"name":"Afghanistan","flag":"🇦🇫","code":"AF","dial_code":"+93"},{"name":"Åland Islands","flag":"🇦🇽","code":"AX","dial_code":"+358"},{"name":"Albania","flag":"🇦🇱","code":"AL","dial_code":"+355"},{"name":"Algeria","flag":"🇩🇿","code":"DZ","dial_code":"+213"},{"name":"American Samoa","flag":"🇦🇸","code":"AS","dial_code":"+1684"},{"name":"Andorra","flag":"🇦🇩","code":"AD","dial_code":"+376"},{"name":"Angola","flag":"🇦🇴","code":"AO","dial_code":"+244"},{"name":"Anguilla","flag":"🇦🇮","code":"AI","dial_code":"+1264"},{"name":"Antarctica","flag":"🇦🇶","code":"AQ","dial_code":"+672"},{"name":"Antigua and Barbuda","flag":"🇦🇬","code":"AG","dial_code":"+1268"},{"name":"Argentina","flag":"🇦🇷","code":"AR","dial_code":"+54"},{"name":"Armenia","flag":"🇦🇲","code":"AM","dial_code":"+374"},{"name":"Aruba","flag":"🇦🇼","code":"AW","dial_code":"+297"},{"name":"Australia","flag":"🇦🇺","code":"AU","dial_code":"+61"},{"name":"Austria","flag":"🇦🇹","code":"AT","dial_code":"+43"},{"name":"Azerbaijan","flag":"🇦🇿","code":"AZ","dial_code":"+9 |
yarn add react-native-config
react-native link react-native-config
.env
files for each configuration. Ex: .env.dev
, .env.prod
, etc
Ex:API_ENDPOINT=https://api.myresource.com/dev
ENV=dev
import Eureka | |
open class _SearchablePushRow<T: Equatable, Cell: CellType> : TableSelectorRow<Cell, SearchableViewController<T>> where Cell: BaseCell, Cell: TypedCellType, Cell.Value == T, T: SearchableItem, T: CustomStringConvertible { | |
public required init(tag: String?) { | |
super.init(tag: tag) | |
onCreateControllerCallback = { [weak self] _ in | |
let controller = SearchableViewController<T>() | |
controller.searchPlaceholder = self?.searchPlaceholder | |
return controller |