mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Introduce EmptyReactNativeConfig inside Java
Summary: I'm adding a `EmptyReactNativeConfig` for Java as we had a similar class in C++. Ideally inside the Playbook we can allow users to use this class rather than having to create an anonymous inner class. Changelog: [Internal] [Added] - Introduce EmptyReactNativeConfig inside Java Reviewed By: ShikaSD Differential Revision: D32277916 fbshipit-source-id: f6bbeb0477681d536dfd89930b732609add7c43a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5050e7eaa1
commit
e6fc9b6f29
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.fabric;
|
||||
|
||||
/**
|
||||
* An empty {@link ReactNativeConfig} that is returning empty responses and false for all the
|
||||
* requested keys.
|
||||
*/
|
||||
public class EmptyReactNativeConfig implements ReactNativeConfig {
|
||||
|
||||
@Override
|
||||
public boolean getBool(final String s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt64(final String s) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(final String s) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDouble(final String s) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,16 @@ package com.facebook.react.fabric;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
// This is a wrapper for the ReactNativeConfig object in C++
|
||||
/**
|
||||
* ReactNative Configuration that allows to customize the behavior of key/value pairs used by the
|
||||
* framework to enable/disable capabilities.
|
||||
*
|
||||
* <p>The hosting app should provide an implementation of this interface to allow specific
|
||||
* customization of single keys. An empty implementation is available as {@link
|
||||
* EmptyReactNativeConfig}.
|
||||
*
|
||||
* <p>This is a wrapper for the ReactNativeConfig object in C++
|
||||
*/
|
||||
@DoNotStrip
|
||||
public interface ReactNativeConfig {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user