react-native-navigation
Version:
React Native Navigation - truly native navigation for iOS and Android
66 lines (65 loc) • 3.75 kB
JavaScript
;
import once from 'lodash/once';
import get from 'lodash/get';
import { each } from 'lodash';
import { Platform } from 'react-native';
export class Deprecations {
deprecatedOptions = [{
key: 'topBar.searchBarHiddenWhenScrolling',
showWarning: once((_key, parentOptions) => {
console.warn(`${_key} is deprecated and will be removed in the next major version. For more information see https://github.com/wix/react-native-navigation/issues/6585`, parentOptions);
})
}, {
key: 'topBar.searchBarPlaceholder',
showWarning: once((_key, parentOptions) => {
console.warn(`${_key} is deprecated and will be removed in the next major version. For more information see https://github.com/wix/react-native-navigation/issues/6585`, parentOptions);
})
}, {
key: 'topBar.searchBarBackgroundColor',
showWarning: once((_key, parentOptions) => {
console.warn(`${_key} is deprecated and will be removed in the next major version. For more information see https://github.com/wix/react-native-navigation/issues/6585`, parentOptions);
})
}, {
key: 'topBar.searchBarTintColor',
showWarning: once((_key, parentOptions) => {
console.warn(`${_key} is deprecated and will be removed in the next major version. For more information see https://github.com/wix/react-native-navigation/issues/6585`, parentOptions);
})
}, {
key: 'topBar.hideNavBarOnFocusSearchBar',
showWarning: once((_key, parentOptions) => {
console.warn(`${_key} is deprecated and will be removed in the next major version. For more information see https://github.com/wix/react-native-navigation/issues/6585`, parentOptions);
})
}];
checkForDeprecatedOptions(options) {
each(this.deprecatedOptions, option => {
if (get(options, option.key, null)) {
option.showWarning(option.key, options);
}
});
}
onProcessOptions(key, parentOptions, commandName) {
if (key === 'bottomTabs' && parentOptions[key]?.visible !== undefined && Platform.OS === 'ios' && commandName === 'mergeOptions') {
this.deprecateBottomTabsVisibility(parentOptions);
}
if (key === 'searchBar' && Platform.OS === 'ios' && typeof parentOptions[key] === 'boolean') {
this.deprecateSearchBarOptions(parentOptions);
}
if (key === 'interpolation' && typeof parentOptions[key] === 'string') {
this.deprecateInterpolationOptions(parentOptions);
}
if (key === 'showModal' || key === 'dismissModal') {
if (typeof parentOptions[key] === 'object' && !('enter' in parentOptions[key]) && !('exit' in parentOptions[key])) console.warn(`${key} without enter/exit is deprecated, and will be changed in the next major version. For more information see https://wix.github.io/react-native-navigation/docs/style-animations#modal-animations`, parentOptions);
}
}
onProcessDefaultOptions(_key, _parentOptions) {}
deprecateSearchBarOptions = once(parentOptions => {
console.warn(`toggling searchBar visibility using a boolean value will be removed in the next major version. For more information see https://github.com/wix/react-native-navigation/issues/6585`, parentOptions);
});
deprecateInterpolationOptions = once(parentOptions => {
console.warn(`Using Interpolation types as strings has been deprecated and will be removed in the next major version. For more information see https://github.com/wix/react-native-navigation/pull/6644`, parentOptions);
});
deprecateBottomTabsVisibility = once(parentOptions => {
console.warn(`toggling bottomTabs visibility is deprecated on iOS. For more information see https://github.com/wix/react-native-navigation/issues/6416`, parentOptions);
});
}
//# sourceMappingURL=Deprecations.js.map