Files
mattermost-mobile/app/utils/avoid_native_bridge.js
2018-06-19 19:14:50 -04:00

20 lines
592 B
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Platform} from 'react-native';
/**
* avoidNativeBridge: a helper function that facilitates returning
* a constant variable packaged from InitializationModule
* or from a NativeModule which will make a call to the native bridge
*
* Currently only required for Android
*/
export default function avoidNativeBridge(runOptimized, optimized, fallback) {
if (Platform.OS === 'android' && runOptimized()) {
return optimized();
}
return fallback();
}