forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Adds e2e tests for cxx and java object props Reviewed By: JoshuaGross Differential Revision: D16759242 fbshipit-source-id: 2307dc4b3ba26222de510cf5876c582d35fc665c
- Loading branch information
1 parent
56f9eb3
commit 70fc54a
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
packages/react-native-codegen/buck_tests/java/ObjectPropsNativeComponentManager.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.facebook.react.uimanager; | ||
|
||
import android.view.ViewGroup; | ||
import com.facebook.react.bridge.ReadableMap; | ||
import com.facebook.react.viewmanagers.ObjectPropsNativeComponentManagerDelegate; | ||
import com.facebook.react.viewmanagers.ObjectPropsNativeComponentManagerInterface; | ||
|
||
public class ObjectPropsNativeComponentManager extends SimpleViewManager<ViewGroup> | ||
implements ObjectPropsNativeComponentManagerInterface<ViewGroup> { | ||
|
||
public static final String REACT_CLASS = "ObjectPropsNativeComponent"; | ||
|
||
@Override | ||
public String getName() { | ||
return REACT_CLASS; | ||
} | ||
|
||
private void test() { | ||
ObjectPropsNativeComponentManagerDelegate<ViewGroup, ObjectPropsNativeComponentManager> | ||
delegate = new ObjectPropsNativeComponentManagerDelegate<>(this); | ||
} | ||
|
||
@Override | ||
public ViewGroup createViewInstance(ThemedReactContext context) { | ||
throw new IllegalStateException(); | ||
} | ||
|
||
@Override | ||
public void setObjectProp(ViewGroup view, ReadableMap value) {} | ||
|
||
@Override | ||
public void setObjectArrayProp(ViewGroup view, ReadableMap value) {} | ||
|
||
@Override | ||
public void setObjectPrimitiveRequiredProp(ViewGroup view, ReadableMap value) {} | ||
} |
51 changes: 51 additions & 0 deletions
51
packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* 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. | ||
* | ||
* @format | ||
* @flow | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import type { | ||
PointValue, | ||
ColorValue, | ||
} from '../../../../../Libraries/StyleSheet/StyleSheetTypes'; | ||
import type {ImageSource} from '../../../../../Libraries/Image/ImageSource'; | ||
import type { | ||
Int32, | ||
Float, | ||
WithDefault, | ||
} from '../../../../../Libraries/Types/CodegenTypes'; | ||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes'; | ||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent'; | ||
|
||
type ObjectArrayPropType = $ReadOnly<{| | ||
array: $ReadOnlyArray<string>, | ||
|}>; | ||
|
||
type NativeProps = $ReadOnly<{| | ||
...ViewProps, | ||
|
||
// Props | ||
objectProp?: $ReadOnly<{| | ||
stringProp?: WithDefault<string, ''>, | ||
booleanProp: boolean, | ||
floatProp: Float, | ||
intProp: Int32, | ||
stringEnumProp?: WithDefault<'small' | 'large', 'small'>, | ||
|}>, | ||
objectArrayProp: ObjectArrayPropType, | ||
objectPrimitiveRequiredProp: $ReadOnly<{| | ||
image: ImageSource, | ||
color?: ColorValue, | ||
point: ?PointValue, | ||
|}>, | ||
|}>; | ||
|
||
export default codegenNativeComponent<NativeProps>( | ||
'ObjectPropsNativeComponent', | ||
); |